Hacker News new | ask | show | jobs
by setuids 1550 days ago
> under/overflow Assuming the 2 variables are treated as unsigned ints, even with under/overflows the algorithm works, since if a=a+b overflows, then b=a-b is guaranteed to underflow, thus returning the original a. The overflowed bit is irrelevant here
1 comments

I never considered that this algorithm would work so well with unsigned int. Looks like I learn something new today.