]> git.eshelyaron.com Git - emacs.git/commitdiff
Assume C99-style ‘long long’
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 1 Jan 2020 04:15:27 +0000 (04:15 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 1 Jan 2020 04:18:22 +0000 (20:18 -0800)
Now that Gnulib assumes ‘long long’, it is a good time to clean
out old cruft porting to pre-C99 compilers that lack it.
* src/data.c (ULL_WIDTH, ULL_MAX): Remove.
All uses replaced by ULLONG_WIDTH, ULLONG_MAX.
(bits_word_to_host_endian): Assume ‘unsigned long long’.
By the way, the old code had a performance typo: it used
HAVE_UNSIGNED_LONG_LONG where it should have used
HAVE_UNSIGNED_LONG_LONG_INT.
* src/sysdep.c (ULLONG_MAX): Remove, as lib/limits.h does this now.
(time_from_jiffies) [GNU_LINUX]: Assume ‘long long’.

admin/CPP-DEFINES
src/data.c
src/sysdep.c

index ea99d50094fc3e3e325bb4d79a176a7307717e8b..ce9a44436d86967917968ef81eb78a30ae3186dd 100644 (file)
@@ -201,7 +201,6 @@ HAVE_LIBXML2
 HAVE_LIBXMU
 HAVE_LOCALTIME_R
 HAVE_LOCAL_SOCKETS
-HAVE_LONG_LONG_INT
 HAVE_LRAND48
 HAVE_LSTAT
 HAVE_LUTIMES
@@ -322,7 +321,6 @@ HAVE_TM_ZONE
 HAVE_TOUCHLOCK
 HAVE_TZNAME
 HAVE_TZSET
-HAVE_UNSIGNED_LONG_LONG_INT
 HAVE_UTIL_H
 HAVE_UTIMENSAT
 HAVE_UTIMES
index b1530688468992ba04c8d0fc1d5c1a488e31a2c5..56e363f16b6ab27e250dca51b49d4faafbb77eff 100644 (file)
@@ -3310,27 +3310,14 @@ bool_vector_spare_mask (EMACS_INT nr_bits)
   return (((bits_word) 1) << (nr_bits % BITS_PER_BITS_WORD)) - 1;
 }
 
-/* Info about unsigned long long, falling back on unsigned long
-   if unsigned long long is not available.  */
-
-#if HAVE_UNSIGNED_LONG_LONG_INT && defined ULLONG_WIDTH
-enum { ULL_WIDTH = ULLONG_WIDTH };
-# define ULL_MAX ULLONG_MAX
-#else
-enum { ULL_WIDTH = ULONG_WIDTH };
-# define ULL_MAX ULONG_MAX
-# define count_one_bits_ll count_one_bits_l
-# define count_trailing_zeros_ll count_trailing_zeros_l
-#endif
-
 /* Shift VAL right by the width of an unsigned long long.
-   ULL_WIDTH must be less than BITS_PER_BITS_WORD.  */
+   ULLONG_WIDTH must be less than BITS_PER_BITS_WORD.  */
 
 static bits_word
 shift_right_ull (bits_word w)
 {
   /* Pacify bogus GCC warning about shift count exceeding type width.  */
-  int shift = ULL_WIDTH - BITS_PER_BITS_WORD < 0 ? ULL_WIDTH : 0;
+  int shift = ULLONG_WIDTH - BITS_PER_BITS_WORD < 0 ? ULLONG_WIDTH : 0;
   return w >> shift;
 }
 
@@ -3347,7 +3334,7 @@ count_one_bits_word (bits_word w)
     {
       int i = 0, count = 0;
       while (count += count_one_bits_ll (w),
-            (i += ULL_WIDTH) < BITS_PER_BITS_WORD)
+            (i += ULLONG_WIDTH) < BITS_PER_BITS_WORD)
        w = shift_right_ull (w);
       return count;
     }
@@ -3478,7 +3465,7 @@ count_trailing_zero_bits (bits_word val)
     return count_trailing_zeros (val);
   if (BITS_WORD_MAX == ULONG_MAX)
     return count_trailing_zeros_l (val);
-  if (BITS_WORD_MAX == ULL_MAX)
+  if (BITS_WORD_MAX == ULLONG_MAX)
     return count_trailing_zeros_ll (val);
 
   /* The rest of this code is for the unlikely platform where bits_word differs
@@ -3492,18 +3479,18 @@ count_trailing_zero_bits (bits_word val)
     {
       int count;
       for (count = 0;
-          count < BITS_PER_BITS_WORD - ULL_WIDTH;
-          count += ULL_WIDTH)
+          count < BITS_PER_BITS_WORD - ULLONG_WIDTH;
+          count += ULLONG_WIDTH)
        {
-         if (val & ULL_MAX)
+         if (val & ULLONG_MAX)
            return count + count_trailing_zeros_ll (val);
          val = shift_right_ull (val);
        }
 
-      if (BITS_PER_BITS_WORD % ULL_WIDTH != 0
+      if (BITS_PER_BITS_WORD % ULLONG_WIDTH != 0
          && BITS_WORD_MAX == (bits_word) -1)
        val |= (bits_word) 1 << pre_value (ULONG_MAX < BITS_WORD_MAX,
-                                          BITS_PER_BITS_WORD % ULL_WIDTH);
+                                          BITS_PER_BITS_WORD % ULLONG_WIDTH);
       return count + count_trailing_zeros_ll (val);
     }
 }
@@ -3516,10 +3503,8 @@ bits_word_to_host_endian (bits_word val)
 #else
   if (BITS_WORD_MAX >> 31 == 1)
     return bswap_32 (val);
-# if HAVE_UNSIGNED_LONG_LONG
   if (BITS_WORD_MAX >> 31 >> 31 >> 1 == 1)
     return bswap_64 (val);
-# endif
   {
     int i;
     bits_word r = 0;
index cb2f7f2f23c637f044d292b4d15a102d07906c6d..c6344d8cec747e794789026ef8630f2c6b3a6d67 100644 (file)
@@ -135,11 +135,6 @@ int _cdecl _spawnlp (int, const char *, const char *, ...);
 # include <sys/socket.h>
 #endif
 
-/* ULLONG_MAX is missing on Red Hat Linux 7.3; see Bug#11781.  */
-#ifndef ULLONG_MAX
-#define ULLONG_MAX TYPE_MAXIMUM (unsigned long long int)
-#endif
-
 /* Declare here, including term.h is problematic on some systems.  */
 extern void tputs (const char *, int, int (*)(int));
 
@@ -3141,7 +3136,7 @@ make_lisp_timeval (struct timeval t)
 
 #endif
 
-#if defined GNU_LINUX && defined HAVE_LONG_LONG_INT
+#ifdef GNU_LINUX
 static struct timespec
 time_from_jiffies (unsigned long long tval, long hz)
 {