aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorPaul Eggert2014-01-02 22:47:27 -0800
committerPaul Eggert2014-01-02 22:47:27 -0800
commit56a0e35287e6931759c40c581cc715d9cbb78409 (patch)
treeff589caa626405dcef2c759c7964ca4165fdb73b /src/data.c
parented0ca4a51a373fc23037436ccc467a982b9fcae8 (diff)
downloademacs-56a0e35287e6931759c40c581cc715d9cbb78409.tar.gz
emacs-56a0e35287e6931759c40c581cc715d9cbb78409.zip
Port to C89.
* data.c (arithcompare_driver): * fileio.c (Fcar_less_than_car): * fns.c (internal_equal): * frame.c (delete_frame): * lisp.h (enum More_Lisp_Bits): * lread.c (read1): Avoid C99 constructs that don't work in C89. * data.c (ULL_MAX, count_trailing_zeros_ll): New macros, to port to C89, which doesn't have 'long long'. (count_trailing_zero_bits): Use them.
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/data.c b/src/data.c
index 10126775e79..1741f908396 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2320,7 +2320,8 @@ static Lisp_Object
2320arithcompare_driver (ptrdiff_t nargs, Lisp_Object *args, 2320arithcompare_driver (ptrdiff_t nargs, Lisp_Object *args,
2321 enum Arith_Comparison comparison) 2321 enum Arith_Comparison comparison)
2322{ 2322{
2323 for (ptrdiff_t argnum = 1; argnum < nargs; ++argnum) 2323 ptrdiff_t argnum;
2324 for (argnum = 1; argnum < nargs; ++argnum)
2324 { 2325 {
2325 if (EQ (Qnil, arithcompare (args[argnum-1], args[argnum], comparison))) 2326 if (EQ (Qnil, arithcompare (args[argnum-1], args[argnum], comparison)))
2326 return Qnil; 2327 return Qnil;
@@ -2979,10 +2980,12 @@ bool_vector_spare_mask (EMACS_INT nr_bits)
2979 2980
2980#if HAVE_UNSIGNED_LONG_LONG_INT 2981#if HAVE_UNSIGNED_LONG_LONG_INT
2981enum { BITS_PER_ULL = CHAR_BIT * sizeof (unsigned long long) }; 2982enum { BITS_PER_ULL = CHAR_BIT * sizeof (unsigned long long) };
2983# define ULL_MAX ULLONG_MAX
2982#else 2984#else
2983enum { BITS_PER_ULL = CHAR_BIT * sizeof (unsigned long) }; 2985enum { BITS_PER_ULL = CHAR_BIT * sizeof (unsigned long) };
2984# define ULLONG_MAX ULONG_MAX 2986# define ULL_MAX ULONG_MAX
2985# define count_one_bits_ll count_one_bits_l 2987# define count_one_bits_ll count_one_bits_l
2988# define count_trailing_zeros_ll count_trailing_zeros_l
2986#endif 2989#endif
2987 2990
2988/* Shift VAL right by the width of an unsigned long long. 2991/* Shift VAL right by the width of an unsigned long long.
@@ -3140,7 +3143,7 @@ count_trailing_zero_bits (bits_word val)
3140 return count_trailing_zeros (val); 3143 return count_trailing_zeros (val);
3141 if (BITS_WORD_MAX == ULONG_MAX) 3144 if (BITS_WORD_MAX == ULONG_MAX)
3142 return count_trailing_zeros_l (val); 3145 return count_trailing_zeros_l (val);
3143 if (BITS_WORD_MAX == ULLONG_MAX) 3146 if (BITS_WORD_MAX == ULL_MAX)
3144 return count_trailing_zeros_ll (val); 3147 return count_trailing_zeros_ll (val);
3145 3148
3146 /* The rest of this code is for the unlikely platform where bits_word differs 3149 /* The rest of this code is for the unlikely platform where bits_word differs
@@ -3157,7 +3160,7 @@ count_trailing_zero_bits (bits_word val)
3157 count < BITS_PER_BITS_WORD - BITS_PER_ULL; 3160 count < BITS_PER_BITS_WORD - BITS_PER_ULL;
3158 count += BITS_PER_ULL) 3161 count += BITS_PER_ULL)
3159 { 3162 {
3160 if (val & ULLONG_MAX) 3163 if (val & ULL_MAX)
3161 return count + count_trailing_zeros_ll (val); 3164 return count + count_trailing_zeros_ll (val);
3162 val = shift_right_ull (val); 3165 val = shift_right_ull (val);
3163 } 3166 }