i am trying to port an assembly logic which is as below MUL R8,R9 MOV R4, MDH i am trying to write the same logic in C. i need to move the MDH contents into a variable which i am not able to do.when i check the assembly listing of the C code, i find that always the MDL contents are being moved and not the MDH contents. has anyone encountered this problem.
Are you trying to do a 32-bit multiplication? You may have forgotten to use a type cast to long. Remember that in C the product of two ints is int. Compile this and see the difference:
int a, b, c, d; c = ( a * b ) >> 16; d = ( (long)a * (long)b ) >> 16;