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

John Regehr wrote a post about checking for signed overflow a few years ago:

https://blog.regehr.org/archives/1139

HN discussion:

https://news.ycombinator.com/item?id=7665254

Your first suggestion is similar to his checked_add_1(). The Emacs macros are similar to his checked_add_4(). Presumably builtins are optimal, performance wise, for a given compiler.



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

Search: