L will need 33 Bits (Assuming they are unsigned numbers.)
L (bits) = Max ( 32bits , 24bits , 17bits ) + 1 (for carry)
Regards,
-Elecrom
Signed or unsigned? Will make a difference for the multiplies.
L=MN + PQ + 2T
where M,N,Q,T are 16 bits and P is 8 bits.
#include <stdio.h>
void xbits(unsigned long long x){
unsigned long long m = 1ull << (sizeof(m)*8-1);
while(m){
putchar((x & m) ? '1':'0');
m>>=1;
}
}
int main(void){
unsigned long long m,n,p,q,t,r;
m = n = t = q = 0xffff;
p = 0xff;
//r = (unsigned long long)-1;
//printf("sizeof(r) == %u, r=%llx\n",sizeof r,r);
r = m*n + p*q + 2*t;
printf("%llx = ",r);
xbits(r);
return 0;
}
100feff00 = 0000000000000000000000000000000100000000111111101111111100000000