diff options
Diffstat (limited to 'elsie.nci.nih.gov/src/private.h')
-rw-r--r-- | elsie.nci.nih.gov/src/private.h | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/elsie.nci.nih.gov/src/private.h b/elsie.nci.nih.gov/src/private.h index 61cf922..184da8f 100644 --- a/elsie.nci.nih.gov/src/private.h +++ b/elsie.nci.nih.gov/src/private.h @@ -19,13 +19,9 @@ /* ** Defaults for preprocessor symbols. -** You can override these in your C compiler options, e.g. '-DHAVE_ADJTIME=0'. +** You can override these in your C compiler options, e.g. '-DHAVE_GETTEXT=1'. */ -#ifndef HAVE_ADJTIME -#define HAVE_ADJTIME 1 -#endif /* !defined HAVE_ADJTIME */ - #ifndef HAVE_GETTEXT #define HAVE_GETTEXT 0 #endif /* !defined HAVE_GETTEXT */ @@ -38,10 +34,6 @@ #define HAVE_LINK 1 #endif /* !defined HAVE_LINK */ -#ifndef HAVE_SETTIMEOFDAY -#define HAVE_SETTIMEOFDAY 3 -#endif /* !defined HAVE_SETTIMEOFDAY */ - #ifndef HAVE_STRDUP #define HAVE_STRDUP 1 #endif @@ -63,7 +55,7 @@ #endif /* !defined HAVE_UNISTD_H */ #ifndef HAVE_UTMPX_H -#define HAVE_UTMPX_H 0 +#define HAVE_UTMPX_H 1 #endif /* !defined HAVE_UTMPX_H */ #ifndef NETBSD_INSPIRED @@ -195,7 +187,7 @@ typedef long long int_fast64_t; # define INT_FAST64_MIN LLONG_MIN # define INT_FAST64_MAX LLONG_MAX # else -# if (LONG_MAX >> 31) < 0xffffffff +# if LONG_MAX >> 31 < 0xffffffff Please use a compiler that supports a 64-bit integer type (or wider); you may need to compile with "-DHAVE_STDINT_H". # endif @@ -247,6 +239,18 @@ typedef long intmax_t; # endif #endif +#ifndef UINT_FAST64_MAX +# if defined ULLONG_MAX || defined __LONG_LONG_MAX__ +typedef unsigned long long uint_fast64_t; +# else +# if ULONG_MAX >> 31 >> 1 < 0xffffffff +Please use a compiler that supports a 64-bit integer type (or wider); +you may need to compile with "-DHAVE_STDINT_H". +# endif +typedef unsigned long uint_fast64_t; +# endif +#endif + #ifndef UINTMAX_MAX # if defined ULLONG_MAX || defined __LONG_LONG_MAX__ typedef unsigned long long uintmax_t; @@ -472,15 +476,20 @@ time_t time2posix_z(timezone_t, time_t) ATTRIBUTE_PURE; #define TYPE_SIGNED(type) (((type) -1) < 0) #endif /* !defined TYPE_SIGNED */ -/* The minimum and maximum finite time values. */ -static time_t const time_t_min = - (TYPE_SIGNED(time_t) - ? (time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1) - : 0); -static time_t const time_t_max = - (TYPE_SIGNED(time_t) - ? - (~ 0 < 0) - ((time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1)) - : -1); +#define TWOS_COMPLEMENT(t) ((t) ~ (t) 0 < 0) + +/* Max and min values of the integer type T, of which only the bottom + B bits are used, and where the highest-order used bit is considered + to be a sign bit if T is signed. */ +#define MAXVAL(t, b) \ + ((t) (((t) 1 << ((b) - 1 - TYPE_SIGNED(t))) \ + - 1 + ((t) 1 << ((b) - 1 - TYPE_SIGNED(t))))) +#define MINVAL(t, b) \ + ((t) (TYPE_SIGNED(t) ? - TWOS_COMPLEMENT(t) - MAXVAL(t, b) : 0)) + +/* The minimum and maximum finite time values. This assumes no padding. */ +static time_t const time_t_min = MINVAL(time_t, TYPE_BIT(time_t)); +static time_t const time_t_max = MAXVAL(time_t, TYPE_BIT(time_t)); #ifndef INT_STRLEN_MAXIMUM /* |