I am not sure about signed hex division by decimal.

How can long type fff0bdc0 divided by 1000L turn to be fffffc18?

   long a = 0xfff0bdc0;
   a = a/1000L;
   UARTprintf("a = %x\n", a);

result of print : a = fffffc18

Thanks,

Jin

有帮助吗?

解决方案

Assuming that long is a 32-bit integer, and negative numbers are represented using the two's complement:

fff0bdc0 (hex) = -1000000 (decimal)
fffffc18 (hex) =    -1000 (decimal)

So your result looks correct.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top