All uses of XBOOL_VECTOR (x)->size changed to bool_vector_size (x).
* data.c (bool_vector_spare_mask, bool_vector_binop_driver)
(Fbool_vector_not, Fbool_vector_count_matches_at):
Remove uses of 'eassume' that should no longer be needed,
because they are subsumed by the 'eassume' in bool_vector_size.
+2013-10-14 Paul Eggert <eggert@cs.ucla.edu>
+
+ * lisp.h (bool_vector_size): New function.
+ All uses of XBOOL_VECTOR (x)->size changed to bool_vector_size (x).
+ * data.c (bool_vector_spare_mask, bool_vector_binop_driver)
+ (Fbool_vector_not, Fbool_vector_count_matches_at):
+ Remove uses of 'eassume' that should no longer be needed,
+ because they are subsumed by the 'eassume' in bool_vector_size.
+
2013-10-12 Eli Zaretskii <eliz@gnu.org>
* image.c (GIFLIB_MAJOR, GIFLIB_MINOR, GIFLIB_RELEASE): Move back
#define XCATEGORY_SET XBOOL_VECTOR
#define CATEGORY_SET_P(x) \
- (BOOL_VECTOR_P (x) && XBOOL_VECTOR (x)->size == 128)
+ (BOOL_VECTOR_P (x) && bool_vector_size (x) == 128)
/* Return a new empty category set. */
#define MAKE_CATEGORY_SET (Fmake_bool_vector (make_number (128), Qnil))
{
int val;
- if (idxval < 0 || idxval >= XBOOL_VECTOR (array)->size)
+ if (idxval < 0 || idxval >= bool_vector_size (array))
args_out_of_range (array, idx);
val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BOOL_VECTOR_BITS_PER_CHAR];
{
int val;
- if (idxval < 0 || idxval >= XBOOL_VECTOR (array)->size)
+ if (idxval < 0 || idxval >= bool_vector_size (array))
args_out_of_range (array, idx);
val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BOOL_VECTOR_BITS_PER_CHAR];
static bits_word
bool_vector_spare_mask (ptrdiff_t nr_bits)
{
- eassume (nr_bits > 0);
return (((bits_word) 1) << (nr_bits % BITS_PER_BITS_WORD)) - 1;
}
CHECK_BOOL_VECTOR (op1);
CHECK_BOOL_VECTOR (op2);
- nr_bits = min (XBOOL_VECTOR (op1)->size,
- XBOOL_VECTOR (op2)->size);
+ nr_bits = min (bool_vector_size (op1), bool_vector_size (op2));
if (NILP (dest))
{
else
{
CHECK_BOOL_VECTOR (dest);
- nr_bits = min (nr_bits, XBOOL_VECTOR (dest)->size);
+ nr_bits = min (nr_bits, bool_vector_size (dest));
}
- eassume (nr_bits >= 0);
nr_words = ROUNDUP (nr_bits, BITS_PER_BITS_WORD) / BITS_PER_BITS_WORD;
adata = (bits_word *) XBOOL_VECTOR (dest)->data;
bits_word mword;
CHECK_BOOL_VECTOR (a);
- nr_bits = XBOOL_VECTOR (a)->size;
+ nr_bits = bool_vector_size (a);
if (NILP (b))
b = Fmake_bool_vector (make_number (nr_bits), Qnil);
else
{
CHECK_BOOL_VECTOR (b);
- nr_bits = min (nr_bits, XBOOL_VECTOR (b)->size);
+ nr_bits = min (nr_bits, bool_vector_size (b));
}
bdata = (bits_word *) XBOOL_VECTOR (b)->data;
adata = (bits_word *) XBOOL_VECTOR (a)->data;
- eassume (nr_bits >= 0);
-
for (i = 0; i < nr_bits / BITS_PER_BITS_WORD; i++)
bdata[i] = ~adata[i];
CHECK_BOOL_VECTOR (a);
- nr_bits = XBOOL_VECTOR (a)->size;
+ nr_bits = bool_vector_size (a);
count = 0;
match = NILP (b) ? -1 : 0;
adata = (bits_word *) XBOOL_VECTOR (a)->data;
- eassume (nr_bits >= 0);
-
for (i = 0; i < nr_bits / BITS_PER_BITS_WORD; ++i)
count += popcount_bits_word (adata[i] ^ match);
CHECK_BOOL_VECTOR (a);
CHECK_NATNUM (i);
- nr_bits = XBOOL_VECTOR (a)->size;
+ nr_bits = bool_vector_size (a);
if (XFASTINT (i) > nr_bits) /* Allow one past the end for convenience */
args_out_of_range (a, i);
adata = (bits_word *) XBOOL_VECTOR (a)->data;
- eassume (nr_bits >= 0);
nr_words = ROUNDUP (nr_bits, BITS_PER_BITS_WORD) / BITS_PER_BITS_WORD;
pos = XFASTINT (i) / BITS_PER_BITS_WORD;
else if (CHAR_TABLE_P (sequence))
XSETFASTINT (val, MAX_CHAR);
else if (BOOL_VECTOR_P (sequence))
- XSETFASTINT (val, XBOOL_VECTOR (sequence)->size);
+ XSETFASTINT (val, bool_vector_size (sequence));
else if (COMPILEDP (sequence))
XSETFASTINT (val, ASIZE (sequence) & PSEUDOVECTOR_SIZE_MASK);
else if (CONSP (sequence))
{
Lisp_Object val;
ptrdiff_t size_in_chars
- = ((XBOOL_VECTOR (arg)->size + BOOL_VECTOR_BITS_PER_CHAR - 1)
+ = ((bool_vector_size (arg) + BOOL_VECTOR_BITS_PER_CHAR - 1)
/ BOOL_VECTOR_BITS_PER_CHAR);
val = Fmake_bool_vector (Flength (arg), Qnil);
if (! ASCII_CHAR_P (c) && ! CHAR_BYTE8_P (c))
some_multibyte = 1;
}
- else if (BOOL_VECTOR_P (this) && XBOOL_VECTOR (this)->size > 0)
+ else if (BOOL_VECTOR_P (this) && bool_vector_size (this) > 0)
wrong_type_argument (Qintegerp, Faref (this, make_number (0)));
else if (CONSP (this))
for (; CONSP (this); this = XCDR (this))
/* Boolvectors are compared much like strings. */
if (BOOL_VECTOR_P (o1))
{
- if (XBOOL_VECTOR (o1)->size != XBOOL_VECTOR (o2)->size)
+ EMACS_INT size = bool_vector_size (o1);
+ if (size != bool_vector_size (o2))
return 0;
if (memcmp (XBOOL_VECTOR (o1)->data, XBOOL_VECTOR (o2)->data,
- ((XBOOL_VECTOR (o1)->size
- + BOOL_VECTOR_BITS_PER_CHAR - 1)
+ ((size + BOOL_VECTOR_BITS_PER_CHAR - 1)
/ BOOL_VECTOR_BITS_PER_CHAR)))
return 0;
return 1;
}
else if (BOOL_VECTOR_P (array))
{
- register unsigned char *p = XBOOL_VECTOR (array)->data;
- size =
- ((XBOOL_VECTOR (array)->size + BOOL_VECTOR_BITS_PER_CHAR - 1)
- / BOOL_VECTOR_BITS_PER_CHAR);
+ unsigned char *p = XBOOL_VECTOR (array)->data;
+ size = ((bool_vector_size (array) + BOOL_VECTOR_BITS_PER_CHAR - 1)
+ / BOOL_VECTOR_BITS_PER_CHAR);
if (size)
{
static EMACS_UINT
sxhash_bool_vector (Lisp_Object vec)
{
- EMACS_UINT hash = XBOOL_VECTOR (vec)->size;
+ EMACS_INT size = bool_vector_size (vec);
+ EMACS_UINT hash = size;
int i, n;
n = min (SXHASH_MAX_LEN,
- ((XBOOL_VECTOR (vec)->size + BOOL_VECTOR_BITS_PER_CHAR - 1)
+ ((size + BOOL_VECTOR_BITS_PER_CHAR - 1)
/ BOOL_VECTOR_BITS_PER_CHAR));
for (i = 0; i < n; ++i)
hash = sxhash_combine (hash, XBOOL_VECTOR (vec)->data[i]);
}
else if (BOOL_VECTOR_P (elt))
{
- if (XBOOL_VECTOR (elt)->size < width)
+ if (bool_vector_size (elt) < width)
return 0;
}
else
}
else if (BOOL_VECTOR_P (data))
{
- if (XBOOL_VECTOR (data)->size / height < width)
+ if (bool_vector_size (data) / height < width)
return 0;
}
else
unsigned char data[FLEXIBLE_ARRAY_MEMBER];
};
+INLINE EMACS_INT
+bool_vector_size (Lisp_Object a)
+{
+ EMACS_INT size = XBOOL_VECTOR (a)->size;
+ eassume (0 <= size);
+ return size;
+}
+
/* Some handy constants for calculating sizes
and offsets, mostly of vectorlike objects. */
int len;
unsigned char c;
struct gcpro gcpro1;
- ptrdiff_t size_in_chars
- = ((XBOOL_VECTOR (obj)->size + BOOL_VECTOR_BITS_PER_CHAR - 1)
- / BOOL_VECTOR_BITS_PER_CHAR);
-
+ EMACS_INT size = bool_vector_size (obj);
+ ptrdiff_t size_in_chars = ((size + BOOL_VECTOR_BITS_PER_CHAR - 1)
+ / BOOL_VECTOR_BITS_PER_CHAR);
GCPRO1 (obj);
PRINTCHAR ('#');
PRINTCHAR ('&');
- len = sprintf (buf, "%"pI"d", XBOOL_VECTOR (obj)->size);
+ len = sprintf (buf, "%"pI"d", size);
strout (buf, len, len, printcharfun);
PRINTCHAR ('\"');