Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
ytret
· 3y ago · 0 comments
Another way to understand what e.g. 0xFE means as a signed integer is to just add a number until it equals 0. So, 0xFE + 1 = 0xFF, not zero. 0xFE + 2 = 0. Therefore, 0xFE is -2.
Comments
[–]
amelius
3y ago
Yes and the formula to negate x can be simplified to:
0x100 - x
dropping the 9th bit (assuming 8 bit)
[–]
Solvency
3y ago
Uh, it's simpler than that. 0x0 is 0. 0xFF is -1. What more is there to "understand".