comparison src/alloc.c @ 83113:1a68e4b22355

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-241 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-242 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-243 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-244 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-245 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-246 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-247 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-248 src/lisp.h (CYCLE_CHECK): Macro moved from xfaces.c * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-249 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-250 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-251 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-252 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-253 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-254 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-255 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-153
author Karoly Lorentey <lorentey@elte.hu>
date Tue, 27 Apr 2004 15:53:30 +0000
parents 895e130cc8da e4e9ec547c6f
children ad01ab3c6f4d
comparison
equal deleted inserted replaced
83112:30dd490f06f2 83113:1a68e4b22355
1948 int real_init, i; 1948 int real_init, i;
1949 int length_in_chars, length_in_elts, bits_per_value; 1949 int length_in_chars, length_in_elts, bits_per_value;
1950 1950
1951 CHECK_NATNUM (length); 1951 CHECK_NATNUM (length);
1952 1952
1953 bits_per_value = sizeof (EMACS_INT) * BITS_PER_CHAR; 1953 bits_per_value = sizeof (EMACS_INT) * BOOL_VECTOR_BITS_PER_CHAR;
1954 1954
1955 length_in_elts = (XFASTINT (length) + bits_per_value - 1) / bits_per_value; 1955 length_in_elts = (XFASTINT (length) + bits_per_value - 1) / bits_per_value;
1956 length_in_chars = ((XFASTINT (length) + BITS_PER_CHAR - 1) / BITS_PER_CHAR); 1956 length_in_chars = ((XFASTINT (length) + BOOL_VECTOR_BITS_PER_CHAR - 1)
1957 / BOOL_VECTOR_BITS_PER_CHAR);
1957 1958
1958 /* We must allocate one more elements than LENGTH_IN_ELTS for the 1959 /* We must allocate one more elements than LENGTH_IN_ELTS for the
1959 slot `size' of the struct Lisp_Bool_Vector. */ 1960 slot `size' of the struct Lisp_Bool_Vector. */
1960 val = Fmake_vector (make_number (length_in_elts + 1), Qnil); 1961 val = Fmake_vector (make_number (length_in_elts + 1), Qnil);
1961 p = XBOOL_VECTOR (val); 1962 p = XBOOL_VECTOR (val);
1968 real_init = (NILP (init) ? 0 : -1); 1969 real_init = (NILP (init) ? 0 : -1);
1969 for (i = 0; i < length_in_chars ; i++) 1970 for (i = 0; i < length_in_chars ; i++)
1970 p->data[i] = real_init; 1971 p->data[i] = real_init;
1971 1972
1972 /* Clear the extraneous bits in the last byte. */ 1973 /* Clear the extraneous bits in the last byte. */
1973 if (XINT (length) != length_in_chars * BITS_PER_CHAR) 1974 if (XINT (length) != length_in_chars * BOOL_VECTOR_BITS_PER_CHAR)
1974 XBOOL_VECTOR (val)->data[length_in_chars - 1] 1975 XBOOL_VECTOR (val)->data[length_in_chars - 1]
1975 &= (1 << (XINT (length) % BITS_PER_CHAR)) - 1; 1976 &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
1976 1977
1977 return val; 1978 return val;
1978 } 1979 }
1979 1980
1980 1981