#define ABLOCKS_BASE(abase) (abase)
#else
#define ABLOCKS_BASE(abase) \
- (1 & (intptr_t) ABLOCKS_BUSY (abase) ? abase : ((void**)abase)[-1])
+ (1 & (intptr_t) ABLOCKS_BUSY (abase) ? abase : ((void **)abase)[-1])
#endif
/* The list of free ablock. */
aligned = (base == abase);
if (!aligned)
- ((void**)abase)[-1] = base;
+ ((void **) abase)[-1] = base;
#ifdef DOUG_LEA_MALLOC
/* Back to a reasonable maximum of mmap'ed areas. */
verify (sizeof (size_t) * CHAR_BIT == BITS_PER_SIZE_T);
verify ((BITS_PER_SIZE_T & (BITS_PER_SIZE_T - 1)) == 0);
-static
-ptrdiff_t
+static ptrdiff_t
bool_vector_payload_bytes (ptrdiff_t nr_bits,
- ptrdiff_t* exact_needed_bytes_out)
+ ptrdiff_t *exact_needed_bytes_out)
{
ptrdiff_t exact_needed_bytes;
ptrdiff_t needed_bytes;
+ total_payload_bytes),
word_size) / word_size;
- p = (struct Lisp_Bool_Vector* ) allocate_vector (needed_elements);
+ p = (struct Lisp_Bool_Vector *) allocate_vector (needed_elements);
XSETVECTOR (val, p);
XSETPVECTYPESIZE (XVECTOR (val), PVEC_BOOL_VECTOR, 0, 0);
verify (VECTOR_BLOCK_SIZE <= (1 << PSEUDOVECTOR_SIZE_BITS));
/* Round up X to nearest mult-of-ROUNDUP_SIZE --- use at compile time. */
-#define vroundup_ct(x) ROUNDUP((size_t)(x), roundup_size)
+#define vroundup_ct(x) ROUNDUP ((size_t) (x), roundup_size)
/* Round up X to nearest mult-of-ROUNDUP_SIZE --- use at runtime. */
-#define vroundup(x) (assume((x) >= 0), vroundup_ct(x))
+#define vroundup(x) (assume ((x) >= 0), vroundup_ct (x))
/* Rounding helps to maintain alignment constraints if USE_LSB_TAG. */
struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
if (blv->fwd)
/* In set_internal, we un-forward vars when their value is
- set to Qunbound. */
+ set to Qunbound. */
return Qt;
else
{
}
case SYMBOL_FORWARDED:
/* In set_internal, we un-forward vars when their value is
- set to Qunbound. */
+ set to Qunbound. */
return Qt;
default: emacs_abort ();
}
}
/* This code is disabled now that we use the selected frame to return
- keyboard-local-values. */
+ keyboard-local-values. */
#if 0
extern struct terminal *get_terminal (Lisp_Object display, int);
always allocate bool vectors with at least one size_t of storage so
that we don't have to special-case empty bit vectors. */
-static inline
-size_t
+static size_t
bool_vector_spare_mask (ptrdiff_t nr_bits)
{
eassert_and_assume (nr_bits > 0);
return (((size_t) 1) << (nr_bits % BITS_PER_SIZE_T)) - 1;
}
-#if __MSC_VER >= 1500 && (defined _M_IX86 || defined _M_X64)
+#if _MSC_VER >= 1500 && (defined _M_IX86 || defined _M_X64)
# define USE_MSC_POPCOUNT
#elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
# define USE_GCC_POPCOUNT
#endif
#ifdef NEED_GENERIC_POPCOUNT
-static inline
-unsigned int
+static unsigned int
popcount_size_t_generic (size_t val)
{
unsigned short j;
#endif
#ifdef USE_MSC_POPCOUNT
-static inline
-unsigned int
+static unsigned int
popcount_size_t_msc (size_t val)
{
unsigned int count;
#endif /* USE_MSC_POPCOUNT */
#ifdef USE_GCC_POPCOUNT
-static inline
-unsigned int
+static unsigned int
popcount_size_t_gcc (size_t val)
{
# if BITS_PER_SIZE_T == 64
}
#endif /* USE_GCC_POPCOUNT */
-static inline
-unsigned int
-popcount_size_t(size_t val)
+static unsigned int
+popcount_size_t (size_t val)
{
#if defined USE_MSC_POPCOUNT
return popcount_size_t_msc (val);
return popcount_size_t_gcc (val);
#else
return popcount_size_t_generic (val);
- #endif
+#endif
}
enum bool_vector_op { bool_vector_exclusive_or,
bool_vector_set_difference,
bool_vector_subsetp };
-static inline
-Lisp_Object
+static Lisp_Object
bool_vector_binop_driver (Lisp_Object op1,
Lisp_Object op2,
Lisp_Object dest,
}
eassert_and_assume (nr_bits >= 0);
- nr_words = ROUNDUP(nr_bits, BITS_PER_SIZE_T) / BITS_PER_SIZE_T;
-
- adata = (size_t*) XBOOL_VECTOR (dest)->data;
- bdata = (size_t*) XBOOL_VECTOR (op1)->data;
- cdata = (size_t*) XBOOL_VECTOR (op2)->data;
+ nr_words = ROUNDUP (nr_bits, BITS_PER_SIZE_T) / BITS_PER_SIZE_T;
+
+ adata = (size_t *) XBOOL_VECTOR (dest)->data;
+ bdata = (size_t *) XBOOL_VECTOR (op1)->data;
+ cdata = (size_t *) XBOOL_VECTOR (op2)->data;
i = 0;
do
{
if (op != bool_vector_subsetp)
adata[i] = mword;
- i += 1;
+ i++;
}
while (i < nr_words);
+
return changed ? dest : Qnil;
}
/* Compute the number of trailing zero bits in val. If val is zero,
return the number of bits in val. */
-static inline
-unsigned int
+static unsigned int
count_trailing_zero_bits (size_t val)
{
if (val == 0)
return __builtin_ctzll (val);
#elif defined USE_GCC_POPCOUNT && BITS_PER_SIZE_T == 32
return __builtin_ctz (val);
-#elif __MSC_VER && BITS_PER_SIZE_T == 64
+#elif _MSC_VER && BITS_PER_SIZE_T == 64
# pragma intrinsic _BitScanForward64
{
/* No support test needed: support since 386. */
_BitScanForward64 (&result, val);
return (unsigned int) result;
}
-#elif __MSC_VER && BITS_PER_SIZE_T == 32
+#elif _MSC_VER && BITS_PER_SIZE_T == 32
# pragma intrinsic _BitScanForward
{
/* No support test needed: support since 386. */
{
unsigned int count;
count = 0;
- for(val = ~val; val & 1; val >>= 1)
+ for (val = ~val; val & 1; val >>= 1)
++count;
return count;
#endif
}
-static inline
-size_t
+static size_t
size_t_to_host_endian (size_t val)
{
#ifdef WORDS_BIGENDIAN
nr_bits = min (nr_bits, XBOOL_VECTOR (b)->size);
}
- bdata = (size_t*) XBOOL_VECTOR (b)->data;
- adata = (size_t*) XBOOL_VECTOR (a)->data;
- i = 0;
+ bdata = (size_t *) XBOOL_VECTOR (b)->data;
+ adata = (size_t *) XBOOL_VECTOR (a)->data;
eassert_and_assume (nr_bits >= 0);
- while (i < nr_bits / BITS_PER_SIZE_T)
- {
- bdata[i] = ~adata[i];
- i += 1;
- }
+ for (i = 0; i < nr_bits / BITS_PER_SIZE_T; i++)
+ bdata[i] = ~adata[i];
if (nr_bits % BITS_PER_SIZE_T)
{
DEFUN ("bool-vector-count-matches", Fbool_vector_count_matches,
Sbool_vector_count_matches, 2, 2, 0,
doc: /* Count how many elements in A equal B.
-A must be a bool vector. B is a generalized bool. */)
+A must be a bool vector. B is a generalized bool. */)
(Lisp_Object a, Lisp_Object b)
{
ptrdiff_t count;
nr_bits = XBOOL_VECTOR (a)->size;
count = 0;
match = NILP (b) ? (size_t) -1 : 0;
- adata = (size_t*) XBOOL_VECTOR (a)->data;
+ adata = (size_t *) XBOOL_VECTOR (a)->data;
eassert_and_assume (nr_bits >= 0);
- for(i = 0; i < nr_bits / BITS_PER_SIZE_T; ++i)
+ for (i = 0; i < nr_bits / BITS_PER_SIZE_T; ++i)
count += popcount_size_t (adata[i] ^ match);
/* Mask out trailing parts of final mword. */
Sbool_vector_count_matches_at, 3, 3, 0,
doc: /* Count how many consecutive elements in A equal B at i.
A must be a bool vector. B is a generalized boolean. i is an
-index into the vector.*/)
+index into the vector. */)
(Lisp_Object a, Lisp_Object b, Lisp_Object i)
{
ptrdiff_t count;
if (XFASTINT (i) > nr_bits) /* Allow one past the end for convenience */
args_out_of_range (a, i);
- adata = (size_t*) XBOOL_VECTOR (a)->data;
+ adata = (size_t *) XBOOL_VECTOR (a)->data;
assume (nr_bits >= 0);
nr_words = ROUNDUP (nr_bits, BITS_PER_SIZE_T) / BITS_PER_SIZE_T;
-
+
pos = XFASTINT (i) / BITS_PER_SIZE_T;
offset = XFASTINT (i) % BITS_PER_SIZE_T;
count = 0;
mword >>= offset;
count = count_trailing_zero_bits (mword);
count = min (count, BITS_PER_SIZE_T - offset);
- pos += 1;
+ pos++;
if (count + offset < BITS_PER_SIZE_T)
return make_number (count);
}