aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2013-09-23 21:28:06 -0700
committerPaul Eggert2013-09-23 21:28:06 -0700
commit7be68de5d25998e7d15aaab800c40cad48eac846 (patch)
tree881c8cdf8c60ee5c11bb3f00c7e27c09e162142b /src
parentd160dd0c71db061d819ce5ac337e4de8bd4f7d11 (diff)
downloademacs-7be68de5d25998e7d15aaab800c40cad48eac846.tar.gz
emacs-7be68de5d25998e7d15aaab800c40cad48eac846.zip
Some minor cleanups of recently-added bool vector code.
* conf_post.h (assume): Always return void. Use lint version only if GCC and MSC versions don't apply. * conf_post.h (assume): * data.c (USC_MSC_POPCOUNT, count_trailing_zero_bits): Depend on _MSC_VER, not __MSC_VER, for consistency with the rest of Emacs. * data.c (bool_vector_spare_mask, popcount_size_t_generic) (popcount_size_t_msc, popcount_size_t_gcc, popcount_size_t) (bool_vector_binop_driver, count_trailing_zero_bits) (size_t_to_host_endian): Now static, not static inline; the latter isn't needed with modern compilers and doesn't work with older compilers anyway.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog14
-rw-r--r--src/alloc.c15
-rw-r--r--src/conf_post.h19
-rw-r--r--src/data.c81
-rw-r--r--src/lisp.h9
-rw-r--r--src/xdisp.c3
6 files changed, 69 insertions, 72 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5676d3e8b9a..303eb4f9176 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,19 @@
12013-09-24 Paul Eggert <eggert@cs.ucla.edu> 12013-09-24 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Some minor cleanups of recently-added bool vector code.
4 * conf_post.h (assume): Always return void. Use lint version
5 only if GCC and MSC versions don't apply.
6 * conf_post.h (assume):
7 * data.c (USC_MSC_POPCOUNT, count_trailing_zero_bits):
8 Depend on _MSC_VER, not __MSC_VER, for consistency with
9 the rest of Emacs.
10 * data.c (bool_vector_spare_mask, popcount_size_t_generic)
11 (popcount_size_t_msc, popcount_size_t_gcc, popcount_size_t)
12 (bool_vector_binop_driver, count_trailing_zero_bits)
13 (size_t_to_host_endian): Now static, not static inline;
14 the latter isn't needed with modern compilers and doesn't
15 work with older compilers anyway.
16
3 * alloc.c (valgrind_p): Use bool for boolean. 17 * alloc.c (valgrind_p): Use bool for boolean.
4 18
52013-09-23 Dmitry Antipov <dmantipov@yandex.ru> 192013-09-23 Dmitry Antipov <dmantipov@yandex.ru>
diff --git a/src/alloc.c b/src/alloc.c
index 02742c4cf4a..e380d66cb1b 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -981,7 +981,7 @@ struct ablocks
981#define ABLOCKS_BASE(abase) (abase) 981#define ABLOCKS_BASE(abase) (abase)
982#else 982#else
983#define ABLOCKS_BASE(abase) \ 983#define ABLOCKS_BASE(abase) \
984 (1 & (intptr_t) ABLOCKS_BUSY (abase) ? abase : ((void**)abase)[-1]) 984 (1 & (intptr_t) ABLOCKS_BUSY (abase) ? abase : ((void **)abase)[-1])
985#endif 985#endif
986 986
987/* The list of free ablock. */ 987/* The list of free ablock. */
@@ -1036,7 +1036,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
1036 1036
1037 aligned = (base == abase); 1037 aligned = (base == abase);
1038 if (!aligned) 1038 if (!aligned)
1039 ((void**)abase)[-1] = base; 1039 ((void **) abase)[-1] = base;
1040 1040
1041#ifdef DOUG_LEA_MALLOC 1041#ifdef DOUG_LEA_MALLOC
1042 /* Back to a reasonable maximum of mmap'ed areas. */ 1042 /* Back to a reasonable maximum of mmap'ed areas. */
@@ -2016,10 +2016,9 @@ INIT must be an integer that represents a character. */)
2016verify (sizeof (size_t) * CHAR_BIT == BITS_PER_SIZE_T); 2016verify (sizeof (size_t) * CHAR_BIT == BITS_PER_SIZE_T);
2017verify ((BITS_PER_SIZE_T & (BITS_PER_SIZE_T - 1)) == 0); 2017verify ((BITS_PER_SIZE_T & (BITS_PER_SIZE_T - 1)) == 0);
2018 2018
2019static 2019static ptrdiff_t
2020ptrdiff_t
2021bool_vector_payload_bytes (ptrdiff_t nr_bits, 2020bool_vector_payload_bytes (ptrdiff_t nr_bits,
2022 ptrdiff_t* exact_needed_bytes_out) 2021 ptrdiff_t *exact_needed_bytes_out)
2023{ 2022{
2024 ptrdiff_t exact_needed_bytes; 2023 ptrdiff_t exact_needed_bytes;
2025 ptrdiff_t needed_bytes; 2024 ptrdiff_t needed_bytes;
@@ -2068,7 +2067,7 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */)
2068 + total_payload_bytes), 2067 + total_payload_bytes),
2069 word_size) / word_size; 2068 word_size) / word_size;
2070 2069
2071 p = (struct Lisp_Bool_Vector* ) allocate_vector (needed_elements); 2070 p = (struct Lisp_Bool_Vector *) allocate_vector (needed_elements);
2072 XSETVECTOR (val, p); 2071 XSETVECTOR (val, p);
2073 XSETPVECTYPESIZE (XVECTOR (val), PVEC_BOOL_VECTOR, 0, 0); 2072 XSETPVECTYPESIZE (XVECTOR (val), PVEC_BOOL_VECTOR, 0, 0);
2074 2073
@@ -2617,9 +2616,9 @@ verify ((VECTOR_BLOCK_SIZE % roundup_size) == 0);
2617verify (VECTOR_BLOCK_SIZE <= (1 << PSEUDOVECTOR_SIZE_BITS)); 2616verify (VECTOR_BLOCK_SIZE <= (1 << PSEUDOVECTOR_SIZE_BITS));
2618 2617
2619/* Round up X to nearest mult-of-ROUNDUP_SIZE --- use at compile time. */ 2618/* Round up X to nearest mult-of-ROUNDUP_SIZE --- use at compile time. */
2620#define vroundup_ct(x) ROUNDUP((size_t)(x), roundup_size) 2619#define vroundup_ct(x) ROUNDUP ((size_t) (x), roundup_size)
2621/* Round up X to nearest mult-of-ROUNDUP_SIZE --- use at runtime. */ 2620/* Round up X to nearest mult-of-ROUNDUP_SIZE --- use at runtime. */
2622#define vroundup(x) (assume((x) >= 0), vroundup_ct(x)) 2621#define vroundup(x) (assume ((x) >= 0), vroundup_ct (x))
2623 2622
2624/* Rounding helps to maintain alignment constraints if USE_LSB_TAG. */ 2623/* Rounding helps to maintain alignment constraints if USE_LSB_TAG. */
2625 2624
diff --git a/src/conf_post.h b/src/conf_post.h
index 3c348d0705b..0786bdfeb33 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -252,18 +252,17 @@ extern void _DebPrint (const char *fmt, ...);
252# define __has_builtin(x) 0 252# define __has_builtin(x) 0
253#endif 253#endif
254 254
255/* assume(cond) tells the compiler (and lint) that a certain condition 255/* Tell the compiler (and lint) that COND will always hold, and that
256 * will always hold, and that it should optimize (or check) accordingly. */ 256 it should optimize (or check) accordingly. */
257#if defined lint 257#if (__has_builtin (__builtin_unreachable) \
258 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || __GNUC__ > 4)
259# define assume(cond) ((cond) ? (void) 0 : __builtin_unreachable ())
260#elif defined _MSC_VER
261# define assume(cond) __assume (cond)
262#elif defined lint
258# define assume(cond) ((cond) ? (void) 0 : abort ()) 263# define assume(cond) ((cond) ? (void) 0 : abort ())
259#elif (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || __GNUC__ > 4
260# define assume(cond) ((cond) || (__builtin_unreachable(), 0))
261#elif defined (__clang__) && __has_builtin (__builtin_unreachable)
262# define assume(cond) ((cond) || (__builtin_unreachable(), 0))
263#elif defined __MSC_VER
264# define assume(cond) __assume ((cond))
265#else 264#else
266# define assume(cond) (0 && (cond)) 265# define assume(cond) ((void) (0 && (cond)))
267#endif 266#endif
268 267
269/* Use this to suppress gcc's `...may be used before initialized' warnings. */ 268/* Use this to suppress gcc's `...may be used before initialized' warnings. */
diff --git a/src/data.c b/src/data.c
index 5a05e0652ad..82cfd74cd0f 100644
--- a/src/data.c
+++ b/src/data.c
@@ -617,7 +617,7 @@ global value outside of any lexical scope. */)
617 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); 617 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
618 if (blv->fwd) 618 if (blv->fwd)
619 /* In set_internal, we un-forward vars when their value is 619 /* In set_internal, we un-forward vars when their value is
620 set to Qunbound. */ 620 set to Qunbound. */
621 return Qt; 621 return Qt;
622 else 622 else
623 { 623 {
@@ -628,7 +628,7 @@ global value outside of any lexical scope. */)
628 } 628 }
629 case SYMBOL_FORWARDED: 629 case SYMBOL_FORWARDED:
630 /* In set_internal, we un-forward vars when their value is 630 /* In set_internal, we un-forward vars when their value is
631 set to Qunbound. */ 631 set to Qunbound. */
632 return Qt; 632 return Qt;
633 default: emacs_abort (); 633 default: emacs_abort ();
634 } 634 }
@@ -1996,7 +1996,7 @@ If the current binding is global (the default), the value is nil. */)
1996} 1996}
1997 1997
1998/* This code is disabled now that we use the selected frame to return 1998/* This code is disabled now that we use the selected frame to return
1999 keyboard-local-values. */ 1999 keyboard-local-values. */
2000#if 0 2000#if 0
2001extern struct terminal *get_terminal (Lisp_Object display, int); 2001extern struct terminal *get_terminal (Lisp_Object display, int);
2002 2002
@@ -2963,15 +2963,14 @@ lowercase l) for small endian machines. */)
2963 always allocate bool vectors with at least one size_t of storage so 2963 always allocate bool vectors with at least one size_t of storage so
2964 that we don't have to special-case empty bit vectors. */ 2964 that we don't have to special-case empty bit vectors. */
2965 2965
2966static inline 2966static size_t
2967size_t
2968bool_vector_spare_mask (ptrdiff_t nr_bits) 2967bool_vector_spare_mask (ptrdiff_t nr_bits)
2969{ 2968{
2970 eassert_and_assume (nr_bits > 0); 2969 eassert_and_assume (nr_bits > 0);
2971 return (((size_t) 1) << (nr_bits % BITS_PER_SIZE_T)) - 1; 2970 return (((size_t) 1) << (nr_bits % BITS_PER_SIZE_T)) - 1;
2972} 2971}
2973 2972
2974#if __MSC_VER >= 1500 && (defined _M_IX86 || defined _M_X64) 2973#if _MSC_VER >= 1500 && (defined _M_IX86 || defined _M_X64)
2975# define USE_MSC_POPCOUNT 2974# define USE_MSC_POPCOUNT
2976#elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) 2975#elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
2977# define USE_GCC_POPCOUNT 2976# define USE_GCC_POPCOUNT
@@ -2984,8 +2983,7 @@ bool_vector_spare_mask (ptrdiff_t nr_bits)
2984#endif 2983#endif
2985 2984
2986#ifdef NEED_GENERIC_POPCOUNT 2985#ifdef NEED_GENERIC_POPCOUNT
2987static inline 2986static unsigned int
2988unsigned int
2989popcount_size_t_generic (size_t val) 2987popcount_size_t_generic (size_t val)
2990{ 2988{
2991 unsigned short j; 2989 unsigned short j;
@@ -2999,8 +2997,7 @@ popcount_size_t_generic (size_t val)
2999#endif 2997#endif
3000 2998
3001#ifdef USE_MSC_POPCOUNT 2999#ifdef USE_MSC_POPCOUNT
3002static inline 3000static unsigned int
3003unsigned int
3004popcount_size_t_msc (size_t val) 3001popcount_size_t_msc (size_t val)
3005{ 3002{
3006 unsigned int count; 3003 unsigned int count;
@@ -3045,8 +3042,7 @@ popcount_size_t_msc (size_t val)
3045#endif /* USE_MSC_POPCOUNT */ 3042#endif /* USE_MSC_POPCOUNT */
3046 3043
3047#ifdef USE_GCC_POPCOUNT 3044#ifdef USE_GCC_POPCOUNT
3048static inline 3045static unsigned int
3049unsigned int
3050popcount_size_t_gcc (size_t val) 3046popcount_size_t_gcc (size_t val)
3051{ 3047{
3052# if BITS_PER_SIZE_T == 64 3048# if BITS_PER_SIZE_T == 64
@@ -3057,9 +3053,8 @@ popcount_size_t_gcc (size_t val)
3057} 3053}
3058#endif /* USE_GCC_POPCOUNT */ 3054#endif /* USE_GCC_POPCOUNT */
3059 3055
3060static inline 3056static unsigned int
3061unsigned int 3057popcount_size_t (size_t val)
3062popcount_size_t(size_t val)
3063{ 3058{
3064#if defined USE_MSC_POPCOUNT 3059#if defined USE_MSC_POPCOUNT
3065 return popcount_size_t_msc (val); 3060 return popcount_size_t_msc (val);
@@ -3067,7 +3062,7 @@ popcount_size_t(size_t val)
3067 return popcount_size_t_gcc (val); 3062 return popcount_size_t_gcc (val);
3068#else 3063#else
3069 return popcount_size_t_generic (val); 3064 return popcount_size_t_generic (val);
3070 #endif 3065#endif
3071} 3066}
3072 3067
3073enum bool_vector_op { bool_vector_exclusive_or, 3068enum bool_vector_op { bool_vector_exclusive_or,
@@ -3076,8 +3071,7 @@ enum bool_vector_op { bool_vector_exclusive_or,
3076 bool_vector_set_difference, 3071 bool_vector_set_difference,
3077 bool_vector_subsetp }; 3072 bool_vector_subsetp };
3078 3073
3079static inline 3074static Lisp_Object
3080Lisp_Object
3081bool_vector_binop_driver (Lisp_Object op1, 3075bool_vector_binop_driver (Lisp_Object op1,
3082 Lisp_Object op2, 3076 Lisp_Object op2,
3083 Lisp_Object dest, 3077 Lisp_Object dest,
@@ -3108,11 +3102,11 @@ bool_vector_binop_driver (Lisp_Object op1,
3108 } 3102 }
3109 3103
3110 eassert_and_assume (nr_bits >= 0); 3104 eassert_and_assume (nr_bits >= 0);
3111 nr_words = ROUNDUP(nr_bits, BITS_PER_SIZE_T) / BITS_PER_SIZE_T; 3105 nr_words = ROUNDUP (nr_bits, BITS_PER_SIZE_T) / BITS_PER_SIZE_T;
3112 3106
3113 adata = (size_t*) XBOOL_VECTOR (dest)->data; 3107 adata = (size_t *) XBOOL_VECTOR (dest)->data;
3114 bdata = (size_t*) XBOOL_VECTOR (op1)->data; 3108 bdata = (size_t *) XBOOL_VECTOR (op1)->data;
3115 cdata = (size_t*) XBOOL_VECTOR (op2)->data; 3109 cdata = (size_t *) XBOOL_VECTOR (op2)->data;
3116 i = 0; 3110 i = 0;
3117 do 3111 do
3118 { 3112 {
@@ -3132,16 +3126,16 @@ bool_vector_binop_driver (Lisp_Object op1,
3132 if (op != bool_vector_subsetp) 3126 if (op != bool_vector_subsetp)
3133 adata[i] = mword; 3127 adata[i] = mword;
3134 3128
3135 i += 1; 3129 i++;
3136 } 3130 }
3137 while (i < nr_words); 3131 while (i < nr_words);
3132
3138 return changed ? dest : Qnil; 3133 return changed ? dest : Qnil;
3139} 3134}
3140 3135
3141/* Compute the number of trailing zero bits in val. If val is zero, 3136/* Compute the number of trailing zero bits in val. If val is zero,
3142 return the number of bits in val. */ 3137 return the number of bits in val. */
3143static inline 3138static unsigned int
3144unsigned int
3145count_trailing_zero_bits (size_t val) 3139count_trailing_zero_bits (size_t val)
3146{ 3140{
3147 if (val == 0) 3141 if (val == 0)
@@ -3151,7 +3145,7 @@ count_trailing_zero_bits (size_t val)
3151 return __builtin_ctzll (val); 3145 return __builtin_ctzll (val);
3152#elif defined USE_GCC_POPCOUNT && BITS_PER_SIZE_T == 32 3146#elif defined USE_GCC_POPCOUNT && BITS_PER_SIZE_T == 32
3153 return __builtin_ctz (val); 3147 return __builtin_ctz (val);
3154#elif __MSC_VER && BITS_PER_SIZE_T == 64 3148#elif _MSC_VER && BITS_PER_SIZE_T == 64
3155# pragma intrinsic _BitScanForward64 3149# pragma intrinsic _BitScanForward64
3156 { 3150 {
3157 /* No support test needed: support since 386. */ 3151 /* No support test needed: support since 386. */
@@ -3159,7 +3153,7 @@ count_trailing_zero_bits (size_t val)
3159 _BitScanForward64 (&result, val); 3153 _BitScanForward64 (&result, val);
3160 return (unsigned int) result; 3154 return (unsigned int) result;
3161 } 3155 }
3162#elif __MSC_VER && BITS_PER_SIZE_T == 32 3156#elif _MSC_VER && BITS_PER_SIZE_T == 32
3163# pragma intrinsic _BitScanForward 3157# pragma intrinsic _BitScanForward
3164 { 3158 {
3165 /* No support test needed: support since 386. */ 3159 /* No support test needed: support since 386. */
@@ -3171,7 +3165,7 @@ count_trailing_zero_bits (size_t val)
3171 { 3165 {
3172 unsigned int count; 3166 unsigned int count;
3173 count = 0; 3167 count = 0;
3174 for(val = ~val; val & 1; val >>= 1) 3168 for (val = ~val; val & 1; val >>= 1)
3175 ++count; 3169 ++count;
3176 3170
3177 return count; 3171 return count;
@@ -3179,8 +3173,7 @@ count_trailing_zero_bits (size_t val)
3179#endif 3173#endif
3180} 3174}
3181 3175
3182static inline 3176static size_t
3183size_t
3184size_t_to_host_endian (size_t val) 3177size_t_to_host_endian (size_t val)
3185{ 3178{
3186#ifdef WORDS_BIGENDIAN 3179#ifdef WORDS_BIGENDIAN
@@ -3272,17 +3265,13 @@ Return the destination vector. */)
3272 nr_bits = min (nr_bits, XBOOL_VECTOR (b)->size); 3265 nr_bits = min (nr_bits, XBOOL_VECTOR (b)->size);
3273 } 3266 }
3274 3267
3275 bdata = (size_t*) XBOOL_VECTOR (b)->data; 3268 bdata = (size_t *) XBOOL_VECTOR (b)->data;
3276 adata = (size_t*) XBOOL_VECTOR (a)->data; 3269 adata = (size_t *) XBOOL_VECTOR (a)->data;
3277 i = 0;
3278 3270
3279 eassert_and_assume (nr_bits >= 0); 3271 eassert_and_assume (nr_bits >= 0);
3280 3272
3281 while (i < nr_bits / BITS_PER_SIZE_T) 3273 for (i = 0; i < nr_bits / BITS_PER_SIZE_T; i++)
3282 { 3274 bdata[i] = ~adata[i];
3283 bdata[i] = ~adata[i];
3284 i += 1;
3285 }
3286 3275
3287 if (nr_bits % BITS_PER_SIZE_T) 3276 if (nr_bits % BITS_PER_SIZE_T)
3288 { 3277 {
@@ -3298,7 +3287,7 @@ Return the destination vector. */)
3298DEFUN ("bool-vector-count-matches", Fbool_vector_count_matches, 3287DEFUN ("bool-vector-count-matches", Fbool_vector_count_matches,
3299 Sbool_vector_count_matches, 2, 2, 0, 3288 Sbool_vector_count_matches, 2, 2, 0,
3300 doc: /* Count how many elements in A equal B. 3289 doc: /* Count how many elements in A equal B.
3301A must be a bool vector. B is a generalized bool. */) 3290A must be a bool vector. B is a generalized bool. */)
3302 (Lisp_Object a, Lisp_Object b) 3291 (Lisp_Object a, Lisp_Object b)
3303{ 3292{
3304 ptrdiff_t count; 3293 ptrdiff_t count;
@@ -3312,11 +3301,11 @@ A must be a bool vector. B is a generalized bool. */)
3312 nr_bits = XBOOL_VECTOR (a)->size; 3301 nr_bits = XBOOL_VECTOR (a)->size;
3313 count = 0; 3302 count = 0;
3314 match = NILP (b) ? (size_t) -1 : 0; 3303 match = NILP (b) ? (size_t) -1 : 0;
3315 adata = (size_t*) XBOOL_VECTOR (a)->data; 3304 adata = (size_t *) XBOOL_VECTOR (a)->data;
3316 3305
3317 eassert_and_assume (nr_bits >= 0); 3306 eassert_and_assume (nr_bits >= 0);
3318 3307
3319 for(i = 0; i < nr_bits / BITS_PER_SIZE_T; ++i) 3308 for (i = 0; i < nr_bits / BITS_PER_SIZE_T; ++i)
3320 count += popcount_size_t (adata[i] ^ match); 3309 count += popcount_size_t (adata[i] ^ match);
3321 3310
3322 /* Mask out trailing parts of final mword. */ 3311 /* Mask out trailing parts of final mword. */
@@ -3335,7 +3324,7 @@ DEFUN ("bool-vector-count-matches-at",
3335 Sbool_vector_count_matches_at, 3, 3, 0, 3324 Sbool_vector_count_matches_at, 3, 3, 0,
3336 doc: /* Count how many consecutive elements in A equal B at i. 3325 doc: /* Count how many consecutive elements in A equal B at i.
3337A must be a bool vector. B is a generalized boolean. i is an 3326A must be a bool vector. B is a generalized boolean. i is an
3338index into the vector.*/) 3327index into the vector. */)
3339 (Lisp_Object a, Lisp_Object b, Lisp_Object i) 3328 (Lisp_Object a, Lisp_Object b, Lisp_Object i)
3340{ 3329{
3341 ptrdiff_t count; 3330 ptrdiff_t count;
@@ -3354,11 +3343,11 @@ index into the vector.*/)
3354 if (XFASTINT (i) > nr_bits) /* Allow one past the end for convenience */ 3343 if (XFASTINT (i) > nr_bits) /* Allow one past the end for convenience */
3355 args_out_of_range (a, i); 3344 args_out_of_range (a, i);
3356 3345
3357 adata = (size_t*) XBOOL_VECTOR (a)->data; 3346 adata = (size_t *) XBOOL_VECTOR (a)->data;
3358 3347
3359 assume (nr_bits >= 0); 3348 assume (nr_bits >= 0);
3360 nr_words = ROUNDUP (nr_bits, BITS_PER_SIZE_T) / BITS_PER_SIZE_T; 3349 nr_words = ROUNDUP (nr_bits, BITS_PER_SIZE_T) / BITS_PER_SIZE_T;
3361 3350
3362 pos = XFASTINT (i) / BITS_PER_SIZE_T; 3351 pos = XFASTINT (i) / BITS_PER_SIZE_T;
3363 offset = XFASTINT (i) % BITS_PER_SIZE_T; 3352 offset = XFASTINT (i) % BITS_PER_SIZE_T;
3364 count = 0; 3353 count = 0;
@@ -3376,7 +3365,7 @@ index into the vector.*/)
3376 mword >>= offset; 3365 mword >>= offset;
3377 count = count_trailing_zero_bits (mword); 3366 count = count_trailing_zero_bits (mword);
3378 count = min (count, BITS_PER_SIZE_T - offset); 3367 count = min (count, BITS_PER_SIZE_T - offset);
3379 pos += 1; 3368 pos++;
3380 if (count + offset < BITS_PER_SIZE_T) 3369 if (count + offset < BITS_PER_SIZE_T)
3381 return make_number (count); 3370 return make_number (count);
3382 } 3371 }
diff --git a/src/lisp.h b/src/lisp.h
index a9a2c259b5b..f49a2042b1b 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4359,15 +4359,13 @@ functionp (Lisp_Object object)
4359 return 0; 4359 return 0;
4360} 4360}
4361 4361
4362INLINE 4362INLINE uint16_t
4363uint16_t
4364swap16 (uint16_t val) 4363swap16 (uint16_t val)
4365{ 4364{
4366 return (val << 8) | (val & 0xFF); 4365 return (val << 8) | (val & 0xFF);
4367} 4366}
4368 4367
4369INLINE 4368INLINE uint32_t
4370uint32_t
4371swap32 (uint32_t val) 4369swap32 (uint32_t val)
4372{ 4370{
4373 uint32_t low = swap16 (val & 0xFFFF); 4371 uint32_t low = swap16 (val & 0xFFFF);
@@ -4376,8 +4374,7 @@ swap32 (uint32_t val)
4376} 4374}
4377 4375
4378#ifdef UINT64_MAX 4376#ifdef UINT64_MAX
4379INLINE 4377INLINE uint64_t
4380uint64_t
4381swap64 (uint64_t val) 4378swap64 (uint64_t val)
4382{ 4379{
4383 uint64_t low = swap32 (val & 0xFFFFFFFF); 4380 uint64_t low = swap32 (val & 0xFFFFFFFF);
diff --git a/src/xdisp.c b/src/xdisp.c
index e1143bec1c0..6d19531aab6 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1882,8 +1882,7 @@ pixel_to_glyph_coords (struct frame *f, register int pix_x, register int pix_y,
1882 text, or we can't tell because W's current matrix is not up to 1882 text, or we can't tell because W's current matrix is not up to
1883 date. */ 1883 date. */
1884 1884
1885static 1885static struct glyph *
1886struct glyph *
1887x_y_to_hpos_vpos (struct window *w, int x, int y, int *hpos, int *vpos, 1886x_y_to_hpos_vpos (struct window *w, int x, int y, int *hpos, int *vpos,
1888 int *dx, int *dy, int *area) 1887 int *dx, int *dy, int *area)
1889{ 1888{