Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
Deriving a bit-twiddling hack: Signed integer overflow
(
grack.com
)
32 points
by
mmastrac
on Dec 20, 2022
|
hide
|
past
|
favorite
|
5 comments
ridiculous_fish
on Dec 21, 2022
|
next
[–]
Good article. The simple way to think about this is that overflow occurs when the sign of the addends agree, and the sum has the opposite sign. The bit tricks then write themselves.
raphlinus
on Dec 21, 2022
|
prev
|
next
[–]
This seemed strangely familiar.
Nice writeup though! I like the way it derived the logic rather than just presenting the solution.
sowbug
on Dec 21, 2022
|
prev
[–]
*complement
mmastrac
on Dec 21, 2022
|
parent
|
next
[–]
Fixed thanks!
furyofantares
on Dec 21, 2022
|
parent
|
prev
[–]
thanks
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: