Skip to content

Commit 12d004d

Browse files
committed
Assume C99-style ‘long long’
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’.
1 parent 87772ff commit 12d004d

File tree

3 files changed

+10
-32
lines changed

3 files changed

+10
-32
lines changed

admin/CPP-DEFINES

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ HAVE_LIBXML2
201201
HAVE_LIBXMU
202202
HAVE_LOCALTIME_R
203203
HAVE_LOCAL_SOCKETS
204-
HAVE_LONG_LONG_INT
205204
HAVE_LRAND48
206205
HAVE_LSTAT
207206
HAVE_LUTIMES
@@ -322,7 +321,6 @@ HAVE_TM_ZONE
322321
HAVE_TOUCHLOCK
323322
HAVE_TZNAME
324323
HAVE_TZSET
325-
HAVE_UNSIGNED_LONG_LONG_INT
326324
HAVE_UTIL_H
327325
HAVE_UTIMENSAT
328326
HAVE_UTIMES

src/data.c

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3310,27 +3310,14 @@ bool_vector_spare_mask (EMACS_INT nr_bits)
33103310
return (((bits_word) 1) << (nr_bits % BITS_PER_BITS_WORD)) - 1;
33113311
}
33123312

3313-
/* Info about unsigned long long, falling back on unsigned long
3314-
if unsigned long long is not available. */
3315-
3316-
#if HAVE_UNSIGNED_LONG_LONG_INT && defined ULLONG_WIDTH
3317-
enum { ULL_WIDTH = ULLONG_WIDTH };
3318-
# define ULL_MAX ULLONG_MAX
3319-
#else
3320-
enum { ULL_WIDTH = ULONG_WIDTH };
3321-
# define ULL_MAX ULONG_MAX
3322-
# define count_one_bits_ll count_one_bits_l
3323-
# define count_trailing_zeros_ll count_trailing_zeros_l
3324-
#endif
3325-
33263313
/* Shift VAL right by the width of an unsigned long long.
3327-
ULL_WIDTH must be less than BITS_PER_BITS_WORD. */
3314+
ULLONG_WIDTH must be less than BITS_PER_BITS_WORD. */
33283315

33293316
static bits_word
33303317
shift_right_ull (bits_word w)
33313318
{
33323319
/* Pacify bogus GCC warning about shift count exceeding type width. */
3333-
int shift = ULL_WIDTH - BITS_PER_BITS_WORD < 0 ? ULL_WIDTH : 0;
3320+
int shift = ULLONG_WIDTH - BITS_PER_BITS_WORD < 0 ? ULLONG_WIDTH : 0;
33343321
return w >> shift;
33353322
}
33363323

@@ -3347,7 +3334,7 @@ count_one_bits_word (bits_word w)
33473334
{
33483335
int i = 0, count = 0;
33493336
while (count += count_one_bits_ll (w),
3350-
(i += ULL_WIDTH) < BITS_PER_BITS_WORD)
3337+
(i += ULLONG_WIDTH) < BITS_PER_BITS_WORD)
33513338
w = shift_right_ull (w);
33523339
return count;
33533340
}
@@ -3478,7 +3465,7 @@ count_trailing_zero_bits (bits_word val)
34783465
return count_trailing_zeros (val);
34793466
if (BITS_WORD_MAX == ULONG_MAX)
34803467
return count_trailing_zeros_l (val);
3481-
if (BITS_WORD_MAX == ULL_MAX)
3468+
if (BITS_WORD_MAX == ULLONG_MAX)
34823469
return count_trailing_zeros_ll (val);
34833470

34843471
/* 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)
34923479
{
34933480
int count;
34943481
for (count = 0;
3495-
count < BITS_PER_BITS_WORD - ULL_WIDTH;
3496-
count += ULL_WIDTH)
3482+
count < BITS_PER_BITS_WORD - ULLONG_WIDTH;
3483+
count += ULLONG_WIDTH)
34973484
{
3498-
if (val & ULL_MAX)
3485+
if (val & ULLONG_MAX)
34993486
return count + count_trailing_zeros_ll (val);
35003487
val = shift_right_ull (val);
35013488
}
35023489

3503-
if (BITS_PER_BITS_WORD % ULL_WIDTH != 0
3490+
if (BITS_PER_BITS_WORD % ULLONG_WIDTH != 0
35043491
&& BITS_WORD_MAX == (bits_word) -1)
35053492
val |= (bits_word) 1 << pre_value (ULONG_MAX < BITS_WORD_MAX,
3506-
BITS_PER_BITS_WORD % ULL_WIDTH);
3493+
BITS_PER_BITS_WORD % ULLONG_WIDTH);
35073494
return count + count_trailing_zeros_ll (val);
35083495
}
35093496
}
@@ -3516,10 +3503,8 @@ bits_word_to_host_endian (bits_word val)
35163503
#else
35173504
if (BITS_WORD_MAX >> 31 == 1)
35183505
return bswap_32 (val);
3519-
# if HAVE_UNSIGNED_LONG_LONG
35203506
if (BITS_WORD_MAX >> 31 >> 31 >> 1 == 1)
35213507
return bswap_64 (val);
3522-
# endif
35233508
{
35243509
int i;
35253510
bits_word r = 0;

src/sysdep.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,6 @@ int _cdecl _spawnlp (int, const char *, const char *, ...);
135135
# include <sys/socket.h>
136136
#endif
137137

138-
/* ULLONG_MAX is missing on Red Hat Linux 7.3; see Bug#11781. */
139-
#ifndef ULLONG_MAX
140-
#define ULLONG_MAX TYPE_MAXIMUM (unsigned long long int)
141-
#endif
142-
143138
/* Declare here, including term.h is problematic on some systems. */
144139
extern void tputs (const char *, int, int (*)(int));
145140

@@ -3141,7 +3136,7 @@ make_lisp_timeval (struct timeval t)
31413136

31423137
#endif
31433138

3144-
#if defined GNU_LINUX && defined HAVE_LONG_LONG_INT
3139+
#ifdef GNU_LINUX
31453140
static struct timespec
31463141
time_from_jiffies (unsigned long long tval, long hz)
31473142
{

0 commit comments

Comments
 (0)