comparison src/fns.c @ 53159:e929f6d1593b

(internal_equal) <case Lisp_Vectorlike>: Declare size as EMACS_INT to not lose bits. (Ffillarray): Don't set bits beyond the size of a bool vector.
author Andreas Schwab <schwab@suse.de>
date Tue, 25 Nov 2003 12:21:46 +0000
parents 7cf5bcb7a8ad
children 2c1d6f1a791e
comparison
equal deleted inserted replaced
53158:1025f21ef0c9 53159:e929f6d1593b
2190 } 2190 }
2191 break; 2191 break;
2192 2192
2193 case Lisp_Vectorlike: 2193 case Lisp_Vectorlike:
2194 { 2194 {
2195 register int i, size; 2195 register int i;
2196 size = XVECTOR (o1)->size; 2196 EMACS_INT size = XVECTOR (o1)->size;
2197 /* Pseudovectors have the type encoded in the size field, so this test 2197 /* Pseudovectors have the type encoded in the size field, so this test
2198 actually checks that the objects have the same type as well as the 2198 actually checks that the objects have the same type as well as the
2199 same size. */ 2199 same size. */
2200 if (XVECTOR (o2)->size != size) 2200 if (XVECTOR (o2)->size != size)
2201 return 0; 2201 return 0;
2313 register unsigned char *p = XBOOL_VECTOR (array)->data; 2313 register unsigned char *p = XBOOL_VECTOR (array)->data;
2314 int size_in_chars 2314 int size_in_chars
2315 = (XBOOL_VECTOR (array)->size + BITS_PER_CHAR - 1) / BITS_PER_CHAR; 2315 = (XBOOL_VECTOR (array)->size + BITS_PER_CHAR - 1) / BITS_PER_CHAR;
2316 2316
2317 charval = (! NILP (item) ? -1 : 0); 2317 charval = (! NILP (item) ? -1 : 0);
2318 for (index = 0; index < size_in_chars; index++) 2318 for (index = 0; index < size_in_chars - 1; index++)
2319 p[index] = charval; 2319 p[index] = charval;
2320 if (index < size_in_chars)
2321 {
2322 /* Mask out bits beyond the vector size. */
2323 if (XBOOL_VECTOR (array)->size % BITS_PER_CHAR)
2324 charval &= (1 << (XBOOL_VECTOR (array)->size % BITS_PER_CHAR)) - 1;
2325 p[index] = charval;
2326 }
2320 } 2327 }
2321 else 2328 else
2322 { 2329 {
2323 array = wrong_type_argument (Qarrayp, array); 2330 array = wrong_type_argument (Qarrayp, array);
2324 goto retry; 2331 goto retry;