]> Git Repo - uclibc-ng.git/commit
nice: fix overflow checking in int_add_no_wrap()
authorXi Wang <[email protected]>
Wed, 20 Feb 2013 17:45:45 +0000 (12:45 -0500)
committerBernhard Reutner-Fischer <[email protected]>
Wed, 20 Feb 2013 18:12:51 +0000 (19:12 +0100)
commit79cd5fb435d910233b1eb03c93c6ae05908ab42b
tree3e29124e9dec22cc00fa5fd4a02524a723fb8e52
parent3d791bda2e68136e5cfc52b5386e0db805b5d3ba
nice: fix overflow checking in int_add_no_wrap()

In C, signed integer overflow is undefined behavior.  Many compilers
optimize away checks like `a + b < a'.

Use safe precondition testing instead.

Signed-off-by: Xi Wang <[email protected]>
Signed-off-by: Bernhard Reutner-Fischer <[email protected]>
libc/sysdeps/linux/common/nice.c
This page took 0.022939 seconds and 4 git commands to generate.