How to get good signed result?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

int hdata,hdataprev;
char factor = 0x03
if(hdata > (hdataprev + (int)factor)){
do A
}else{
do B
}
if hdata is like 0xFF0A and hdataprev like 0xFF00 , then everything is OK - code A is executed
BUT
when hdata is 0x00AA and hdataprev like above(0xFF00) then code B is executed instead of code A (Positive 0x00AA is greater than negative 0xFF00).
Isn't it?
Robert

0 Likes
0 Replies