Dear All: When I compile the the code with the statement: The type of short_idx is unsigned short. Row1= (short_idx * 64) >> 8 >>8; If the value of short_idx is 2048, the Row1 should be 2,but Row1 will be 0. But if I change the statement to the following. Row1= ((unsigned long)short_idx * (unsigned long)64) >> 8 >>8; Then Row1 would become 2 and is correct. So what should I do in compiler to avoid of such problem without adding "unsigned long" in every statement I used in my problem? Thank you ...
what are you doing? Row1= (short_idx * 64) >> 8 >>8; the equivalent of << 6 >>8 >>8 why not >>2 >>8 or >>10 Erik