Bug fact: Following code cannot get right results.
#include "SST89x5xxRD2.H" signed char x,y,z; void main() { x = -15; y = x / 4; z = x % 4; while(1); }
y = -4 and z = -3, while y should be -3...
Reason: Compiler automatically generates RRC for division by power of 2. For a SIGNED CHAR, this could produce unexpected rounding results.
Solution: If a signed char is divided by power of 2, DO NOT use RRC in this case.
But as KeilC51 library functions choose truncating TOWARD ZERO
Where are you using the KeilC51 library functions?
It's not a bug, because the compiler is allowed to act as it chooses.