Why the below code produces this error?
error: left shift count >= width of type [-Werror]
The code:
int32_t a,b;
int64_t apo;
a = 2673;
b = 19;
apo = BIG_MULL(a,b);
printf("\n %ld \n", apo );
The macros found here:
#define WORD_MASK ((1<<16) - 1)
#define LOW_WORD(x) (x & WORD_MASK)
#define HIGH_WORD(x) ((x & (WORD_MASK<<16)) >> 16)
#define BIG_MULL(a, b) \
((LOW_WORD(a) * LOW_WORD(b)) << 0) + \
((LOW_WORD(a) * HIGH_WORD(b)) << 16) + \
((HIGH_WORD(a) * LOW_WORD(b)) << 16) + \
((HIGH_WORD(a) * HIGH_WORD(b)) << 32)
I am trying to multiply to signed values of 32 bit. The target machine has no support of 64 bit math.