From 68be917ded75e3147180af2a0a51fc8c89d042d8 Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Tue, 31 Oct 1995 02:34:16 +0000 Subject: [PATCH] (BITS_PER_SHORT, BITS_PER_INT, BITS_PER_LONG): Rename from SHORTBITS, INTBITS, LONGBITS. --- src/alloc.c | 4 ++-- src/data.c | 21 ++++++--------------- src/doprnt.c | 2 +- src/floatfns.c | 7 ------- src/fns.c | 16 ++++++---------- src/indent.c | 6 +++--- src/insdel.c | 2 +- src/lisp.h | 8 ++++---- src/lread.c | 9 ++------- src/print.c | 3 +-- src/xdisp.c | 12 ++++++------ src/xfaces.c | 2 +- src/xterm.c | 4 ++-- 13 files changed, 35 insertions(+), 61 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index 002dc51ddb9..978174360b2 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1091,7 +1091,7 @@ Both LENGTH and INIT must be numbers. INIT matters only in whether it is t or n CHECK_NATNUM (length, 0); - bits_per_value = sizeof (EMACS_INT) * INTBITS / sizeof (int); + bits_per_value = sizeof (EMACS_INT) * BITS_PER_CHAR; length_in_elts = (XFASTINT (length) + bits_per_value - 1) / bits_per_value; length_in_chars = length_in_elts * sizeof (EMACS_INT); @@ -1428,7 +1428,7 @@ inhibit_garbage_collection () { int count = specpdl_ptr - specpdl; Lisp_Object number; - int nbits = min (VALBITS, INTBITS); + int nbits = min (VALBITS, BITS_PER_INT); XSETINT (number, ((EMACS_INT) 1 << (nbits - 1)) - 1); diff --git a/src/data.c b/src/data.c index 53e40c11cef..3394cdb147c 100644 --- a/src/data.c +++ b/src/data.c @@ -31,13 +31,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "syssignal.h" -#ifdef MSDOS -/* These are redefined (correctly, but differently) in values.h. */ -#undef INTBITS -#undef LONGBITS -#undef SHORTBITS -#endif - #ifdef LISP_FLOAT_TYPE #ifdef STDC_HEADERS @@ -1532,13 +1525,12 @@ or a byte-code object. INDEX starts at 0.") else if (BOOL_VECTOR_P (array)) { int val; - int bits_per_char = INTBITS / sizeof (int); if (idxval < 0 || idxval >= XBOOL_VECTOR (array)->size) args_out_of_range (array, idx); - val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / bits_per_char]; - return (val & (1 << (idxval % bits_per_char)) ? Qt : Qnil); + val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BITS_PER_CHAR]; + return (val & (1 << (idxval % BITS_PER_CHAR)) ? Qt : Qnil); } else if (CHAR_TABLE_P (array)) { @@ -1639,18 +1631,17 @@ ARRAY may be a vector or a string. IDX starts at 0.") else if (BOOL_VECTOR_P (array)) { int val; - int bits_per_char = INTBITS / sizeof (int); if (idxval < 0 || idxval >= XBOOL_VECTOR (array)->size) args_out_of_range (array, idx); - val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / bits_per_char]; + val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BITS_PER_CHAR]; if (! NILP (newelt)) - val |= 1 << (idxval % bits_per_char); + val |= 1 << (idxval % BITS_PER_CHAR); else - val &= ~(1 << (idxval % bits_per_char)); - XBOOL_VECTOR (array)->data[idxval / bits_per_char] = val; + val &= ~(1 << (idxval % BITS_PER_CHAR)); + XBOOL_VECTOR (array)->data[idxval / BITS_PER_CHAR] = val; } else if (CHAR_TABLE_P (array)) { diff --git a/src/doprnt.c b/src/doprnt.c index 99e10c0730c..5639a7eff3a 100644 --- a/src/doprnt.c +++ b/src/doprnt.c @@ -104,7 +104,7 @@ doprnt (buffer, bufsize, format, format_end, nargs, args) size_bound = -size_bound; size_bound += 50; - if (size_bound > (unsigned) (1 << (INTBITS - 1))) + if (size_bound > (unsigned) (1 << (BITS_PER_INT - 1))) error ("Format padding too large"); /* Make sure we have that much. */ diff --git a/src/floatfns.c b/src/floatfns.c index 459f4d63faa..63a66519a68 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -53,13 +53,6 @@ Lisp_Object Qarith_error; #ifdef LISP_FLOAT_TYPE -#ifdef MSDOS -/* These are redefined (correctly, but differently) in values.h. */ -#undef INTBITS -#undef LONGBITS -#undef SHORTBITS -#endif - /* Work around a problem that happens because math.h on hpux 7 defines two static variables--which, in Emacs, are not really static, because `static' is defined as nothing. The problem is that they are diff --git a/src/fns.c b/src/fns.c index 2e282011e75..b2eada7468e 100644 --- a/src/fns.c +++ b/src/fns.c @@ -318,9 +318,8 @@ with the original.") if (BOOL_VECTOR_P (arg)) { Lisp_Object val; - int bits_per_char = INTBITS / sizeof (int); int size_in_chars - = (XBOOL_VECTOR (arg)->size + bits_per_char) / bits_per_char; + = (XBOOL_VECTOR (arg)->size + BITS_PER_CHAR) / BITS_PER_CHAR; val = Fmake_bool_vector (Flength (arg), Qnil); bcopy (XBOOL_VECTOR (arg)->data, XBOOL_VECTOR (val)->data, @@ -432,12 +431,11 @@ concat (nargs, args, target_type, last_special) XSETFASTINT (elt, XSTRING (this)->data[thisindex++]); else if (BOOL_VECTOR_P (this)) { - int bits_per_char = INTBITS / sizeof (int); int size_in_chars - = ((XBOOL_VECTOR (this)->size + bits_per_char) - / bits_per_char); + = ((XBOOL_VECTOR (this)->size + BITS_PER_CHAR) + / BITS_PER_CHAR); int byte; - byte = XBOOL_VECTOR (val)->data[thisindex / bits_per_char]; + byte = XBOOL_VECTOR (val)->data[thisindex / BITS_PER_CHAR]; if (byte & (1 << thisindex)) elt = Qt; else @@ -1075,9 +1073,8 @@ internal_equal (o1, o2, depth) /* Boolvectors are compared much like strings. */ if (BOOL_VECTOR_P (o1)) { - int bits_per_char = INTBITS / sizeof (int); int size_in_chars - = (XBOOL_VECTOR (o1)->size + bits_per_char) / bits_per_char; + = (XBOOL_VECTOR (o1)->size + BITS_PER_CHAR) / BITS_PER_CHAR; if (XBOOL_VECTOR (o1)->size != XBOOL_VECTOR (o2)->size) return 0; @@ -1160,9 +1157,8 @@ ARRAY is a vector, string, char-table, or bool-vector.") else if (BOOL_VECTOR_P (array)) { register unsigned char *p = XBOOL_VECTOR (array)->data; - int bits_per_char = INTBITS / sizeof (int); int size_in_chars - = (XBOOL_VECTOR (array)->size + bits_per_char) / bits_per_char; + = (XBOOL_VECTOR (array)->size + BITS_PER_CHAR) / BITS_PER_CHAR; charval = (! NILP (item) ? -1 : 0); for (index = 0; index < size_in_chars; index++) diff --git a/src/indent.c b/src/indent.c index 4510f3ba42c..ca154c91a2f 100644 --- a/src/indent.c +++ b/src/indent.c @@ -1139,7 +1139,7 @@ vmotion (from, vtarget, w) lmargin + (XFASTINT (prevline) == BEG ? start_hpos : 0), 0, - from, 1 << (INTBITS - 2), 0, + from, 1 << (BITS_PER_INT - 2), 0, width, hscroll, 0, w); vpos -= pos.vpos; first = 0; @@ -1185,7 +1185,7 @@ vmotion (from, vtarget, w) lmargin + (XFASTINT (prevline) == BEG ? start_hpos : 0), 0, - from, 1 << (INTBITS - 2), 0, + from, 1 << (BITS_PER_INT - 2), 0, width, hscroll, 0, w); did_motion = 1; } @@ -1196,7 +1196,7 @@ vmotion (from, vtarget, w) did_motion = 0; } return compute_motion (from, vpos, pos.hpos, did_motion, - ZV, vtarget, - (1 << (INTBITS - 2)), + ZV, vtarget, - (1 << (BITS_PER_INT - 2)), width, hscroll, pos.vpos * width, w); } diff --git a/src/insdel.c b/src/insdel.c index e6867647007..a33e4be616f 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -299,7 +299,7 @@ make_gap (increment) That won't work because so many places use `int'. */ if (Z - BEG + GAP_SIZE + increment - >= ((unsigned) 1 << (min (INTBITS, VALBITS) - 1))) + >= ((unsigned) 1 << (min (BITS_PER_INT, VALBITS) - 1))) error ("Buffer exceeds maximum size"); BLOCK_INPUT; diff --git a/src/lisp.h b/src/lisp.h index 3a445446ec0..0c864c46e3c 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -102,7 +102,7 @@ enum gdb_lisp_params { gdb_valbits = VALBITS, gdb_gctypebits = GCTYPEBITS, - gdb_emacs_intbits = sizeof (EMACS_INT) * INTBITS / sizeof (int), + gdb_emacs_intbits = sizeof (EMACS_INT) * BITS_PER_CHAR, #ifdef DATA_SEG_BITS gdb_data_seg_bits = DATA_SEG_BITS #else @@ -271,7 +271,7 @@ enum pvec_type /* Extract the value of a Lisp_Object as a signed integer. */ #ifndef XINT /* Some machines need to do this differently. */ -#define XINT(a) (((a) << (INTBITS-VALBITS)) >> (INTBITS-VALBITS)) +#define XINT(a) (((a) << (BITS_PER_INT-VALBITS)) >> (BITS_PER_INT-VALBITS)) #endif /* Extract the value as an unsigned integer. This is a basis @@ -316,7 +316,7 @@ extern int pure_size; #define XGCTYPE(a) ((enum Lisp_Type) (((a) >> VALBITS) & GCTYPEMASK)) #endif -#if VALBITS + GCTYPEBITS == INTBITS - 1 +#if VALBITS + GCTYPEBITS == BITS_PER_INT - 1 /* Make XMARKBIT faster if mark bit is sign bit. */ #ifndef XMARKBIT #define XMARKBIT(a) ((a) < 0) @@ -354,7 +354,7 @@ extern int pure_size; #ifdef EXPLICIT_SIGN_EXTEND /* Make sure we sign-extend; compilers have been known to fail to do so. */ -#define XINT(a) (((a).i << (INTBITS-VALBITS)) >> (INTBITS-VALBITS)) +#define XINT(a) (((a).i << (BITS_PER_INT-VALBITS)) >> (BITS_PER_INT-VALBITS)) #else #define XINT(a) ((a).s.val) #endif /* EXPLICIT_SIGN_EXTEND */ diff --git a/src/lread.c b/src/lread.c index ad0779911ea..c1de692edfd 100644 --- a/src/lread.c +++ b/src/lread.c @@ -50,10 +50,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifdef MSDOS #include "msdos.h" -/* These are redefined (correctly, but differently) in values.h. */ -#undef INTBITS -#undef LONGBITS -#undef SHORTBITS #endif #include @@ -1203,9 +1199,8 @@ read1 (readcharfun, pch, first_in_list) if (c == '"') { Lisp_Object tmp, val; - int bits_per_char = INTBITS / sizeof (int); - int size_in_chars = ((XFASTINT (length) + bits_per_char) - / bits_per_char); + int size_in_chars = ((XFASTINT (length) + BITS_PER_CHAR) + / BITS_PER_CHAR); UNREAD (c); tmp = read1 (readcharfun, pch, first_in_list); diff --git a/src/print.c b/src/print.c index 3ca2876432c..6fff1a54407 100644 --- a/src/print.c +++ b/src/print.c @@ -933,9 +933,8 @@ print (obj, printcharfun, escapeflag) register int i; register unsigned char c; struct gcpro gcpro1; - int bits_per_char = INTBITS / sizeof (int); int size_in_chars - = (XBOOL_VECTOR (obj)->size + bits_per_char) / bits_per_char; + = (XBOOL_VECTOR (obj)->size + BITS_PER_CHAR) / BITS_PER_CHAR; GCPRO1 (obj); diff --git a/src/xdisp.c b/src/xdisp.c index 7014219d59c..6c8bef40496 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -987,7 +987,7 @@ redisplay () pos = *compute_motion (tlbufpos, 0, XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0, 0, - PT, 2, - (1 << (SHORTBITS - 1)), + PT, 2, - (1 << (BITS_PER_SHORT - 1)), window_internal_width (w) - 1, XINT (w->hscroll), pos_tab_offset (w, tlbufpos), w); @@ -1531,7 +1531,7 @@ redisplay_window (window, just_this_one) + (hscroll ? 1 - hscroll : 0)), 0, ZV, height / 2, - - (1 << (SHORTBITS - 1)), + - (1 << (BITS_PER_SHORT - 1)), width, hscroll, pos_tab_offset (w, startp), w); BUF_PT (current_buffer) = pos.bufpos; if (w != XWINDOW (selected_window)) @@ -1967,7 +1967,7 @@ try_window_id (window) /* Compute the cursor position after that newline. */ ep = *compute_motion (pos, vpos, val.hpos, did_motion, tem, - height, - (1 << (SHORTBITS - 1)), + height, - (1 << (BITS_PER_SHORT - 1)), width, hscroll, pos_tab_offset (w, bp.bufpos), w); /* If changes reach past the text available on the frame, @@ -2023,13 +2023,13 @@ try_window_id (window) if (PT <= xp.bufpos) { pp = *compute_motion (ep.bufpos, ep.vpos, ep.hpos, 1, - PT, height, - (1 << (SHORTBITS - 1)), + PT, height, - (1 << (BITS_PER_SHORT - 1)), width, hscroll, epto, w); } else { pp = *compute_motion (xp.bufpos, xp.vpos, xp.hpos, 1, - PT, height, - (1 << (SHORTBITS - 1)), + PT, height, - (1 << (BITS_PER_SHORT - 1)), width, hscroll, pos_tab_offset (w, xp.bufpos), w); } @@ -2250,7 +2250,7 @@ try_window_id (window) if (debug_end_pos) { val = *compute_motion (start, 0, lmargin, 0, ZV, - height, - (1 << (SHORTBITS - 1)), + height, - (1 << (BITS_PER_SHORT - 1)), width, hscroll, pos_tab_offset (w, start), w); if (val.vpos != XFASTINT (w->window_end_vpos)) abort (); diff --git a/src/xfaces.c b/src/xfaces.c index b2c410d02c4..dc7f4188863 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -400,7 +400,7 @@ DEFUN ("pixmap-spec-p", Fpixmap_spec_p, Spixmap_spec_p, 1, 1, 0, && XINT (height) > 0 /* The string must have enough bits for width * height. */ && ((XSTRING (XCONS (XCONS (XCONS (arg)->cdr)->cdr)->car)->size - * (INTBITS / sizeof (int))) + * (BITS_PER_INT / sizeof (int))) >= XFASTINT (width) * XFASTINT (height)))) ? Qt : Qnil); } diff --git a/src/xterm.c b/src/xterm.c index 57e21af6bc3..8a16fcbae72 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -970,7 +970,7 @@ font_char_overlap_left (font, c) { /* If char is out of range, try the font's default char instead. */ c = font->default_char; - row = c >> (INTBITS - 8); + row = c >> (BITS_PER_INT - 8); within = c & 0177; } if (!(within >= font->min_char_or_byte2 @@ -1015,7 +1015,7 @@ font_char_overlap_right (font, c) { /* If char is out of range, try the font's default char instead. */ c = font->default_char; - row = c >> (INTBITS - 8); + row = c >> (BITS_PER_INT - 8); within = c & 0177; } if (!(within >= font->min_char_or_byte2 -- 2.39.2