Portability fix: use unsigned cast to guaranteed positive part of expression
in case {L}LONG_MAX > abs({L}LONG_MIN). Non-functional change - we don't have any such platforms.
This commit is contained in:
parent
5ee68af4e9
commit
36a7b5dd63
@ -107,7 +107,7 @@ strtol(nptr, endptr, base)
|
||||
* Set 'any' if any `digits' consumed; make it negative to indicate
|
||||
* overflow.
|
||||
*/
|
||||
cutoff = neg ? (unsigned long)-(LONG_MIN + LONG_MAX) + LONG_MAX
|
||||
cutoff = neg ? -(LONG_MIN + LONG_MAX) + (unsigned long)LONG_MAX
|
||||
: LONG_MAX;
|
||||
cutlim = cutoff % base;
|
||||
cutoff /= base;
|
||||
|
@ -107,7 +107,7 @@ strtoll(nptr, endptr, base)
|
||||
* Set 'any' if any `digits' consumed; make it negative to indicate
|
||||
* overflow.
|
||||
*/
|
||||
cutoff = neg ? (unsigned long long)-(LLONG_MIN + LLONG_MAX) + LLONG_MAX
|
||||
cutoff = neg ? -(LLONG_MIN + LLONG_MAX) + (unsigned long long)LLONG_MAX
|
||||
: LLONG_MAX;
|
||||
cutlim = cutoff % base;
|
||||
cutoff /= base;
|
||||
|
Loading…
Reference in New Issue
Block a user