Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> For UINT_MAX, the algorithm would need to be reconsidered, though, since it's written with signed integers in mind.

The algorithm is written assuming that unary - produces the additive inverse. That is also true for C's unsigned integers. -1U == UINT_MAX, -UINT_MAX == 1U. It Just Works.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: