[libc] fix strtointeger behavior on max values
authorMichael Jones <michaelrj@google.com>
Wed, 29 Mar 2023 17:42:23 +0000 (10:42 -0700)
committerMichael Jones <michaelrj@google.com>
Wed, 29 Mar 2023 20:02:40 +0000 (13:02 -0700)
commit5ce83caba59d7c470e1a12a8d6ef63c33d98e177
treeafad4590f7bf7c3a514f1fa041a288ffe4769ff3
parentf5e63f8fc9f492944b8432d80c1c49051a7d600a
[libc] fix strtointeger behavior on max values

Previously the check to just return MAX or MIN used the caclulated
number being the maximum absolute value. This was right in every case
except for an unsigned conversion being passed its maximum value with a
negative sign on the front. This should return -MAX, but was returning
just MAX.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D147171
libc/src/__support/str_to_integer.h
libc/test/src/stdlib/StrtolTest.h