Don't use fixup for C99 and up, the compiler result is already correct.
Suggested by: bde MFC after: 1 week
This commit is contained in:
parent
3f58662dd9
commit
69c526f46e
@ -46,6 +46,7 @@ div(num, denom)
|
||||
|
||||
r.quot = num / denom;
|
||||
r.rem = num % denom;
|
||||
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
|
||||
/*
|
||||
* The ANSI standard says that |r.quot| <= |n/d|, where
|
||||
* n/d is to be computed in infinite precision. In other
|
||||
@ -73,5 +74,6 @@ div(num, denom)
|
||||
r.quot++;
|
||||
r.rem -= denom;
|
||||
}
|
||||
#endif
|
||||
return (r);
|
||||
}
|
||||
|
@ -37,9 +37,11 @@ imaxdiv(intmax_t numer, intmax_t denom)
|
||||
|
||||
retval.quot = numer / denom;
|
||||
retval.rem = numer % denom;
|
||||
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
|
||||
if (numer >= 0 && retval.rem < 0) {
|
||||
retval.quot++;
|
||||
retval.rem -= denom;
|
||||
}
|
||||
#endif
|
||||
return (retval);
|
||||
}
|
||||
|
@ -48,9 +48,11 @@ ldiv(num, denom)
|
||||
|
||||
r.quot = num / denom;
|
||||
r.rem = num % denom;
|
||||
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
|
||||
if (num >= 0 && r.rem < 0) {
|
||||
r.quot++;
|
||||
r.rem -= denom;
|
||||
}
|
||||
#endif
|
||||
return (r);
|
||||
}
|
||||
|
@ -37,9 +37,11 @@ lldiv(long long numer, long long denom)
|
||||
|
||||
retval.quot = numer / denom;
|
||||
retval.rem = numer % denom;
|
||||
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
|
||||
if (numer >= 0 && retval.rem < 0) {
|
||||
retval.quot++;
|
||||
retval.rem -= denom;
|
||||
}
|
||||
#endif
|
||||
return (retval);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user