Commit Graph

13 Commits

Author SHA1 Message Date
Sean Barrett 1ee679ca2e update version numbers 2021-07-11 17:07:54 -07:00
Fabian Giesen e7f9f92c9d stb_divide: Update changelog 2021-07-07 01:33:35 -07:00
Fabian Giesen c38ec91d22 stb_divide: Fix integer overflow issues
We've established the signs of values before so we can carefully
jiggle the expressions to be guaranteed overflow-free; the tests
for <0 here were meant to check if the value was "still negative",
i.e. if the sum did not underflow below INT_MIN, and we can
rewrite that using algebra to be overflow-free.

We need an extra case in the Euclidean dvision for
INT_MIN / INT_MIN which is a bit annoying but trivial; finally,
for two's complement platforms, note that abs(x) = (x > 0) ? x : -x
does not work (since for x=INT_MIN, -x still gives INT_MIN),
but the equivalent formulation for _negative_ absolute value
(x < 0) ? x : -x is always in range and overflow-free, so
rewrite the relevant expressions using that negative absolute
value instead.

Fixes issue #741.
2021-07-07 01:27:15 -07:00
Sean Barrett 2bb4a0accd Fix trailing whitespace 2020-02-02 11:30:27 -08:00
Sean Barrett 5e4a0617b7 udpate version numbers 2020-02-02 11:12:13 -08:00
yangfl 5db48d3604 stb_divide: use return value to indicate errors 2019-07-04 19:11:55 +08:00
Sean Barrett c963e40972 update version numbers 2019-02-25 11:48:42 -08:00
Sean Barrett 5fe7fb52f2 various fixes for clang
also fix a comment typo
2019-02-25 11:10:54 -08:00
Sean Barrett 47685c5f84 remove deprecated old-precision jpg path from stb_image.h
tweak license reference wording
2017-03-03 08:19:09 -08:00
Sean Barrett e248e30954 change license to public-domain AND mit (based on twitter vote) 2017-03-03 07:53:07 -08:00
Craig Donner ee6978cb68 Slightly modify the public domain license to keep it in the public domain, but make it clear that even when dedications might not be recognized that the code is still usable. Given that this isn't dual-licensing under a different license, I'm hoping this will be acceptable. 2016-02-25 12:55:44 -08:00
Ryan Whitworth 242b1fe37a Added public domain license text 2015-08-01 14:48:08 -04:00
Sean Barrett a8fbfd2cb3 stb_divide.h 2014-05-25 21:54:59 -07:00