huh...I assume that (0-1) means the value is -1 (or, one hopes, 0xff)... If this were SIGNED arithmetic then 255 would make sense since -1 is what's left over when you divide it by 2...
I would double check that everything is really UNSIGNED. And perhaps just try some simple standalone test cases since you are running in simulation. Perhaps there's a bug in the compiler. If you can, look at the generated asm file and see... MS Dmitri Lushnikov wrote:
I was debugging my circular queue implementation and found out that according to TOSSIM: (0-1)%2 == 255. All values were uint8_t. I solved the problem with my queue, but this is not what I have learned at school about how mod operator is supposed to work. Did somebody encounter this problem before? Is there a reason why the modulo operator works this way in TOSSIM? _______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
