Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
Phelinofist
· 3y ago · 0 comments
Why did GCC change x < 0 to -1 < x? I guess it is faster - but why? x >=0 would have also been a valid transformation to archive the same flow
Comments
[–]
proto_lambda
3y ago
It's just an artifact of decompilation. It's the same operation in machine code (checking the MSB), there's no way to tell which one was used in the original source code.
[–]
stop50
3y ago
An signed integer uses the leftmost bit for the sign: 00000000 = 0 10000000 = 128 = -128
https://onlinetoolz.net/unsigned-signed#base=2&value=1000000...