1
0
mirror of https://frontier.innolan.net/rainlance/amiga-tz.git synced 2025-11-22 03:29:23 +00:00

Don't bother with uintmax_t in previous change.

See the thread starting with Clive D.W. Feather's comments in
<http://mm.icann.org/pipermail/tz/2013-August/019496.html>.
* localtime.c (truncate_time): Don't bother with uintmax_t,
as using it doesn't help on any known platform.
* private.h (UINTMAX_MAX): Remove.
This commit is contained in:
Paul Eggert
2013-08-07 16:08:39 -07:00
parent b0bf6d8fee
commit 3638e641e8
2 changed files with 9 additions and 18 deletions

View File

@ -1267,20 +1267,17 @@ truncate_time(time_t t)
** INTMAX_MAX is converted to a larger time_t value before it
** is compared.
**
** On all platforms that we know of, if a time value is
** outside intmax_t/uintmax_t range, then it is an integer so we can
** simply return it. There's no simple, portable way to check this.
** On all platforms that we know of (1) it is safe to compare
** INTMAX_MIN and INTMAX_MAX to floating-point values without
** worrying about undefined behavior due to floating-point
** overflow on conversion, and (2) any time_t value outside
** intmax_t range is an integer so we can simply return it.
** We know of no simple, portable way to check these assumptions.
** If you know of a counterexample platform, please report a bug.
*/
if (!TYPE_INTEGRAL(time_t)) {
if (INTMAX_MIN < t && t < INTMAX_MAX) {
intmax_t i = t;
return i;
}
if (0 <= t && t < UINTMAX_MAX) {
uintmax_t i = t;
return i;
}
if (!TYPE_INTEGRAL(time_t) && INTMAX_MIN < t && t < INTMAX_MAX) {
intmax_t i = t;
return i;
}
return t;

View File

@ -186,15 +186,9 @@ typedef long intmax_t;
# if defined ULLONG_MAX || defined __LONG_LONG_MAX__
typedef unsigned long long uintmax_t;
# define PRIuMAX "llu"
# ifdef ULLONG_MAX
# define UINTMAX_MAX ULLONG_MAX
# else
# define UINTMAX_MAX (__LONG_LONG_MAX__ * 2ULL + 1)
# endif
# else
typedef unsigned long uintmax_t;
# define PRIuMAX "lu"
# define UINTMAX_MAX ULONG_MAX
# endif
#endif