aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2018-08-27 21:27:50 -0700
committerPaul Eggert2018-08-27 21:45:23 -0700
commitd77d01d22902acdc45c2c7059de4f1b158ab5806 (patch)
tree35f2b77594dc43e824852bb29598430945c5e6a4 /src
parent9abaf5f3581ecb76f30e8a6e7ee0e9633c133d1c (diff)
downloademacs-d77d01d22902acdc45c2c7059de4f1b158ab5806.tar.gz
emacs-d77d01d22902acdc45c2c7059de4f1b158ab5806.zip
Improve bignum support for system types
Use bignums when Emacs converts to and from system types like off_t for file sizes whose values can exceed fixnum range. Formerly, Emacs sometimes generted floats and sometimes ad-hoc conses of integers. Emacs still accepts floats and conses for these system types, in case some stray Lisp code is generating them, though this usage is obsolescent. * doc/lispref/files.texi (File Attributes): * doc/lispref/hash.texi (Defining Hash): * doc/lispref/nonascii.texi (Character Sets): * doc/lispref/os.texi (User Identification): * doc/lispref/processes.texi (System Processes): * etc/NEWS: Document changes. * src/bignum.c (mpz_set_uintmax, make_biguint) (mpz_set_uintmax_slow, bignum_to_intmax, bignum_to_uintmax): New functions. (mpz_set_intmax_slow): Implement via mpz_limbs_write, to avoid the need for an extra pass through a negative number. * src/charset.c (Fencode_char): * src/composite.h (LGLYPH_SET_CODE): * src/dired.c (file_attributes): * src/dosfns.c, src/w32.c (list_system_processes) (system_process_attributes): * src/editfns.c (init_editfns, Fuser_uid, Fuser_real_uid) (Fgroup_gid, Fgroup_real_gid, Femacs_pid): * src/emacs-module.c (check_vec_index): * src/fns.c (Fsafe_length): * src/process.c (record_deleted_pid, Fprocess_id): * src/sysdep.c (list_system_processes, system_process_attributes): * src/xselect.c (x_own_selection, selection_data_to_lisp_data): * src/xterm.c (set_wm_state): * src/inotify.c (inotifyevent_to_event, add_watch) (inotify_callback): If an integer is out of fixnum range, use a bignum instead of converting it to a float or a cons of integers. * src/coding.c (Fdefine_coding_system_internal): * src/frame.c (frame_windows_min_size) (x_set_frame_parameters): * src/fringe.c (Fdefine_fringe_bitmap): * src/nsterm.m (mouseDown:): * src/syntax.c (find_defun_start): * src/w32fns.c (x_set_undecorated, w32_createwindow) (w32_wnd_proc, Fx_create_frame, Fx_show_tip) (w32_console_toggle_lock_key): * src/w32inevt.c (key_event): * src/w32proc.c (Fw32_get_locale_info): Do not mishandle floats by treating their addresses as their values. * src/data.c (store_symval_forwarding): * src/gnutls.c (Fgnutls_error_fatalp, Fgnutls_error_string): * src/keyboard.c (command_loop_1, make_lispy_event): * src/lread.c (read_filtered_event, read1) (substitute_object_recurse): * src/window.c (Fcoordinates_in_window_p, Fwindow_at) (window_resize_apply, Fset_window_vscroll): * src/xdisp.c (handle_single_display_spec, try_scrolling) (redisplay_window, calc_pixel_width_or_height) (calc_line_height_property, on_hot_spot_p): * src/xfaces.c (check_lface_attrs): * src/xselect.c (x_get_local_selection, cons_to_x_long) (lisp_data_to_selection_data, clean_local_selection_data) (x_check_property_data, x_fill_property_data): (x_send_client_event): Do not reject bignums. * src/data.c (INTBIG_TO_LISP, intbig_to_lisp) (uintbig_to_lisp): Remove. All uses removed. * src/data.c (cons_to_unsigned, cons_to_signed): * src/dbusbind.c (xd_signature, xd_extract_signed) (xd_extract_unsigned): * src/dispnew.c (sit_for): * src/dosfns.c, src/w32.c (system_process_attributes): * src/editfns.c (Fuser_full_name): * src/fileio.c (file_offset): * src/fileio.c (write_region): * src/font.c (font_unparse_xlfd, font_open_for_lface, Fopen_font): * src/frame.c (x_set_screen_gamma): * src/frame.h (NUMVAL, FRAME_PIXEL_X_FROM_CANON_X) (FRAME_PIXEL_Y_FROM_CANON_Y): * src/image.c (parse_image_spec, x_edge_detection) (compute_image_size): * src/json.c (json_to_lisp): * src/lcms.c (PARSE_LAB_LIST_FIELD, Flcms_cie_de2000) (PARSE_XYZ_LIST_FIELD, PARSE_JCH_LIST_FIELD) (PARSE_JAB_LIST_FIELD, PARSE_VIEW_CONDITION_FLOAT) (Flcms_temp_to_white_point): * src/nsimage.m (ns_load_image, setSizeFromSpec): * src/process.c (Fsignal_process, handle_child_signal): * src/sysdep.c (system_process_attributes): * src/xdisp.c (calc_line_height_property): Handle bignums. * src/data.c (Fnumber_to_string): Use proper predicate name in signal if the argument is not a number. * src/lisp.h (make_uint): New function. (INT_TO_INTEGER): New macro. (FIXED_OR_FLOATP, CHECK_FIXNUM_OR_FLOAT) (CHECK_FIXNUM_OR_FLOAT_COERCE_MARKER, INTEGER_TO_CONS) (make_fixnum_or_float): Remove; no longer used. * src/nsfns.m, src/w32fns.c, src/xfns.c (Fx_create_frame): Reject floating-point min-width or min-height. * src/process.c (handle_child_signal): Do not worry about floating-point pids, as they are no longer generated.
Diffstat (limited to 'src')
-rw-r--r--src/bignum.c123
-rw-r--r--src/charset.c13
-rw-r--r--src/coding.c2
-rw-r--r--src/composite.h2
-rw-r--r--src/data.c157
-rw-r--r--src/dbusbind.c44
-rw-r--r--src/dired.c17
-rw-r--r--src/dispnew.c9
-rw-r--r--src/dosfns.c12
-rw-r--r--src/editfns.c30
-rw-r--r--src/emacs-module.c2
-rw-r--r--src/fileio.c13
-rw-r--r--src/fns.c6
-rw-r--r--src/font.c36
-rw-r--r--src/frame.c14
-rw-r--r--src/frame.h10
-rw-r--r--src/fringe.c2
-rw-r--r--src/gnutls.c4
-rw-r--r--src/image.c10
-rw-r--r--src/inotify.c10
-rw-r--r--src/json.c12
-rw-r--r--src/keyboard.c4
-rw-r--r--src/lcms.c18
-rw-r--r--src/lisp.h47
-rw-r--r--src/lread.c10
-rw-r--r--src/nsfns.m4
-rw-r--r--src/nsimage.m12
-rw-r--r--src/nsterm.m2
-rw-r--r--src/process.c17
-rw-r--r--src/syntax.c2
-rw-r--r--src/sysdep.c102
-rw-r--r--src/w32.c28
-rw-r--r--src/w32fns.c18
-rw-r--r--src/w32inevt.c4
-rw-r--r--src/w32proc.c2
-rw-r--r--src/window.c19
-rw-r--r--src/xdisp.c41
-rw-r--r--src/xfaces.c2
-rw-r--r--src/xfns.c4
-rw-r--r--src/xselect.c40
-rw-r--r--src/xterm.c4
41 files changed, 503 insertions, 405 deletions
diff --git a/src/bignum.c b/src/bignum.c
index 18f94e7ed63..5dbfdb9319a 100644
--- a/src/bignum.c
+++ b/src/bignum.c
@@ -67,6 +67,18 @@ make_bignum (mpz_t const op)
67 return make_bignum_bits (op, mpz_sizeinbase (op, 2)); 67 return make_bignum_bits (op, mpz_sizeinbase (op, 2));
68} 68}
69 69
70static void mpz_set_uintmax_slow (mpz_t, uintmax_t);
71
72/* Set RESULT to V. */
73static void
74mpz_set_uintmax (mpz_t result, uintmax_t v)
75{
76 if (v <= ULONG_MAX)
77 mpz_set_ui (result, v);
78 else
79 mpz_set_uintmax_slow (result, v);
80}
81
70/* Return a Lisp integer equal to N, which must not be in fixnum range. */ 82/* Return a Lisp integer equal to N, which must not be in fixnum range. */
71Lisp_Object 83Lisp_Object
72make_bigint (intmax_t n) 84make_bigint (intmax_t n)
@@ -79,6 +91,17 @@ make_bigint (intmax_t n)
79 mpz_clear (z); 91 mpz_clear (z);
80 return result; 92 return result;
81} 93}
94Lisp_Object
95make_biguint (uintmax_t n)
96{
97 eassert (FIXNUM_OVERFLOW_P (n));
98 mpz_t z;
99 mpz_init (z);
100 mpz_set_uintmax (z, n);
101 Lisp_Object result = make_bignum (z);
102 mpz_clear (z);
103 return result;
104}
82 105
83/* Return a Lisp integer with value taken from OP. */ 106/* Return a Lisp integer with value taken from OP. */
84Lisp_Object 107Lisp_Object
@@ -109,23 +132,95 @@ make_integer (mpz_t const op)
109 return make_bignum_bits (op, bits); 132 return make_bignum_bits (op, bits);
110} 133}
111 134
135/* Set RESULT to V. This code is for when intmax_t is wider than long. */
112void 136void
113mpz_set_intmax_slow (mpz_t result, intmax_t v) 137mpz_set_intmax_slow (mpz_t result, intmax_t v)
114{ 138{
115 bool complement = v < 0; 139 int maxlimbs = (INTMAX_WIDTH + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
116 if (complement) 140 mp_limb_t *limb = mpz_limbs_write (result, maxlimbs);
117 v = -1 - v; 141 int n = 0;
118 142 uintmax_t u = v;
119 enum { nails = sizeof v * CHAR_BIT - INTMAX_WIDTH }; 143 bool negative = v < 0;
120# ifndef HAVE_GMP 144 if (negative)
121 /* mini-gmp requires NAILS to be zero, which is true for all 145 {
122 likely Emacs platforms. Sanity-check this. */ 146 uintmax_t two = 2;
123 verify (nails == 0); 147 u = -u & ((two << (UINTMAX_WIDTH - 1)) - 1);
124# endif 148 }
125 149
126 mpz_import (result, 1, -1, sizeof v, 0, nails, &v); 150 do
127 if (complement) 151 {
128 mpz_com (result, result); 152 limb[n++] = u;
153 u = GMP_NUMB_BITS < UINTMAX_WIDTH ? u >> GMP_NUMB_BITS : 0;
154 }
155 while (u != 0);
156
157 mpz_limbs_finish (result, negative ? -n : n);
158}
159static void
160mpz_set_uintmax_slow (mpz_t result, uintmax_t v)
161{
162 int maxlimbs = (UINTMAX_WIDTH + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
163 mp_limb_t *limb = mpz_limbs_write (result, maxlimbs);
164 int n = 0;
165
166 do
167 {
168 limb[n++] = v;
169 v = GMP_NUMB_BITS < INTMAX_WIDTH ? v >> GMP_NUMB_BITS : 0;
170 }
171 while (v != 0);
172
173 mpz_limbs_finish (result, n);
174}
175
176/* Return the value of the bignum X if it fits, 0 otherwise.
177 A bignum cannot be zero, so 0 indicates failure reliably. */
178intmax_t
179bignum_to_intmax (Lisp_Object x)
180{
181 ptrdiff_t bits = mpz_sizeinbase (XBIGNUM (x)->value, 2);
182 bool negative = mpz_sgn (XBIGNUM (x)->value) < 0;
183
184 if (bits < INTMAX_WIDTH)
185 {
186 intmax_t v = 0;
187 int i = 0, shift = 0;
188
189 do
190 {
191 intmax_t limb = mpz_getlimbn (XBIGNUM (x)->value, i++);
192 v += limb << shift;
193 shift += GMP_NUMB_BITS;
194 }
195 while (shift < bits);
196
197 return negative ? -v : v;
198 }
199 return ((bits == INTMAX_WIDTH && INTMAX_MIN < -INTMAX_MAX && negative
200 && mpz_scan1 (XBIGNUM (x)->value, 0) == INTMAX_WIDTH - 1)
201 ? INTMAX_MIN : 0);
202}
203uintmax_t
204bignum_to_uintmax (Lisp_Object x)
205{
206 uintmax_t v = 0;
207 if (0 <= mpz_sgn (XBIGNUM (x)->value))
208 {
209 ptrdiff_t bits = mpz_sizeinbase (XBIGNUM (x)->value, 2);
210 if (bits <= UINTMAX_WIDTH)
211 {
212 int i = 0, shift = 0;
213
214 do
215 {
216 uintmax_t limb = mpz_getlimbn (XBIGNUM (x)->value, i++);
217 v += limb << shift;
218 shift += GMP_NUMB_BITS;
219 }
220 while (shift < bits);
221 }
222 }
223 return v;
129} 224}
130 225
131/* Convert NUM to a base-BASE Lisp string. */ 226/* Convert NUM to a base-BASE Lisp string. */
diff --git a/src/charset.c b/src/charset.c
index e77a3900b8b..7b272a204a1 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -929,8 +929,8 @@ usage: (define-charset-internal ...) */)
929 929
930 if (code < charset.min_code 930 if (code < charset.min_code
931 || code > charset.max_code) 931 || code > charset.max_code)
932 args_out_of_range_3 (make_fixnum_or_float (charset.min_code), 932 args_out_of_range_3 (INT_TO_INTEGER (charset.min_code),
933 make_fixnum_or_float (charset.max_code), val); 933 INT_TO_INTEGER (charset.max_code), val);
934 charset.char_index_offset = CODE_POINT_TO_INDEX (&charset, code); 934 charset.char_index_offset = CODE_POINT_TO_INDEX (&charset, code);
935 charset.min_code = code; 935 charset.min_code = code;
936 } 936 }
@@ -942,8 +942,8 @@ usage: (define-charset-internal ...) */)
942 942
943 if (code < charset.min_code 943 if (code < charset.min_code
944 || code > charset.max_code) 944 || code > charset.max_code)
945 args_out_of_range_3 (make_fixnum_or_float (charset.min_code), 945 args_out_of_range_3 (INT_TO_INTEGER (charset.min_code),
946 make_fixnum_or_float (charset.max_code), val); 946 INT_TO_INTEGER (charset.max_code), val);
947 charset.max_code = code; 947 charset.max_code = code;
948 } 948 }
949 949
@@ -1852,7 +1852,8 @@ DEFUN ("decode-char", Fdecode_char, Sdecode_char, 2, 2, 0,
1852 doc: /* Decode the pair of CHARSET and CODE-POINT into a character. 1852 doc: /* Decode the pair of CHARSET and CODE-POINT into a character.
1853Return nil if CODE-POINT is not valid in CHARSET. 1853Return nil if CODE-POINT is not valid in CHARSET.
1854 1854
1855CODE-POINT may be a cons (HIGHER-16-BIT-VALUE . LOWER-16-BIT-VALUE). */) 1855CODE-POINT may be a cons (HIGHER-16-BIT-VALUE . LOWER-16-BIT-VALUE),
1856although this usage is obsolescent. */)
1856 (Lisp_Object charset, Lisp_Object code_point) 1857 (Lisp_Object charset, Lisp_Object code_point)
1857{ 1858{
1858 int c, id; 1859 int c, id;
@@ -1883,7 +1884,7 @@ Return nil if CHARSET doesn't include CH. */)
1883 code = ENCODE_CHAR (charsetp, c); 1884 code = ENCODE_CHAR (charsetp, c);
1884 if (code == CHARSET_INVALID_CODE (charsetp)) 1885 if (code == CHARSET_INVALID_CODE (charsetp))
1885 return Qnil; 1886 return Qnil;
1886 return INTEGER_TO_CONS (code); 1887 return INT_TO_INTEGER (code);
1887} 1888}
1888 1889
1889 1890
diff --git a/src/coding.c b/src/coding.c
index 53e98f89811..966492a322f 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -10214,7 +10214,7 @@ usage: (define-coding-system-internal ...) */)
10214 tmp = AREF (val, i); 10214 tmp = AREF (val, i);
10215 if (NILP (tmp)) 10215 if (NILP (tmp))
10216 tmp = XCAR (tail); 10216 tmp = XCAR (tail);
10217 else if (FIXED_OR_FLOATP (tmp)) 10217 else if (FIXNATP (tmp))
10218 { 10218 {
10219 dim2 = CHARSET_DIMENSION (CHARSET_FROM_ID (XFIXNAT (tmp))); 10219 dim2 = CHARSET_DIMENSION (CHARSET_FROM_ID (XFIXNAT (tmp)));
10220 if (dim < dim2) 10220 if (dim < dim2)
diff --git a/src/composite.h b/src/composite.h
index 2d03e48ecc5..8039113d872 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -294,7 +294,7 @@ enum lglyph_indices
294/* Callers must assure that VAL is not negative! */ 294/* Callers must assure that VAL is not negative! */
295#define LGLYPH_SET_CODE(g, val) \ 295#define LGLYPH_SET_CODE(g, val) \
296 ASET (g, LGLYPH_IX_CODE, \ 296 ASET (g, LGLYPH_IX_CODE, \
297 val == FONT_INVALID_CODE ? Qnil : INTEGER_TO_CONS (val)) 297 val == FONT_INVALID_CODE ? Qnil : INT_TO_INTEGER (val))
298 298
299#define LGLYPH_SET_WIDTH(g, val) ASET ((g), LGLYPH_IX_WIDTH, make_fixnum (val)) 299#define LGLYPH_SET_WIDTH(g, val) ASET ((g), LGLYPH_IX_WIDTH, make_fixnum (val))
300#define LGLYPH_SET_LBEARING(g, val) ASET ((g), LGLYPH_IX_LBEARING, make_fixnum (val)) 300#define LGLYPH_SET_LBEARING(g, val) ASET ((g), LGLYPH_IX_LBEARING, make_fixnum (val))
diff --git a/src/data.c b/src/data.c
index ece76a5bc6f..6afda1e6fb9 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1132,7 +1132,7 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva
1132 else if ((prop = Fget (predicate, Qrange), !NILP (prop))) 1132 else if ((prop = Fget (predicate, Qrange), !NILP (prop)))
1133 { 1133 {
1134 Lisp_Object min = XCAR (prop), max = XCDR (prop); 1134 Lisp_Object min = XCAR (prop), max = XCDR (prop);
1135 if (! FIXED_OR_FLOATP (newval) 1135 if (! NUMBERP (newval)
1136 || NILP (CALLN (Fleq, min, newval, max))) 1136 || NILP (CALLN (Fleq, min, newval, max)))
1137 wrong_range (min, max, newval); 1137 wrong_range (min, max, newval);
1138 } 1138 }
@@ -2627,48 +2627,21 @@ DEFUN ("/=", Fneq, Sneq, 2, 2, 0,
2627 return arithcompare (num1, num2, ARITH_NOTEQUAL); 2627 return arithcompare (num1, num2, ARITH_NOTEQUAL);
2628} 2628}
2629 2629
2630/* Convert the integer I to a cons-of-integers, where I is not in
2631 fixnum range. */
2632
2633#define INTBIG_TO_LISP(i, extremum) \
2634 (eassert (FIXNUM_OVERFLOW_P (i)), \
2635 (! (FIXNUM_OVERFLOW_P ((extremum) >> 16) \
2636 && FIXNUM_OVERFLOW_P ((i) >> 16)) \
2637 ? Fcons (make_fixnum ((i) >> 16), make_fixnum ((i) & 0xffff)) \
2638 : ! (FIXNUM_OVERFLOW_P ((extremum) >> 16 >> 24) \
2639 && FIXNUM_OVERFLOW_P ((i) >> 16 >> 24)) \
2640 ? Fcons (make_fixnum ((i) >> 16 >> 24), \
2641 Fcons (make_fixnum ((i) >> 16 & 0xffffff), \
2642 make_fixnum ((i) & 0xffff))) \
2643 : make_float (i)))
2644
2645Lisp_Object
2646intbig_to_lisp (intmax_t i)
2647{
2648 return INTBIG_TO_LISP (i, INTMAX_MIN);
2649}
2650
2651Lisp_Object
2652uintbig_to_lisp (uintmax_t i)
2653{
2654 return INTBIG_TO_LISP (i, UINTMAX_MAX);
2655}
2656
2657/* Convert the cons-of-integers, integer, or float value C to an 2630/* Convert the cons-of-integers, integer, or float value C to an
2658 unsigned value with maximum value MAX, where MAX is one less than a 2631 unsigned value with maximum value MAX, where MAX is one less than a
2659 power of 2. Signal an error if C does not have a valid format or 2632 power of 2. Signal an error if C does not have a valid format or
2660 is out of range. */ 2633 is out of range.
2634
2635 Although Emacs represents large integers with bignums instead of
2636 cons-of-integers or floats, for now this function still accepts the
2637 obsolete forms in case some old Lisp code still generates them. */
2661uintmax_t 2638uintmax_t
2662cons_to_unsigned (Lisp_Object c, uintmax_t max) 2639cons_to_unsigned (Lisp_Object c, uintmax_t max)
2663{ 2640{
2664 bool valid = false; 2641 bool valid = false;
2665 uintmax_t val UNINIT; 2642 uintmax_t val UNINIT;
2666 if (FIXNUMP (c)) 2643
2667 { 2644 if (FLOATP (c))
2668 valid = XFIXNUM (c) >= 0;
2669 val = XFIXNUM (c);
2670 }
2671 else if (FLOATP (c))
2672 { 2645 {
2673 double d = XFLOAT_DATA (c); 2646 double d = XFLOAT_DATA (c);
2674 if (d >= 0 && d < 1.0 + max) 2647 if (d >= 0 && d < 1.0 + max)
@@ -2677,27 +2650,44 @@ cons_to_unsigned (Lisp_Object c, uintmax_t max)
2677 valid = val == d; 2650 valid = val == d;
2678 } 2651 }
2679 } 2652 }
2680 else if (CONSP (c) && FIXNATP (XCAR (c))) 2653 else
2681 { 2654 {
2682 uintmax_t top = XFIXNAT (XCAR (c)); 2655 Lisp_Object hi = CONSP (c) ? XCAR (c) : c;
2683 Lisp_Object rest = XCDR (c); 2656
2684 if (top <= UINTMAX_MAX >> 24 >> 16 2657 if (FIXNUMP (hi))
2685 && CONSP (rest)
2686 && FIXNATP (XCAR (rest)) && XFIXNAT (XCAR (rest)) < 1 << 24
2687 && FIXNATP (XCDR (rest)) && XFIXNAT (XCDR (rest)) < 1 << 16)
2688 { 2658 {
2689 uintmax_t mid = XFIXNAT (XCAR (rest)); 2659 val = XFIXNUM (hi);
2690 val = top << 24 << 16 | mid << 16 | XFIXNAT (XCDR (rest)); 2660 valid = 0 <= val;
2691 valid = true;
2692 } 2661 }
2693 else if (top <= UINTMAX_MAX >> 16) 2662 else
2694 { 2663 {
2695 if (CONSP (rest)) 2664 val = bignum_to_uintmax (hi);
2696 rest = XCAR (rest); 2665 valid = val != 0;
2697 if (FIXNATP (rest) && XFIXNAT (rest) < 1 << 16) 2666 }
2667
2668 if (valid && CONSP (c))
2669 {
2670 uintmax_t top = val;
2671 Lisp_Object rest = XCDR (c);
2672 if (top <= UINTMAX_MAX >> 24 >> 16
2673 && CONSP (rest)
2674 && FIXNATP (XCAR (rest)) && XFIXNAT (XCAR (rest)) < 1 << 24
2675 && FIXNATP (XCDR (rest)) && XFIXNAT (XCDR (rest)) < 1 << 16)
2698 { 2676 {
2699 val = top << 16 | XFIXNAT (rest); 2677 uintmax_t mid = XFIXNAT (XCAR (rest));
2700 valid = true; 2678 val = top << 24 << 16 | mid << 16 | XFIXNAT (XCDR (rest));
2679 }
2680 else
2681 {
2682 valid = top <= UINTMAX_MAX >> 16;
2683 if (valid)
2684 {
2685 if (CONSP (rest))
2686 rest = XCAR (rest);
2687 valid = FIXNATP (rest) && XFIXNAT (rest) < 1 << 16;
2688 if (valid)
2689 val = top << 16 | XFIXNAT (rest);
2690 }
2701 } 2691 }
2702 } 2692 }
2703 } 2693 }
@@ -2711,18 +2701,18 @@ cons_to_unsigned (Lisp_Object c, uintmax_t max)
2711 value with extrema MIN and MAX. MAX should be one less than a 2701 value with extrema MIN and MAX. MAX should be one less than a
2712 power of 2, and MIN should be zero or the negative of a power of 2. 2702 power of 2, and MIN should be zero or the negative of a power of 2.
2713 Signal an error if C does not have a valid format or is out of 2703 Signal an error if C does not have a valid format or is out of
2714 range. */ 2704 range.
2705
2706 Although Emacs represents large integers with bignums instead of
2707 cons-of-integers or floats, for now this function still accepts the
2708 obsolete forms in case some old Lisp code still generates them. */
2715intmax_t 2709intmax_t
2716cons_to_signed (Lisp_Object c, intmax_t min, intmax_t max) 2710cons_to_signed (Lisp_Object c, intmax_t min, intmax_t max)
2717{ 2711{
2718 bool valid = false; 2712 bool valid = false;
2719 intmax_t val UNINIT; 2713 intmax_t val UNINIT;
2720 if (FIXNUMP (c)) 2714
2721 { 2715 if (FLOATP (c))
2722 val = XFIXNUM (c);
2723 valid = true;
2724 }
2725 else if (FLOATP (c))
2726 { 2716 {
2727 double d = XFLOAT_DATA (c); 2717 double d = XFLOAT_DATA (c);
2728 if (d >= min && d < 1.0 + max) 2718 if (d >= min && d < 1.0 + max)
@@ -2731,27 +2721,44 @@ cons_to_signed (Lisp_Object c, intmax_t min, intmax_t max)
2731 valid = val == d; 2721 valid = val == d;
2732 } 2722 }
2733 } 2723 }
2734 else if (CONSP (c) && FIXNUMP (XCAR (c))) 2724 else
2735 { 2725 {
2736 intmax_t top = XFIXNUM (XCAR (c)); 2726 Lisp_Object hi = CONSP (c) ? XCAR (c) : c;
2737 Lisp_Object rest = XCDR (c); 2727
2738 if (top >= INTMAX_MIN >> 24 >> 16 && top <= INTMAX_MAX >> 24 >> 16 2728 if (FIXNUMP (hi))
2739 && CONSP (rest)
2740 && FIXNATP (XCAR (rest)) && XFIXNAT (XCAR (rest)) < 1 << 24
2741 && FIXNATP (XCDR (rest)) && XFIXNAT (XCDR (rest)) < 1 << 16)
2742 { 2729 {
2743 intmax_t mid = XFIXNAT (XCAR (rest)); 2730 val = XFIXNUM (hi);
2744 val = top << 24 << 16 | mid << 16 | XFIXNAT (XCDR (rest));
2745 valid = true; 2731 valid = true;
2746 } 2732 }
2747 else if (top >= INTMAX_MIN >> 16 && top <= INTMAX_MAX >> 16) 2733 else if (BIGNUMP (hi))
2748 { 2734 {
2749 if (CONSP (rest)) 2735 val = bignum_to_intmax (hi);
2750 rest = XCAR (rest); 2736 valid = val != 0;
2751 if (FIXNATP (rest) && XFIXNAT (rest) < 1 << 16) 2737 }
2738
2739 if (valid && CONSP (c))
2740 {
2741 intmax_t top = val;
2742 Lisp_Object rest = XCDR (c);
2743 if (top >= INTMAX_MIN >> 24 >> 16 && top <= INTMAX_MAX >> 24 >> 16
2744 && CONSP (rest)
2745 && FIXNATP (XCAR (rest)) && XFIXNAT (XCAR (rest)) < 1 << 24
2746 && FIXNATP (XCDR (rest)) && XFIXNAT (XCDR (rest)) < 1 << 16)
2747 {
2748 intmax_t mid = XFIXNAT (XCAR (rest));
2749 val = top << 24 << 16 | mid << 16 | XFIXNAT (XCDR (rest));
2750 }
2751 else
2752 { 2752 {
2753 val = top << 16 | XFIXNAT (rest); 2753 valid = INTMAX_MIN >> 16 <= top && top <= INTMAX_MAX >> 16;
2754 valid = true; 2754 if (valid)
2755 {
2756 if (CONSP (rest))
2757 rest = XCAR (rest);
2758 valid = FIXNATP (rest) && XFIXNAT (rest) < 1 << 16;
2759 if (valid)
2760 val = top << 16 | XFIXNAT (rest);
2761 }
2755 } 2762 }
2756 } 2763 }
2757 } 2764 }
@@ -2770,11 +2777,11 @@ NUMBER may be an integer or a floating point number. */)
2770 char buffer[max (FLOAT_TO_STRING_BUFSIZE, INT_BUFSIZE_BOUND (EMACS_INT))]; 2777 char buffer[max (FLOAT_TO_STRING_BUFSIZE, INT_BUFSIZE_BOUND (EMACS_INT))];
2771 int len; 2778 int len;
2772 2779
2780 CHECK_NUMBER (number);
2781
2773 if (BIGNUMP (number)) 2782 if (BIGNUMP (number))
2774 return bignum_to_string (number, 10); 2783 return bignum_to_string (number, 10);
2775 2784
2776 CHECK_FIXNUM_OR_FLOAT (number);
2777
2778 if (FLOATP (number)) 2785 if (FLOATP (number))
2779 len = float_to_string (buffer, XFLOAT_DATA (number)); 2786 len = float_to_string (buffer, XFLOAT_DATA (number));
2780 else 2787 else
diff --git a/src/dbusbind.c b/src/dbusbind.c
index fe92d3997bd..47346a7d4d4 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -378,7 +378,7 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object)
378 case DBUS_TYPE_INT32: 378 case DBUS_TYPE_INT32:
379 case DBUS_TYPE_INT64: 379 case DBUS_TYPE_INT64:
380 case DBUS_TYPE_DOUBLE: 380 case DBUS_TYPE_DOUBLE:
381 CHECK_FIXNUM_OR_FLOAT (object); 381 CHECK_NUMBER (object);
382 sprintf (signature, "%c", dtype); 382 sprintf (signature, "%c", dtype);
383 break; 383 break;
384 384
@@ -519,13 +519,13 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object)
519static intmax_t 519static intmax_t
520xd_extract_signed (Lisp_Object x, intmax_t lo, intmax_t hi) 520xd_extract_signed (Lisp_Object x, intmax_t lo, intmax_t hi)
521{ 521{
522 CHECK_FIXNUM_OR_FLOAT (x); 522 CHECK_NUMBER (x);
523 if (FIXNUMP (x)) 523 if (FIXNUMP (x))
524 { 524 {
525 if (lo <= XFIXNUM (x) && XFIXNUM (x) <= hi) 525 if (lo <= XFIXNUM (x) && XFIXNUM (x) <= hi)
526 return XFIXNUM (x); 526 return XFIXNUM (x);
527 } 527 }
528 else 528 else if (FLOATP (x))
529 { 529 {
530 double d = XFLOAT_DATA (x); 530 double d = XFLOAT_DATA (x);
531 if (lo <= d && d < 1.0 + hi) 531 if (lo <= d && d < 1.0 + hi)
@@ -535,25 +535,30 @@ xd_extract_signed (Lisp_Object x, intmax_t lo, intmax_t hi)
535 return n; 535 return n;
536 } 536 }
537 } 537 }
538 else if (! (MOST_NEGATIVE_FIXNUM <= lo && hi <= MOST_POSITIVE_FIXNUM))
539 {
540 intmax_t i = bignum_to_intmax (x);
541 if (i != 0 && lo <= i && i <= hi)
542 return i;
543 }
544
538 if (xd_in_read_queued_messages) 545 if (xd_in_read_queued_messages)
539 Fthrow (Qdbus_error, Qnil); 546 Fthrow (Qdbus_error, Qnil);
540 else 547 else
541 args_out_of_range_3 (x, 548 args_out_of_range_3 (x, INT_TO_INTEGER (lo), INT_TO_INTEGER (hi));
542 make_fixnum_or_float (lo),
543 make_fixnum_or_float (hi));
544} 549}
545 550
546/* Convert X to an unsigned integer with bounds 0 and HI. */ 551/* Convert X to an unsigned integer with bounds 0 and HI. */
547static uintmax_t 552static uintmax_t
548xd_extract_unsigned (Lisp_Object x, uintmax_t hi) 553xd_extract_unsigned (Lisp_Object x, uintmax_t hi)
549{ 554{
550 CHECK_FIXNUM_OR_FLOAT (x); 555 CHECK_NUMBER (x);
551 if (FIXNUMP (x)) 556 if (FIXNUMP (x))
552 { 557 {
553 if (0 <= XFIXNUM (x) && XFIXNUM (x) <= hi) 558 if (0 <= XFIXNUM (x) && XFIXNUM (x) <= hi)
554 return XFIXNUM (x); 559 return XFIXNUM (x);
555 } 560 }
556 else 561 else if (FLOATP (x))
557 { 562 {
558 double d = XFLOAT_DATA (x); 563 double d = XFLOAT_DATA (x);
559 if (0 <= d && d < 1.0 + hi) 564 if (0 <= d && d < 1.0 + hi)
@@ -563,10 +568,17 @@ xd_extract_unsigned (Lisp_Object x, uintmax_t hi)
563 return n; 568 return n;
564 } 569 }
565 } 570 }
571 else if (! (hi <= MOST_POSITIVE_FIXNUM))
572 {
573 uintmax_t i = bignum_to_uintmax (x);
574 if (i != 0 && i <= hi)
575 return i;
576 }
577
566 if (xd_in_read_queued_messages) 578 if (xd_in_read_queued_messages)
567 Fthrow (Qdbus_error, Qnil); 579 Fthrow (Qdbus_error, Qnil);
568 else 580 else
569 args_out_of_range_3 (x, make_fixnum (0), make_fixnum_or_float (hi)); 581 args_out_of_range_3 (x, make_fixnum (0), INT_TO_INTEGER (hi));
570} 582}
571 583
572/* Append C value, extracted from Lisp OBJECT, to iteration ITER. 584/* Append C value, extracted from Lisp OBJECT, to iteration ITER.
@@ -848,7 +860,7 @@ xd_retrieve_arg (int dtype, DBusMessageIter *iter)
848 dbus_message_iter_get_basic (iter, &val); 860 dbus_message_iter_get_basic (iter, &val);
849 pval = val; 861 pval = val;
850 XD_DEBUG_MESSAGE ("%c %d", dtype, pval); 862 XD_DEBUG_MESSAGE ("%c %d", dtype, pval);
851 return make_fixnum_or_float (val); 863 return INT_TO_INTEGER (val);
852 } 864 }
853 865
854 case DBUS_TYPE_UINT32: 866 case DBUS_TYPE_UINT32:
@@ -861,7 +873,7 @@ xd_retrieve_arg (int dtype, DBusMessageIter *iter)
861 dbus_message_iter_get_basic (iter, &val); 873 dbus_message_iter_get_basic (iter, &val);
862 pval = val; 874 pval = val;
863 XD_DEBUG_MESSAGE ("%c %u", dtype, pval); 875 XD_DEBUG_MESSAGE ("%c %u", dtype, pval);
864 return make_fixnum_or_float (val); 876 return INT_TO_INTEGER (val);
865 } 877 }
866 878
867 case DBUS_TYPE_INT64: 879 case DBUS_TYPE_INT64:
@@ -871,7 +883,7 @@ xd_retrieve_arg (int dtype, DBusMessageIter *iter)
871 dbus_message_iter_get_basic (iter, &val); 883 dbus_message_iter_get_basic (iter, &val);
872 pval = val; 884 pval = val;
873 XD_DEBUG_MESSAGE ("%c %"pMd, dtype, pval); 885 XD_DEBUG_MESSAGE ("%c %"pMd, dtype, pval);
874 return make_fixnum_or_float (val); 886 return INT_TO_INTEGER (val);
875 } 887 }
876 888
877 case DBUS_TYPE_UINT64: 889 case DBUS_TYPE_UINT64:
@@ -881,7 +893,7 @@ xd_retrieve_arg (int dtype, DBusMessageIter *iter)
881 dbus_message_iter_get_basic (iter, &val); 893 dbus_message_iter_get_basic (iter, &val);
882 pval = val; 894 pval = val;
883 XD_DEBUG_MESSAGE ("%c %"pMu, dtype, pval); 895 XD_DEBUG_MESSAGE ("%c %"pMu, dtype, pval);
884 return make_fixnum_or_float (val); 896 return INT_TO_INTEGER (val);
885 } 897 }
886 898
887 case DBUS_TYPE_DOUBLE: 899 case DBUS_TYPE_DOUBLE:
@@ -1454,7 +1466,7 @@ usage: (dbus-message-internal &rest REST) */)
1454 1466
1455 /* The result is the key in Vdbus_registered_objects_table. */ 1467 /* The result is the key in Vdbus_registered_objects_table. */
1456 serial = dbus_message_get_serial (dmessage); 1468 serial = dbus_message_get_serial (dmessage);
1457 result = list3 (QCserial, bus, make_fixnum_or_float (serial)); 1469 result = list3 (QCserial, bus, INT_TO_INTEGER (serial));
1458 1470
1459 /* Create a hash table entry. */ 1471 /* Create a hash table entry. */
1460 Fputhash (result, handler, Vdbus_registered_objects_table); 1472 Fputhash (result, handler, Vdbus_registered_objects_table);
@@ -1541,7 +1553,7 @@ xd_read_message_1 (DBusConnection *connection, Lisp_Object bus)
1541 || (mtype == DBUS_MESSAGE_TYPE_ERROR)) 1553 || (mtype == DBUS_MESSAGE_TYPE_ERROR))
1542 { 1554 {
1543 /* Search for a registered function of the message. */ 1555 /* Search for a registered function of the message. */
1544 key = list3 (QCserial, bus, make_fixnum_or_float (serial)); 1556 key = list3 (QCserial, bus, INT_TO_INTEGER (serial));
1545 value = Fgethash (key, Vdbus_registered_objects_table, Qnil); 1557 value = Fgethash (key, Vdbus_registered_objects_table, Qnil);
1546 1558
1547 /* There shall be exactly one entry. Construct an event. */ 1559 /* There shall be exactly one entry. Construct an event. */
@@ -1608,7 +1620,7 @@ xd_read_message_1 (DBusConnection *connection, Lisp_Object bus)
1608 event.arg); 1620 event.arg);
1609 event.arg = Fcons ((uname == NULL ? Qnil : build_string (uname)), 1621 event.arg = Fcons ((uname == NULL ? Qnil : build_string (uname)),
1610 event.arg); 1622 event.arg);
1611 event.arg = Fcons (make_fixnum_or_float (serial), event.arg); 1623 event.arg = Fcons (INT_TO_INTEGER (serial), event.arg);
1612 event.arg = Fcons (make_fixnum (mtype), event.arg); 1624 event.arg = Fcons (make_fixnum (mtype), event.arg);
1613 1625
1614 /* Add the bus symbol to the event. */ 1626 /* Add the bus symbol to the event. */
diff --git a/src/dired.c b/src/dired.c
index b92cd2b9f01..c4cda400a06 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -867,7 +867,7 @@ Elements of the attribute list are:
867 0. t for directory, string (name linked to) for symbolic link, or nil. 867 0. t for directory, string (name linked to) for symbolic link, or nil.
868 1. Number of links to file. 868 1. Number of links to file.
869 2. File uid as a string or a number. If a string value cannot be 869 2. File uid as a string or a number. If a string value cannot be
870 looked up, a numeric value, either an integer or a float, is returned. 870 looked up, an integer value is returned.
871 3. File gid, likewise. 871 3. File gid, likewise.
872 4. Last access time, as a list of integers (HIGH LOW USEC PSEC) in the 872 4. Last access time, as a list of integers (HIGH LOW USEC PSEC) in the
873 same style as (current-time). 873 same style as (current-time).
@@ -877,7 +877,6 @@ Elements of the attribute list are:
877 6. Last status change time, likewise. This is the time of last change 877 6. Last status change time, likewise. This is the time of last change
878 to the file's attributes: owner and group, access mode bits, etc. 878 to the file's attributes: owner and group, access mode bits, etc.
879 7. Size in bytes. 879 7. Size in bytes.
880 This is a floating point number if the size is too large for an integer.
881 8. File modes, as a string of ten letters or dashes as in ls -l. 880 8. File modes, as a string of ten letters or dashes as in ls -l.
882 9. An unspecified value, present only for backward compatibility. 881 9. An unspecified value, present only for backward compatibility.
88310. inode number. If it is larger than what an Emacs integer can hold, 88210. inode number. If it is larger than what an Emacs integer can hold,
@@ -1012,10 +1011,10 @@ file_attributes (int fd, char const *name,
1012 make_fixnum (s.st_nlink), 1011 make_fixnum (s.st_nlink),
1013 (uname 1012 (uname
1014 ? DECODE_SYSTEM (build_unibyte_string (uname)) 1013 ? DECODE_SYSTEM (build_unibyte_string (uname))
1015 : make_fixnum_or_float (s.st_uid)), 1014 : INT_TO_INTEGER (s.st_uid)),
1016 (gname 1015 (gname
1017 ? DECODE_SYSTEM (build_unibyte_string (gname)) 1016 ? DECODE_SYSTEM (build_unibyte_string (gname))
1018 : make_fixnum_or_float (s.st_gid)), 1017 : INT_TO_INTEGER (s.st_gid)),
1019 make_lisp_time (get_stat_atime (&s)), 1018 make_lisp_time (get_stat_atime (&s)),
1020 make_lisp_time (get_stat_mtime (&s)), 1019 make_lisp_time (get_stat_mtime (&s)),
1021 make_lisp_time (get_stat_ctime (&s)), 1020 make_lisp_time (get_stat_ctime (&s)),
@@ -1024,14 +1023,14 @@ file_attributes (int fd, char const *name,
1024 files of sizes in the 2-4 GiB range wrap around to 1023 files of sizes in the 2-4 GiB range wrap around to
1025 negative values, as this is a common bug on older 1024 negative values, as this is a common bug on older
1026 32-bit platforms. */ 1025 32-bit platforms. */
1027 make_fixnum_or_float (sizeof (s.st_size) == 4 1026 INT_TO_INTEGER (sizeof (s.st_size) == 4
1028 ? s.st_size & 0xffffffffu 1027 ? s.st_size & 0xffffffffu
1029 : s.st_size), 1028 : s.st_size),
1030 1029
1031 make_string (modes, 10), 1030 make_string (modes, 10),
1032 Qt, 1031 Qt,
1033 INTEGER_TO_CONS (s.st_ino), 1032 INT_TO_INTEGER (s.st_ino),
1034 INTEGER_TO_CONS (s.st_dev)); 1033 INT_TO_INTEGER (s.st_dev));
1035} 1034}
1036 1035
1037DEFUN ("file-attributes-lessp", Ffile_attributes_lessp, Sfile_attributes_lessp, 2, 2, 0, 1036DEFUN ("file-attributes-lessp", Ffile_attributes_lessp, Sfile_attributes_lessp, 2, 2, 0,
diff --git a/src/dispnew.c b/src/dispnew.c
index b54ae883649..97c6a446a6b 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5773,6 +5773,15 @@ sit_for (Lisp_Object timeout, bool reading, int display_option)
5773 return Qt; 5773 return Qt;
5774 nsec = 0; 5774 nsec = 0;
5775 } 5775 }
5776 else if (BIGNUMP (timeout))
5777 {
5778 if (!Fnatnump (timeout))
5779 return Qt;
5780 sec = bignum_to_intmax (timeout);
5781 if (sec == 0)
5782 sec = WAIT_READING_MAX;
5783 nsec = 0;
5784 }
5776 else if (FLOATP (timeout)) 5785 else if (FLOATP (timeout))
5777 { 5786 {
5778 double seconds = XFLOAT_DATA (timeout); 5787 double seconds = XFLOAT_DATA (timeout);
diff --git a/src/dosfns.c b/src/dosfns.c
index 25932ff1e1c..c159b260142 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -509,7 +509,7 @@ list_system_processes (void)
509{ 509{
510 Lisp_Object proclist = Qnil; 510 Lisp_Object proclist = Qnil;
511 511
512 proclist = Fcons (make_fixnum_or_float (getpid ()), proclist); 512 proclist = Fcons (INT_TO_INTEGER (getpid ()), proclist);
513 513
514 return proclist; 514 return proclist;
515} 515}
@@ -520,8 +520,8 @@ system_process_attributes (Lisp_Object pid)
520 int proc_id; 520 int proc_id;
521 Lisp_Object attrs = Qnil; 521 Lisp_Object attrs = Qnil;
522 522
523 CHECK_FIXNUM_OR_FLOAT (pid); 523 CHECK_NUMBER (pid);
524 proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XFIXNUM (pid); 524 proc_id = XFLOATINT (pid);
525 525
526 if (proc_id == getpid ()) 526 if (proc_id == getpid ())
527 { 527 {
@@ -539,12 +539,12 @@ system_process_attributes (Lisp_Object pid)
539#endif 539#endif
540 540
541 uid = getuid (); 541 uid = getuid ();
542 attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); 542 attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (uid)), attrs);
543 usr = getlogin (); 543 usr = getlogin ();
544 if (usr) 544 if (usr)
545 attrs = Fcons (Fcons (Quser, build_string (usr)), attrs); 545 attrs = Fcons (Fcons (Quser, build_string (usr)), attrs);
546 gid = getgid (); 546 gid = getgid ();
547 attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); 547 attrs = Fcons (Fcons (Qegid, INT_TO_INTEGER (gid)), attrs);
548 gr = getgrgid (gid); 548 gr = getgrgid (gid);
549 if (gr) 549 if (gr)
550 attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs); 550 attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
@@ -566,7 +566,7 @@ system_process_attributes (Lisp_Object pid)
566 Fsymbol_value (intern ("before-init-time"))), 566 Fsymbol_value (intern ("before-init-time"))),
567 attrs); 567 attrs);
568 attrs = Fcons (Fcons (Qvsize, 568 attrs = Fcons (Fcons (Qvsize,
569 make_fixnum_or_float ((unsigned long)sbrk (0)/1024)), 569 INT_TO_INTEGER ((unsigned long) sbrk (0) / 1024)),
570 attrs); 570 attrs);
571 attrs = Fcons (Fcons (Qetime, tem), attrs); 571 attrs = Fcons (Fcons (Qetime, tem), attrs);
572#ifndef SYSTEM_MALLOC 572#ifndef SYSTEM_MALLOC
diff --git a/src/editfns.c b/src/editfns.c
index 9ca6f373e04..ad5a26606b4 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -329,7 +329,7 @@ init_editfns (bool dumping)
329 else 329 else
330 { 330 {
331 uid_t euid = geteuid (); 331 uid_t euid = geteuid ();
332 tem = make_fixnum_or_float (euid); 332 tem = INT_TO_INTEGER (euid);
333 } 333 }
334 Vuser_full_name = Fuser_full_name (tem); 334 Vuser_full_name = Fuser_full_name (tem);
335 335
@@ -1338,7 +1338,7 @@ This is based on the effective uid, not the real uid.
1338Also, if the environment variables LOGNAME or USER are set, 1338Also, if the environment variables LOGNAME or USER are set,
1339that determines the value of this function. 1339that determines the value of this function.
1340 1340
1341If optional argument UID is an integer or a float, return the login name 1341If optional argument UID is an integer, return the login name
1342of the user with that uid, or nil if there is no such user. */) 1342of the user with that uid, or nil if there is no such user. */)
1343 (Lisp_Object uid) 1343 (Lisp_Object uid)
1344{ 1344{
@@ -1377,39 +1377,35 @@ This ignores the environment variables LOGNAME and USER, so it differs from
1377} 1377}
1378 1378
1379DEFUN ("user-uid", Fuser_uid, Suser_uid, 0, 0, 0, 1379DEFUN ("user-uid", Fuser_uid, Suser_uid, 0, 0, 0,
1380 doc: /* Return the effective uid of Emacs. 1380 doc: /* Return the effective uid of Emacs. */)
1381Value is an integer or a float, depending on the value. */)
1382 (void) 1381 (void)
1383{ 1382{
1384 uid_t euid = geteuid (); 1383 uid_t euid = geteuid ();
1385 return make_fixnum_or_float (euid); 1384 return INT_TO_INTEGER (euid);
1386} 1385}
1387 1386
1388DEFUN ("user-real-uid", Fuser_real_uid, Suser_real_uid, 0, 0, 0, 1387DEFUN ("user-real-uid", Fuser_real_uid, Suser_real_uid, 0, 0, 0,
1389 doc: /* Return the real uid of Emacs. 1388 doc: /* Return the real uid of Emacs. */)
1390Value is an integer or a float, depending on the value. */)
1391 (void) 1389 (void)
1392{ 1390{
1393 uid_t uid = getuid (); 1391 uid_t uid = getuid ();
1394 return make_fixnum_or_float (uid); 1392 return INT_TO_INTEGER (uid);
1395} 1393}
1396 1394
1397DEFUN ("group-gid", Fgroup_gid, Sgroup_gid, 0, 0, 0, 1395DEFUN ("group-gid", Fgroup_gid, Sgroup_gid, 0, 0, 0,
1398 doc: /* Return the effective gid of Emacs. 1396 doc: /* Return the effective gid of Emacs. */)
1399Value is an integer or a float, depending on the value. */)
1400 (void) 1397 (void)
1401{ 1398{
1402 gid_t egid = getegid (); 1399 gid_t egid = getegid ();
1403 return make_fixnum_or_float (egid); 1400 return INT_TO_INTEGER (egid);
1404} 1401}
1405 1402
1406DEFUN ("group-real-gid", Fgroup_real_gid, Sgroup_real_gid, 0, 0, 0, 1403DEFUN ("group-real-gid", Fgroup_real_gid, Sgroup_real_gid, 0, 0, 0,
1407 doc: /* Return the real gid of Emacs. 1404 doc: /* Return the real gid of Emacs. */)
1408Value is an integer or a float, depending on the value. */)
1409 (void) 1405 (void)
1410{ 1406{
1411 gid_t gid = getgid (); 1407 gid_t gid = getgid ();
1412 return make_fixnum_or_float (gid); 1408 return INT_TO_INTEGER (gid);
1413} 1409}
1414 1410
1415DEFUN ("user-full-name", Fuser_full_name, Suser_full_name, 0, 1, 0, 1411DEFUN ("user-full-name", Fuser_full_name, Suser_full_name, 0, 1, 0,
@@ -1417,7 +1413,7 @@ DEFUN ("user-full-name", Fuser_full_name, Suser_full_name, 0, 1, 0,
1417If the full name corresponding to Emacs's userid is not known, 1413If the full name corresponding to Emacs's userid is not known,
1418return "unknown". 1414return "unknown".
1419 1415
1420If optional argument UID is an integer or float, return the full name 1416If optional argument UID is an integer, return the full name
1421of the user with that uid, or nil if there is no such user. 1417of the user with that uid, or nil if there is no such user.
1422If UID is a string, return the full name of the user with that login 1418If UID is a string, return the full name of the user with that login
1423name, or nil if there is no such user. */) 1419name, or nil if there is no such user. */)
@@ -1429,7 +1425,7 @@ name, or nil if there is no such user. */)
1429 1425
1430 if (NILP (uid)) 1426 if (NILP (uid))
1431 return Vuser_full_name; 1427 return Vuser_full_name;
1432 else if (FIXED_OR_FLOATP (uid)) 1428 else if (NUMBERP (uid))
1433 { 1429 {
1434 uid_t u; 1430 uid_t u;
1435 CONS_TO_INTEGER (uid, uid_t, u); 1431 CONS_TO_INTEGER (uid, uid_t, u);
@@ -1489,7 +1485,7 @@ DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0,
1489 (void) 1485 (void)
1490{ 1486{
1491 pid_t pid = getpid (); 1487 pid_t pid = getpid ();
1492 return make_fixnum_or_float (pid); 1488 return INT_TO_INTEGER (pid);
1493} 1489}
1494 1490
1495 1491
diff --git a/src/emacs-module.c b/src/emacs-module.c
index a1bed491b62..cf92b0fdb51 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -646,7 +646,7 @@ check_vec_index (Lisp_Object lvec, ptrdiff_t i)
646{ 646{
647 CHECK_VECTOR (lvec); 647 CHECK_VECTOR (lvec);
648 if (! (0 <= i && i < ASIZE (lvec))) 648 if (! (0 <= i && i < ASIZE (lvec)))
649 args_out_of_range_3 (make_fixnum_or_float (i), 649 args_out_of_range_3 (INT_TO_INTEGER (i),
650 make_fixnum (0), make_fixnum (ASIZE (lvec) - 1)); 650 make_fixnum (0), make_fixnum (ASIZE (lvec) - 1));
651} 651}
652 652
diff --git a/src/fileio.c b/src/fileio.c
index 04e763f83b5..a91bdaa53d1 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3427,6 +3427,13 @@ file_offset (Lisp_Object val)
3427 if (RANGED_FIXNUMP (0, val, TYPE_MAXIMUM (off_t))) 3427 if (RANGED_FIXNUMP (0, val, TYPE_MAXIMUM (off_t)))
3428 return XFIXNUM (val); 3428 return XFIXNUM (val);
3429 3429
3430 if (BIGNUMP (val))
3431 {
3432 intmax_t v = bignum_to_intmax (val);
3433 if (0 < v && v <= TYPE_MAXIMUM (off_t))
3434 return v;
3435 }
3436
3430 if (FLOATP (val)) 3437 if (FLOATP (val))
3431 { 3438 {
3432 double v = XFLOAT_DATA (val); 3439 double v = XFLOAT_DATA (val);
@@ -4946,7 +4953,7 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
4946 fn = SSDATA (encoded_filename); 4953 fn = SSDATA (encoded_filename);
4947 open_flags = O_WRONLY | O_CREAT; 4954 open_flags = O_WRONLY | O_CREAT;
4948 open_flags |= EQ (mustbenew, Qexcl) ? O_EXCL : !NILP (append) ? 0 : O_TRUNC; 4955 open_flags |= EQ (mustbenew, Qexcl) ? O_EXCL : !NILP (append) ? 0 : O_TRUNC;
4949 if (FIXED_OR_FLOATP (append)) 4956 if (NUMBERP (append))
4950 offset = file_offset (append); 4957 offset = file_offset (append);
4951 else if (!NILP (append)) 4958 else if (!NILP (append))
4952 open_flags |= O_APPEND; 4959 open_flags |= O_APPEND;
@@ -4971,7 +4978,7 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
4971 record_unwind_protect_int (close_file_unwind, desc); 4978 record_unwind_protect_int (close_file_unwind, desc);
4972 } 4979 }
4973 4980
4974 if (FIXED_OR_FLOATP (append)) 4981 if (NUMBERP (append))
4975 { 4982 {
4976 off_t ret = lseek (desc, offset, SEEK_SET); 4983 off_t ret = lseek (desc, offset, SEEK_SET);
4977 if (ret < 0) 4984 if (ret < 0)
@@ -5154,7 +5161,7 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
5154 } 5161 }
5155 5162
5156 if (!auto_saving && !noninteractive) 5163 if (!auto_saving && !noninteractive)
5157 message_with_string ((FIXED_OR_FLOATP (append) 5164 message_with_string ((NUMBERP (append)
5158 ? "Updated %s" 5165 ? "Updated %s"
5159 : ! NILP (append) 5166 : ! NILP (append)
5160 ? "Added to %s" 5167 ? "Added to %s"
diff --git a/src/fns.c b/src/fns.c
index 3f7dfeddb6e..17a869e1abc 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -132,14 +132,14 @@ To get the number of bytes, use `string-bytes'. */)
132DEFUN ("safe-length", Fsafe_length, Ssafe_length, 1, 1, 0, 132DEFUN ("safe-length", Fsafe_length, Ssafe_length, 1, 1, 0,
133 doc: /* Return the length of a list, but avoid error or infinite loop. 133 doc: /* Return the length of a list, but avoid error or infinite loop.
134This function never gets an error. If LIST is not really a list, 134This function never gets an error. If LIST is not really a list,
135it returns 0. If LIST is circular, it returns a finite value 135it returns 0. If LIST is circular, it returns an integer that is at
136which is at least the number of distinct elements. */) 136least the number of distinct elements. */)
137 (Lisp_Object list) 137 (Lisp_Object list)
138{ 138{
139 intptr_t len = 0; 139 intptr_t len = 0;
140 FOR_EACH_TAIL_SAFE (list) 140 FOR_EACH_TAIL_SAFE (list)
141 len++; 141 len++;
142 return make_fixnum_or_float (len); 142 return INT_TO_INTEGER (len);
143} 143}
144 144
145DEFUN ("proper-list-p", Fproper_list_p, Sproper_list_p, 1, 1, 0, 145DEFUN ("proper-list-p", Fproper_list_p, Sproper_list_p, 1, 1, 0,
diff --git a/src/font.c b/src/font.c
index 920ec1e02b1..4a63700f790 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1283,19 +1283,20 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
1283 } 1283 }
1284 1284
1285 val = AREF (font, FONT_SIZE_INDEX); 1285 val = AREF (font, FONT_SIZE_INDEX);
1286 eassert (FIXED_OR_FLOATP (val) || NILP (val)); 1286 eassert (NUMBERP (val) || NILP (val));
1287 char font_size_index_buf[sizeof "-*" 1287 char font_size_index_buf[sizeof "-*"
1288 + max (INT_STRLEN_BOUND (EMACS_INT), 1288 + max (INT_STRLEN_BOUND (EMACS_INT),
1289 1 + DBL_MAX_10_EXP + 1)]; 1289 1 + DBL_MAX_10_EXP + 1)];
1290 if (FIXNUMP (val)) 1290 if (INTEGERP (val))
1291 { 1291 {
1292 EMACS_INT v = XFIXNUM (val); 1292 intmax_t v = FIXNUMP (val) ? XFIXNUM (val) : bignum_to_intmax (val);
1293 if (v <= 0) 1293 if (! (0 <= v && v <= TYPE_MAXIMUM (uprintmax_t)))
1294 v = pixel_size; 1294 v = pixel_size;
1295 if (v > 0) 1295 if (v > 0)
1296 { 1296 {
1297 uprintmax_t u = v;
1297 f[XLFD_PIXEL_INDEX] = p = font_size_index_buf; 1298 f[XLFD_PIXEL_INDEX] = p = font_size_index_buf;
1298 sprintf (p, "%"pI"d-*", v); 1299 sprintf (p, "%"pMu"-*", u);
1299 } 1300 }
1300 else 1301 else
1301 f[XLFD_PIXEL_INDEX] = "*-*"; 1302 f[XLFD_PIXEL_INDEX] = "*-*";
@@ -3324,8 +3325,9 @@ font_open_for_lface (struct frame *f, Lisp_Object entity, Lisp_Object *attrs, Li
3324 if (size == 0) 3325 if (size == 0)
3325 { 3326 {
3326 Lisp_Object ffsize = get_frame_param (f, Qfontsize); 3327 Lisp_Object ffsize = get_frame_param (f, Qfontsize);
3327 size = (FIXED_OR_FLOATP (ffsize) 3328 size = (NUMBERP (ffsize)
3328 ? POINT_TO_PIXEL (XFIXNUM (ffsize), FRAME_RES_Y (f)) : 0); 3329 ? POINT_TO_PIXEL (XFLOATINT (ffsize), FRAME_RES_Y (f))
3330 : 0);
3329 } 3331 }
3330#endif 3332#endif
3331 } 3333 }
@@ -4503,7 +4505,7 @@ where
4503 if (variations[i]) 4505 if (variations[i])
4504 { 4506 {
4505 int vs = (i < 16 ? 0xFE00 + i : 0xE0100 + (i - 16)); 4507 int vs = (i < 16 ? 0xFE00 + i : 0xE0100 + (i - 16));
4506 Lisp_Object code = INTEGER_TO_CONS (variations[i]); 4508 Lisp_Object code = INT_TO_INTEGER (variations[i]);
4507 val = Fcons (Fcons (make_fixnum (vs), code), val); 4509 val = Fcons (Fcons (make_fixnum (vs), code), val);
4508 } 4510 }
4509 return val; 4511 return val;
@@ -4606,7 +4608,7 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
4606 return Qnil; 4608 return Qnil;
4607 Lisp_Object font_object; 4609 Lisp_Object font_object;
4608 XSETFONT (font_object, face->font); 4610 XSETFONT (font_object, face->font);
4609 return Fcons (font_object, INTEGER_TO_CONS (code)); 4611 return Fcons (font_object, INT_TO_INTEGER (code));
4610} 4612}
4611 4613
4612#if 0 4614#if 0
@@ -4735,7 +4737,7 @@ DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0,
4735 doc: /* Open FONT-ENTITY. */) 4737 doc: /* Open FONT-ENTITY. */)
4736 (Lisp_Object font_entity, Lisp_Object size, Lisp_Object frame) 4738 (Lisp_Object font_entity, Lisp_Object size, Lisp_Object frame)
4737{ 4739{
4738 EMACS_INT isize; 4740 intmax_t isize;
4739 struct frame *f = decode_live_frame (frame); 4741 struct frame *f = decode_live_frame (frame);
4740 4742
4741 CHECK_FONT_ENTITY (font_entity); 4743 CHECK_FONT_ENTITY (font_entity);
@@ -4744,11 +4746,17 @@ DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0,
4744 isize = XFIXNUM (AREF (font_entity, FONT_SIZE_INDEX)); 4746 isize = XFIXNUM (AREF (font_entity, FONT_SIZE_INDEX));
4745 else 4747 else
4746 { 4748 {
4747 CHECK_FIXNUM_OR_FLOAT (size); 4749 CHECK_NUMBER (size);
4748 if (FLOATP (size)) 4750 if (BIGNUMP (size))
4749 isize = POINT_TO_PIXEL (XFLOAT_DATA (size), FRAME_RES_Y (f)); 4751 {
4752 isize = bignum_to_intmax (size);
4753 if (isize == 0)
4754 args_out_of_range (font_entity, size);
4755 }
4750 else 4756 else
4751 isize = XFIXNUM (size); 4757 isize = (FLOATP (size)
4758 ? POINT_TO_PIXEL (XFLOAT_DATA (size), FRAME_RES_Y (f))
4759 : XFIXNUM (size));
4752 if (! (INT_MIN <= isize && isize <= INT_MAX)) 4760 if (! (INT_MIN <= isize && isize <= INT_MAX))
4753 args_out_of_range (font_entity, size); 4761 args_out_of_range (font_entity, size);
4754 if (isize == 0) 4762 if (isize == 0)
diff --git a/src/frame.c b/src/frame.c
index ece8971d5b6..4371ef7f064 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -350,9 +350,13 @@ frame_windows_min_size (Lisp_Object frame, Lisp_Object horizontal,
350 int retval; 350 int retval;
351 351
352 if ((!NILP (horizontal) 352 if ((!NILP (horizontal)
353 && FIXED_OR_FLOATP (par_size = get_frame_param (f, Qmin_width))) 353 && RANGED_FIXNUMP (INT_MIN,
354 par_size = get_frame_param (f, Qmin_width),
355 INT_MAX))
354 || (NILP (horizontal) 356 || (NILP (horizontal)
355 && FIXED_OR_FLOATP (par_size = get_frame_param (f, Qmin_height)))) 357 && RANGED_FIXNUMP (INT_MIN,
358 par_size = get_frame_param (f, Qmin_height),
359 INT_MAX)))
356 { 360 {
357 int min_size = XFIXNUM (par_size); 361 int min_size = XFIXNUM (par_size);
358 362
@@ -3974,8 +3978,8 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist)
3974 3978
3975 if ((!NILP (left) || !NILP (top)) 3979 if ((!NILP (left) || !NILP (top))
3976 && ! (left_no_change && top_no_change) 3980 && ! (left_no_change && top_no_change)
3977 && ! (FIXED_OR_FLOATP (left) && XFIXNUM (left) == f->left_pos 3981 && ! (FIXNUMP (left) && XFIXNUM (left) == f->left_pos
3978 && FIXED_OR_FLOATP (top) && XFIXNUM (top) == f->top_pos)) 3982 && FIXNUMP (top) && XFIXNUM (top) == f->top_pos))
3979 { 3983 {
3980 int leftpos = 0; 3984 int leftpos = 0;
3981 int toppos = 0; 3985 int toppos = 0;
@@ -4208,7 +4212,7 @@ x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
4208 4212
4209 if (NILP (new_value)) 4213 if (NILP (new_value))
4210 f->gamma = 0; 4214 f->gamma = 0;
4211 else if (FIXED_OR_FLOATP (new_value) && XFLOATINT (new_value) > 0) 4215 else if (NUMBERP (new_value) && XFLOATINT (new_value) > 0)
4212 /* The value 0.4545 is the normal viewing gamma. */ 4216 /* The value 0.4545 is the normal viewing gamma. */
4213 f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value)); 4217 f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value));
4214 else 4218 else
diff --git a/src/frame.h b/src/frame.h
index 87d0d5a3411..a3bb633e57a 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -699,7 +699,7 @@ fset_desired_tool_bar_string (struct frame *f, Lisp_Object val)
699INLINE double 699INLINE double
700NUMVAL (Lisp_Object x) 700NUMVAL (Lisp_Object x)
701{ 701{
702 return FIXED_OR_FLOATP (x) ? XFLOATINT (x) : -1; 702 return NUMBERP (x) ? XFLOATINT (x) : -1;
703} 703}
704 704
705INLINE double 705INLINE double
@@ -1360,17 +1360,13 @@ FRAME_BOTTOM_DIVIDER_WIDTH (struct frame *f)
1360 canonical char width is to be used. X must be a Lisp integer or 1360 canonical char width is to be used. X must be a Lisp integer or
1361 float. Value is a C integer. */ 1361 float. Value is a C integer. */
1362#define FRAME_PIXEL_X_FROM_CANON_X(F, X) \ 1362#define FRAME_PIXEL_X_FROM_CANON_X(F, X) \
1363 (FIXNUMP (X) \ 1363 ((int) (XFLOATINT (X) * FRAME_COLUMN_WIDTH (F)))
1364 ? XFIXNUM (X) * FRAME_COLUMN_WIDTH (F) \
1365 : (int) (XFLOAT_DATA (X) * FRAME_COLUMN_WIDTH (F)))
1366 1364
1367/* Convert canonical value Y to pixels. F is the frame whose 1365/* Convert canonical value Y to pixels. F is the frame whose
1368 canonical character height is to be used. X must be a Lisp integer 1366 canonical character height is to be used. X must be a Lisp integer
1369 or float. Value is a C integer. */ 1367 or float. Value is a C integer. */
1370#define FRAME_PIXEL_Y_FROM_CANON_Y(F, Y) \ 1368#define FRAME_PIXEL_Y_FROM_CANON_Y(F, Y) \
1371 (FIXNUMP (Y) \ 1369 ((int) (XFLOATINT (Y) * FRAME_LINE_HEIGHT (F)))
1372 ? XFIXNUM (Y) * FRAME_LINE_HEIGHT (F) \
1373 : (int) (XFLOAT_DATA (Y) * FRAME_LINE_HEIGHT (F)))
1374 1370
1375/* Convert pixel-value X to canonical units. F is the frame whose 1371/* Convert pixel-value X to canonical units. F is the frame whose
1376 canonical character width is to be used. X is a C integer. Result 1372 canonical character width is to be used. X is a C integer. Result
diff --git a/src/fringe.c b/src/fringe.c
index 583bba4e510..6a44de1bf24 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1605,7 +1605,7 @@ If BITMAP already exists, the existing definition is replaced. */)
1605 for (i = 0; i < h && j < fb.height; i++) 1605 for (i = 0; i < h && j < fb.height; i++)
1606 { 1606 {
1607 Lisp_Object elt = Faref (bits, make_fixnum (i)); 1607 Lisp_Object elt = Faref (bits, make_fixnum (i));
1608 b[j++] = FIXED_OR_FLOATP (elt) ? XFIXNUM (elt) : 0; 1608 b[j++] = FIXNUMP (elt) ? XFIXNUM (elt) : 0;
1609 } 1609 }
1610 for (i = 0; i < fill2 && j < fb.height; i++) 1610 for (i = 0; i < fill2 && j < fb.height; i++)
1611 b[j++] = 0; 1611 b[j++] = 0;
diff --git a/src/gnutls.c b/src/gnutls.c
index aa5c97532f0..a48d99832ad 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -924,7 +924,7 @@ Usage: (gnutls-error-fatalp ERROR) */)
924 if (SYMBOLP (err)) 924 if (SYMBOLP (err))
925 { 925 {
926 code = Fget (err, Qgnutls_code); 926 code = Fget (err, Qgnutls_code);
927 if (FIXED_OR_FLOATP (code)) 927 if (NUMBERP (code))
928 { 928 {
929 err = code; 929 err = code;
930 } 930 }
@@ -956,7 +956,7 @@ usage: (gnutls-error-string ERROR) */)
956 if (SYMBOLP (err)) 956 if (SYMBOLP (err))
957 { 957 {
958 code = Fget (err, Qgnutls_code); 958 code = Fget (err, Qgnutls_code);
959 if (FIXED_OR_FLOATP (code)) 959 if (NUMBERP (code))
960 { 960 {
961 err = code; 961 err = code;
962 } 962 }
diff --git a/src/image.c b/src/image.c
index 36a909ba053..69aeab5d657 100644
--- a/src/image.c
+++ b/src/image.c
@@ -800,7 +800,7 @@ parse_image_spec (Lisp_Object spec, struct image_keyword *keywords,
800 return 0; 800 return 0;
801 801
802 case IMAGE_NUMBER_VALUE: 802 case IMAGE_NUMBER_VALUE:
803 if (! FIXED_OR_FLOATP (value)) 803 if (! NUMBERP (value))
804 return 0; 804 return 0;
805 break; 805 break;
806 806
@@ -4929,20 +4929,20 @@ x_edge_detection (struct frame *f, struct image *img, Lisp_Object matrix,
4929 if (CONSP (matrix)) 4929 if (CONSP (matrix))
4930 { 4930 {
4931 for (i = 0; 4931 for (i = 0;
4932 i < 9 && CONSP (matrix) && FIXED_OR_FLOATP (XCAR (matrix)); 4932 i < 9 && CONSP (matrix) && NUMBERP (XCAR (matrix));
4933 ++i, matrix = XCDR (matrix)) 4933 ++i, matrix = XCDR (matrix))
4934 trans[i] = XFLOATINT (XCAR (matrix)); 4934 trans[i] = XFLOATINT (XCAR (matrix));
4935 } 4935 }
4936 else if (VECTORP (matrix) && ASIZE (matrix) >= 9) 4936 else if (VECTORP (matrix) && ASIZE (matrix) >= 9)
4937 { 4937 {
4938 for (i = 0; i < 9 && FIXED_OR_FLOATP (AREF (matrix, i)); ++i) 4938 for (i = 0; i < 9 && NUMBERP (AREF (matrix, i)); ++i)
4939 trans[i] = XFLOATINT (AREF (matrix, i)); 4939 trans[i] = XFLOATINT (AREF (matrix, i));
4940 } 4940 }
4941 4941
4942 if (NILP (color_adjust)) 4942 if (NILP (color_adjust))
4943 color_adjust = make_fixnum (0xffff / 2); 4943 color_adjust = make_fixnum (0xffff / 2);
4944 4944
4945 if (i == 9 && FIXED_OR_FLOATP (color_adjust)) 4945 if (i == 9 && NUMBERP (color_adjust))
4946 x_detect_edges (f, img, trans, XFLOATINT (color_adjust)); 4946 x_detect_edges (f, img, trans, XFLOATINT (color_adjust));
4947} 4947}
4948 4948
@@ -8103,7 +8103,7 @@ compute_image_size (size_t width, size_t height,
8103 double scale = 1; 8103 double scale = 1;
8104 8104
8105 value = image_spec_value (spec, QCscale, NULL); 8105 value = image_spec_value (spec, QCscale, NULL);
8106 if (FIXED_OR_FLOATP (value)) 8106 if (NUMBERP (value))
8107 scale = XFLOATINT (value); 8107 scale = XFLOATINT (value);
8108 8108
8109 value = image_spec_value (spec, QCmax_width, NULL); 8109 value = image_spec_value (spec, QCmax_width, NULL);
diff --git a/src/inotify.c b/src/inotify.c
index 9e76060ee9d..6e54c185c58 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -190,10 +190,10 @@ inotifyevent_to_event (Lisp_Object watch, struct inotify_event const *ev)
190 else 190 else
191 name = XCAR (XCDR (watch)); 191 name = XCAR (XCDR (watch));
192 192
193 return list2 (list4 (Fcons (INTEGER_TO_CONS (ev->wd), XCAR (watch)), 193 return list2 (list4 (Fcons (INT_TO_INTEGER (ev->wd), XCAR (watch)),
194 mask_to_aspects (ev->mask), 194 mask_to_aspects (ev->mask),
195 name, 195 name,
196 INTEGER_TO_CONS (ev->cookie)), 196 INT_TO_INTEGER (ev->cookie)),
197 Fnth (make_fixnum (2), watch)); 197 Fnth (make_fixnum (2), watch));
198} 198}
199 199
@@ -204,10 +204,10 @@ static Lisp_Object
204add_watch (int wd, Lisp_Object filename, 204add_watch (int wd, Lisp_Object filename,
205 uint32_t imask, Lisp_Object callback) 205 uint32_t imask, Lisp_Object callback)
206{ 206{
207 Lisp_Object descriptor = INTEGER_TO_CONS (wd); 207 Lisp_Object descriptor = INT_TO_INTEGER (wd);
208 Lisp_Object tail = assoc_no_quit (descriptor, watch_list); 208 Lisp_Object tail = assoc_no_quit (descriptor, watch_list);
209 Lisp_Object watch, watch_id; 209 Lisp_Object watch, watch_id;
210 Lisp_Object mask = INTEGER_TO_CONS (imask); 210 Lisp_Object mask = INT_TO_INTEGER (imask);
211 211
212 EMACS_INT id = 0; 212 EMACS_INT id = 0;
213 if (NILP (tail)) 213 if (NILP (tail))
@@ -332,7 +332,7 @@ inotify_callback (int fd, void *_)
332 for (ssize_t i = 0; i < n; ) 332 for (ssize_t i = 0; i < n; )
333 { 333 {
334 struct inotify_event *ev = (struct inotify_event *) &buffer[i]; 334 struct inotify_event *ev = (struct inotify_event *) &buffer[i];
335 Lisp_Object descriptor = INTEGER_TO_CONS (ev->wd); 335 Lisp_Object descriptor = INT_TO_INTEGER (ev->wd);
336 Lisp_Object prevtail = find_descriptor (descriptor); 336 Lisp_Object prevtail = find_descriptor (descriptor);
337 337
338 if (! NILP (prevtail)) 338 if (! NILP (prevtail))
diff --git a/src/json.c b/src/json.c
index d525d1b7577..976783d785c 100644
--- a/src/json.c
+++ b/src/json.c
@@ -721,14 +721,10 @@ json_to_lisp (json_t *json, struct json_configuration *conf)
721 case JSON_TRUE: 721 case JSON_TRUE:
722 return Qt; 722 return Qt;
723 case JSON_INTEGER: 723 case JSON_INTEGER:
724 /* Return an integer if possible, a floating-point number 724 {
725 otherwise. This loses precision for integers with large 725 json_int_t i = json_integer_value (json);
726 magnitude; however, such integers tend to be nonportable 726 return INT_TO_INTEGER (i);
727 anyway because many JSON implementations use only 64-bit 727 }
728 floating-point numbers with 53 mantissa bits. See
729 https://tools.ietf.org/html/rfc7159#section-6 for some
730 discussion. */
731 return make_fixnum_or_float (json_integer_value (json));
732 case JSON_REAL: 728 case JSON_REAL:
733 return make_float (json_real_value (json)); 729 return make_float (json_real_value (json));
734 case JSON_STRING: 730 case JSON_STRING:
diff --git a/src/keyboard.c b/src/keyboard.c
index 0b38e0987a3..7fafb41fcc5 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1298,7 +1298,7 @@ command_loop_1 (void)
1298 if (minibuf_level 1298 if (minibuf_level
1299 && !NILP (echo_area_buffer[0]) 1299 && !NILP (echo_area_buffer[0])
1300 && EQ (minibuf_window, echo_area_window) 1300 && EQ (minibuf_window, echo_area_window)
1301 && FIXED_OR_FLOATP (Vminibuffer_message_timeout)) 1301 && NUMBERP (Vminibuffer_message_timeout))
1302 { 1302 {
1303 /* Bind inhibit-quit to t so that C-g gets read in 1303 /* Bind inhibit-quit to t so that C-g gets read in
1304 rather than quitting back to the minibuffer. */ 1304 rather than quitting back to the minibuffer. */
@@ -5834,7 +5834,7 @@ make_lispy_event (struct input_event *event)
5834 ASIZE (wheel_syms)); 5834 ASIZE (wheel_syms));
5835 } 5835 }
5836 5836
5837 if (FIXED_OR_FLOATP (event->arg)) 5837 if (NUMBERP (event->arg))
5838 return list4 (head, position, make_fixnum (double_click_count), 5838 return list4 (head, position, make_fixnum (double_click_count),
5839 event->arg); 5839 event->arg);
5840 else if (event->modifiers & (double_modifier | triple_modifier)) 5840 else if (event->modifiers & (double_modifier | triple_modifier))
diff --git a/src/lcms.c b/src/lcms.c
index f37f843e500..d5cfafa60a6 100644
--- a/src/lcms.c
+++ b/src/lcms.c
@@ -93,7 +93,7 @@ static bool
93parse_lab_list (Lisp_Object lab_list, cmsCIELab *color) 93parse_lab_list (Lisp_Object lab_list, cmsCIELab *color)
94{ 94{
95#define PARSE_LAB_LIST_FIELD(field) \ 95#define PARSE_LAB_LIST_FIELD(field) \
96 if (CONSP (lab_list) && FIXED_OR_FLOATP (XCAR (lab_list))) \ 96 if (CONSP (lab_list) && NUMBERP (XCAR (lab_list))) \
97 { \ 97 { \
98 color->field = XFLOATINT (XCAR (lab_list)); \ 98 color->field = XFLOATINT (XCAR (lab_list)); \
99 lab_list = XCDR (lab_list); \ 99 lab_list = XCDR (lab_list); \
@@ -138,15 +138,15 @@ chroma, and hue, respectively. The parameters each default to 1. */)
138 signal_error ("Invalid color", color1); 138 signal_error ("Invalid color", color1);
139 if (NILP (kL)) 139 if (NILP (kL))
140 Kl = 1.0f; 140 Kl = 1.0f;
141 else if (!(FIXED_OR_FLOATP (kL) && (Kl = XFLOATINT(kL)))) 141 else if (!(NUMBERP (kL) && (Kl = XFLOATINT(kL))))
142 wrong_type_argument(Qnumberp, kL); 142 wrong_type_argument(Qnumberp, kL);
143 if (NILP (kC)) 143 if (NILP (kC))
144 Kc = 1.0f; 144 Kc = 1.0f;
145 else if (!(FIXED_OR_FLOATP (kC) && (Kc = XFLOATINT(kC)))) 145 else if (!(NUMBERP (kC) && (Kc = XFLOATINT(kC))))
146 wrong_type_argument(Qnumberp, kC); 146 wrong_type_argument(Qnumberp, kC);
147 if (NILP (kL)) 147 if (NILP (kL))
148 Kh = 1.0f; 148 Kh = 1.0f;
149 else if (!(FIXED_OR_FLOATP (kH) && (Kh = XFLOATINT(kH)))) 149 else if (!(NUMBERP (kH) && (Kh = XFLOATINT(kH))))
150 wrong_type_argument(Qnumberp, kH); 150 wrong_type_argument(Qnumberp, kH);
151 151
152 return make_float (cmsCIE2000DeltaE (&Lab1, &Lab2, Kl, Kc, Kh)); 152 return make_float (cmsCIE2000DeltaE (&Lab1, &Lab2, Kl, Kc, Kh));
@@ -184,7 +184,7 @@ static bool
184parse_xyz_list (Lisp_Object xyz_list, cmsCIEXYZ *color) 184parse_xyz_list (Lisp_Object xyz_list, cmsCIEXYZ *color)
185{ 185{
186#define PARSE_XYZ_LIST_FIELD(field) \ 186#define PARSE_XYZ_LIST_FIELD(field) \
187 if (CONSP (xyz_list) && FIXED_OR_FLOATP (XCAR (xyz_list))) \ 187 if (CONSP (xyz_list) && NUMBERP (XCAR (xyz_list))) \
188 { \ 188 { \
189 color->field = 100.0 * XFLOATINT (XCAR (xyz_list)); \ 189 color->field = 100.0 * XFLOATINT (XCAR (xyz_list)); \
190 xyz_list = XCDR (xyz_list); \ 190 xyz_list = XCDR (xyz_list); \
@@ -203,7 +203,7 @@ static bool
203parse_jch_list (Lisp_Object jch_list, cmsJCh *color) 203parse_jch_list (Lisp_Object jch_list, cmsJCh *color)
204{ 204{
205#define PARSE_JCH_LIST_FIELD(field) \ 205#define PARSE_JCH_LIST_FIELD(field) \
206 if (CONSP (jch_list) && FIXED_OR_FLOATP (XCAR (jch_list))) \ 206 if (CONSP (jch_list) && NUMBERP (XCAR (jch_list))) \
207 { \ 207 { \
208 color->field = XFLOATINT (XCAR (jch_list)); \ 208 color->field = XFLOATINT (XCAR (jch_list)); \
209 jch_list = XCDR (jch_list); \ 209 jch_list = XCDR (jch_list); \
@@ -224,7 +224,7 @@ static bool
224parse_jab_list (Lisp_Object jab_list, lcmsJab_t *color) 224parse_jab_list (Lisp_Object jab_list, lcmsJab_t *color)
225{ 225{
226#define PARSE_JAB_LIST_FIELD(field) \ 226#define PARSE_JAB_LIST_FIELD(field) \
227 if (CONSP (jab_list) && FIXED_OR_FLOATP (XCAR (jab_list))) \ 227 if (CONSP (jab_list) && NUMBERP (XCAR (jab_list))) \
228 { \ 228 { \
229 color->field = XFLOATINT (XCAR (jab_list)); \ 229 color->field = XFLOATINT (XCAR (jab_list)); \
230 jab_list = XCDR (jab_list); \ 230 jab_list = XCDR (jab_list); \
@@ -244,7 +244,7 @@ parse_viewing_conditions (Lisp_Object view, const cmsCIEXYZ *wp,
244 cmsViewingConditions *vc) 244 cmsViewingConditions *vc)
245{ 245{
246#define PARSE_VIEW_CONDITION_FLOAT(field) \ 246#define PARSE_VIEW_CONDITION_FLOAT(field) \
247 if (CONSP (view) && FIXED_OR_FLOATP (XCAR (view))) \ 247 if (CONSP (view) && NUMBERP (XCAR (view))) \
248 { \ 248 { \
249 vc->field = XFLOATINT (XCAR (view)); \ 249 vc->field = XFLOATINT (XCAR (view)); \
250 view = XCDR (view); \ 250 view = XCDR (view); \
@@ -555,7 +555,7 @@ Valid range of TEMPERATURE is from 4000K to 25000K. */)
555 } 555 }
556#endif 556#endif
557 557
558 CHECK_FIXNUM_OR_FLOAT (temperature); 558 CHECK_NUMBER (temperature);
559 559
560 tempK = XFLOATINT (temperature); 560 tempK = XFLOATINT (temperature);
561 if (!(cmsWhitePointFromTemp (&whitepoint, tempK))) 561 if (!(cmsWhitePointFromTemp (&whitepoint, tempK)))
diff --git a/src/lisp.h b/src/lisp.h
index 555496bc271..c5b51ba3b35 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -586,6 +586,7 @@ INLINE void set_sub_char_table_contents (Lisp_Object, ptrdiff_t,
586/* Defined in bignum.c. */ 586/* Defined in bignum.c. */
587extern double bignum_to_double (Lisp_Object); 587extern double bignum_to_double (Lisp_Object);
588extern Lisp_Object make_bigint (intmax_t); 588extern Lisp_Object make_bigint (intmax_t);
589extern Lisp_Object make_biguint (uintmax_t);
589 590
590/* Defined in chartab.c. */ 591/* Defined in chartab.c. */
591extern Lisp_Object char_table_ref (Lisp_Object, int); 592extern Lisp_Object char_table_ref (Lisp_Object, int);
@@ -2468,6 +2469,15 @@ make_int (intmax_t n)
2468{ 2469{
2469 return FIXNUM_OVERFLOW_P (n) ? make_bigint (n) : make_fixnum (n); 2470 return FIXNUM_OVERFLOW_P (n) ? make_bigint (n) : make_fixnum (n);
2470} 2471}
2472INLINE Lisp_Object
2473make_uint (uintmax_t n)
2474{
2475 return FIXNUM_OVERFLOW_P (n) ? make_biguint (n) : make_fixnum (n);
2476}
2477
2478/* Return a Lisp integer equal to the value of the C integer EXPR. */
2479#define INT_TO_INTEGER(expr) \
2480 (EXPR_SIGNED (expr) ? make_int (expr) : make_uint (expr))
2471 2481
2472 2482
2473/* Forwarding pointer to an int variable. 2483/* Forwarding pointer to an int variable.
@@ -2672,11 +2682,6 @@ enum char_bits
2672/* Data type checking. */ 2682/* Data type checking. */
2673 2683
2674INLINE bool 2684INLINE bool
2675FIXED_OR_FLOATP (Lisp_Object x)
2676{
2677 return FIXNUMP (x) || FLOATP (x);
2678}
2679INLINE bool
2680FIXNATP (Lisp_Object x) 2685FIXNATP (Lisp_Object x)
2681{ 2686{
2682 return FIXNUMP (x) && 0 <= XFIXNUM (x); 2687 return FIXNUMP (x) && 0 <= XFIXNUM (x);
@@ -2831,12 +2836,6 @@ XFLOATINT (Lisp_Object n)
2831} 2836}
2832 2837
2833INLINE void 2838INLINE void
2834CHECK_FIXNUM_OR_FLOAT (Lisp_Object x)
2835{
2836 CHECK_TYPE (FIXED_OR_FLOATP (x), Qnumberp, x);
2837}
2838
2839INLINE void
2840CHECK_NUMBER (Lisp_Object x) 2839CHECK_NUMBER (Lisp_Object x)
2841{ 2840{
2842 CHECK_TYPE (NUMBERP (x), Qnumberp, x); 2841 CHECK_TYPE (NUMBERP (x), Qnumberp, x);
@@ -2848,14 +2847,6 @@ CHECK_INTEGER (Lisp_Object x)
2848 CHECK_TYPE (INTEGERP (x), Qnumberp, x); 2847 CHECK_TYPE (INTEGERP (x), Qnumberp, x);
2849} 2848}
2850 2849
2851#define CHECK_FIXNUM_OR_FLOAT_COERCE_MARKER(x) \
2852 do { \
2853 if (MARKERP (x)) \
2854 XSETFASTINT (x, marker_position (x)); \
2855 else \
2856 CHECK_TYPE (FIXED_OR_FLOATP (x), Qnumber_or_marker_p, x); \
2857 } while (false)
2858
2859#define CHECK_NUMBER_COERCE_MARKER(x) \ 2850#define CHECK_NUMBER_COERCE_MARKER(x) \
2860 do { \ 2851 do { \
2861 if (MARKERP (x)) \ 2852 if (MARKERP (x)) \
@@ -3288,6 +3279,8 @@ set_sub_char_table_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val)
3288} 3279}
3289 3280
3290/* Defined in bignum.c. */ 3281/* Defined in bignum.c. */
3282extern intmax_t bignum_to_intmax (Lisp_Object);
3283extern uintmax_t bignum_to_uintmax (Lisp_Object);
3291extern Lisp_Object bignum_to_string (Lisp_Object, int); 3284extern Lisp_Object bignum_to_string (Lisp_Object, int);
3292extern Lisp_Object make_bignum_str (char const *, int); 3285extern Lisp_Object make_bignum_str (char const *, int);
3293extern Lisp_Object double_to_bignum (double); 3286extern Lisp_Object double_to_bignum (double);
@@ -3309,16 +3302,6 @@ enum Arith_Comparison {
3309extern Lisp_Object arithcompare (Lisp_Object num1, Lisp_Object num2, 3302extern Lisp_Object arithcompare (Lisp_Object num1, Lisp_Object num2,
3310 enum Arith_Comparison comparison); 3303 enum Arith_Comparison comparison);
3311 3304
3312/* Convert the integer I to an Emacs representation, either the integer
3313 itself, or a cons of two or three integers, or if all else fails a float.
3314 I should not have side effects. */
3315#define INTEGER_TO_CONS(i) \
3316 (! FIXNUM_OVERFLOW_P (i) \
3317 ? make_fixnum (i) \
3318 : EXPR_SIGNED (i) ? intbig_to_lisp (i) : uintbig_to_lisp (i))
3319extern Lisp_Object intbig_to_lisp (intmax_t);
3320extern Lisp_Object uintbig_to_lisp (uintmax_t);
3321
3322/* Convert the Emacs representation CONS back to an integer of type 3305/* Convert the Emacs representation CONS back to an integer of type
3323 TYPE, storing the result the variable VAR. Signal an error if CONS 3306 TYPE, storing the result the variable VAR. Signal an error if CONS
3324 is not a valid representation or is out of range for TYPE. */ 3307 is not a valid representation or is out of range for TYPE. */
@@ -4473,12 +4456,6 @@ extern void init_system_name (void);
4473 because 'abs' is reserved by the C standard. */ 4456 because 'abs' is reserved by the C standard. */
4474#define eabs(x) ((x) < 0 ? -(x) : (x)) 4457#define eabs(x) ((x) < 0 ? -(x) : (x))
4475 4458
4476/* Return a fixnum or float, depending on whether the integer VAL fits
4477 in a Lisp fixnum. */
4478
4479#define make_fixnum_or_float(val) \
4480 (FIXNUM_OVERFLOW_P (val) ? make_float (val) : make_fixnum (val))
4481
4482/* SAFE_ALLOCA normally allocates memory on the stack, but if size is 4459/* SAFE_ALLOCA normally allocates memory on the stack, but if size is
4483 larger than MAX_ALLOCA, use xmalloc to avoid overflowing the stack. */ 4460 larger than MAX_ALLOCA, use xmalloc to avoid overflowing the stack. */
4484 4461
diff --git a/src/lread.c b/src/lread.c
index 5e1bd419fa4..a7c5b0bb69c 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -665,7 +665,7 @@ read_filtered_event (bool no_switch_frame, bool ascii_required,
665 delayed_switch_frame = Qnil; 665 delayed_switch_frame = Qnil;
666 666
667 /* Compute timeout. */ 667 /* Compute timeout. */
668 if (FIXED_OR_FLOATP (seconds)) 668 if (NUMBERP (seconds))
669 { 669 {
670 double duration = XFLOATINT (seconds); 670 double duration = XFLOATINT (seconds);
671 struct timespec wait_time = dtotimespec (duration); 671 struct timespec wait_time = dtotimespec (duration);
@@ -676,7 +676,7 @@ read_filtered_event (bool no_switch_frame, bool ascii_required,
676 retry: 676 retry:
677 do 677 do
678 val = read_char (0, Qnil, (input_method ? Qnil : Qt), 0, 678 val = read_char (0, Qnil, (input_method ? Qnil : Qt), 0,
679 FIXED_OR_FLOATP (seconds) ? &end_time : NULL); 679 NUMBERP (seconds) ? &end_time : NULL);
680 while (FIXNUMP (val) && XFIXNUM (val) == -2); /* wrong_kboard_jmpbuf */ 680 while (FIXNUMP (val) && XFIXNUM (val) == -2); /* wrong_kboard_jmpbuf */
681 681
682 if (BUFFERP (val)) 682 if (BUFFERP (val))
@@ -695,7 +695,7 @@ read_filtered_event (bool no_switch_frame, bool ascii_required,
695 goto retry; 695 goto retry;
696 } 696 }
697 697
698 if (ascii_required && !(FIXED_OR_FLOATP (seconds) && NILP (val))) 698 if (ascii_required && !(NUMBERP (seconds) && NILP (val)))
699 { 699 {
700 /* Convert certain symbols to their ASCII equivalents. */ 700 /* Convert certain symbols to their ASCII equivalents. */
701 if (SYMBOLP (val)) 701 if (SYMBOLP (val))
@@ -3161,7 +3161,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
3161 /* If it can be recursive, remember it for 3161 /* If it can be recursive, remember it for
3162 future substitutions. */ 3162 future substitutions. */
3163 if (! SYMBOLP (tem) 3163 if (! SYMBOLP (tem)
3164 && ! FIXED_OR_FLOATP (tem) 3164 && ! NUMBERP (tem)
3165 && ! (STRINGP (tem) && !string_intervals (tem))) 3165 && ! (STRINGP (tem) && !string_intervals (tem)))
3166 { 3166 {
3167 struct Lisp_Hash_Table *h2 3167 struct Lisp_Hash_Table *h2
@@ -3616,7 +3616,7 @@ substitute_object_recurse (struct subst *subst, Lisp_Object subtree)
3616 bother looking them up; we're done. */ 3616 bother looking them up; we're done. */
3617 if (SYMBOLP (subtree) 3617 if (SYMBOLP (subtree)
3618 || (STRINGP (subtree) && !string_intervals (subtree)) 3618 || (STRINGP (subtree) && !string_intervals (subtree))
3619 || FIXED_OR_FLOATP (subtree)) 3619 || NUMBERP (subtree))
3620 return subtree; 3620 return subtree;
3621 3621
3622 /* If we've been to this node before, don't explore it again. */ 3622 /* If we've been to this node before, don't explore it again. */
diff --git a/src/nsfns.m b/src/nsfns.m
index ece21c69bfe..659bce8fc57 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1226,10 +1226,10 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
1226 1226
1227 /* Read comment about this code in corresponding place in xfns.c. */ 1227 /* Read comment about this code in corresponding place in xfns.c. */
1228 tem = x_get_arg (dpyinfo, parms, Qmin_width, NULL, NULL, RES_TYPE_NUMBER); 1228 tem = x_get_arg (dpyinfo, parms, Qmin_width, NULL, NULL, RES_TYPE_NUMBER);
1229 if (FIXED_OR_FLOATP (tem)) 1229 if (FIXNUMP (tem))
1230 store_frame_param (f, Qmin_width, tem); 1230 store_frame_param (f, Qmin_width, tem);
1231 tem = x_get_arg (dpyinfo, parms, Qmin_height, NULL, NULL, RES_TYPE_NUMBER); 1231 tem = x_get_arg (dpyinfo, parms, Qmin_height, NULL, NULL, RES_TYPE_NUMBER);
1232 if (FIXED_OR_FLOATP (tem)) 1232 if (FIXNUMP (tem))
1233 store_frame_param (f, Qmin_height, tem); 1233 store_frame_param (f, Qmin_height, tem);
1234 adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), 1234 adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
1235 FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, 1, 1235 FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, 1,
diff --git a/src/nsimage.m b/src/nsimage.m
index f657c49c0b1..0ae1b88edd6 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -88,7 +88,7 @@ ns_load_image (struct frame *f, struct image *img,
88 index = FIXNUMP (lisp_index) ? XFIXNAT (lisp_index) : 0; 88 index = FIXNUMP (lisp_index) ? XFIXNAT (lisp_index) : 0;
89 89
90 lisp_rotation = Fplist_get (XCDR (img->spec), QCrotation); 90 lisp_rotation = Fplist_get (XCDR (img->spec), QCrotation);
91 rotation = FIXED_OR_FLOATP (lisp_rotation) ? XFLOATINT (lisp_rotation) : 0; 91 rotation = NUMBERP (lisp_rotation) ? XFLOATINT (lisp_rotation) : 0;
92 92
93 if (STRINGP (spec_file)) 93 if (STRINGP (spec_file))
94 { 94 {
@@ -532,19 +532,19 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
532 double width = -1, height = -1, max_width = -1, max_height = -1; 532 double width = -1, height = -1, max_width = -1, max_height = -1;
533 533
534 value = Fplist_get (spec, QCscale); 534 value = Fplist_get (spec, QCscale);
535 if (FIXED_OR_FLOATP (value)) 535 if (NUMBERP (value))
536 scale = XFLOATINT (value) ; 536 scale = XFLOATINT (value) ;
537 537
538 value = Fplist_get (spec, QCmax_width); 538 value = Fplist_get (spec, QCmax_width);
539 if (FIXED_OR_FLOATP (value)) 539 if (NUMBERP (value))
540 max_width = XFLOATINT (value); 540 max_width = XFLOATINT (value);
541 541
542 value = Fplist_get (spec, QCmax_height); 542 value = Fplist_get (spec, QCmax_height);
543 if (FIXED_OR_FLOATP (value)) 543 if (NUMBERP (value))
544 max_height = XFLOATINT (value); 544 max_height = XFLOATINT (value);
545 545
546 value = Fplist_get (spec, QCwidth); 546 value = Fplist_get (spec, QCwidth);
547 if (FIXED_OR_FLOATP (value)) 547 if (NUMBERP (value))
548 { 548 {
549 width = XFLOATINT (value) * scale; 549 width = XFLOATINT (value) * scale;
550 /* :width overrides :max-width. */ 550 /* :width overrides :max-width. */
@@ -552,7 +552,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
552 } 552 }
553 553
554 value = Fplist_get (spec, QCheight); 554 value = Fplist_get (spec, QCheight);
555 if (FIXED_OR_FLOATP (value)) 555 if (NUMBERP (value))
556 { 556 {
557 height = XFLOATINT (value) * scale; 557 height = XFLOATINT (value) * scale;
558 /* :height overrides :max-height. */ 558 /* :height overrides :max-height. */
diff --git a/src/nsterm.m b/src/nsterm.m
index 90758d1032a..961271f2d05 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6684,7 +6684,7 @@ not_in_argv (NSString *arg)
6684 static int totalDeltaX, totalDeltaY; 6684 static int totalDeltaX, totalDeltaY;
6685 int lineHeight; 6685 int lineHeight;
6686 6686
6687 if (FIXED_OR_FLOATP (ns_mwheel_line_height)) 6687 if (FIXNUMP (ns_mwheel_line_height))
6688 lineHeight = XFIXNUM (ns_mwheel_line_height); 6688 lineHeight = XFIXNUM (ns_mwheel_line_height);
6689 else 6689 else
6690 { 6690 {
diff --git a/src/process.c b/src/process.c
index a266da1c1b9..29cedd7ad69 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1025,7 +1025,7 @@ static Lisp_Object deleted_pid_list;
1025void 1025void
1026record_deleted_pid (pid_t pid, Lisp_Object filename) 1026record_deleted_pid (pid_t pid, Lisp_Object filename)
1027{ 1027{
1028 deleted_pid_list = Fcons (Fcons (make_fixnum_or_float (pid), filename), 1028 deleted_pid_list = Fcons (Fcons (INT_TO_INTEGER (pid), filename),
1029 /* GC treated elements set to nil. */ 1029 /* GC treated elements set to nil. */
1030 Fdelq (Qnil, deleted_pid_list)); 1030 Fdelq (Qnil, deleted_pid_list));
1031 1031
@@ -1164,7 +1164,7 @@ For a network, serial, and pipe connections, this value is nil. */)
1164 1164
1165 CHECK_PROCESS (process); 1165 CHECK_PROCESS (process);
1166 pid = XPROCESS (process)->pid; 1166 pid = XPROCESS (process)->pid;
1167 return (pid ? make_fixnum_or_float (pid) : Qnil); 1167 return pid ? INT_TO_INTEGER (pid) : Qnil;
1168} 1168}
1169 1169
1170DEFUN ("process-name", Fprocess_name, Sprocess_name, 1, 1, 0, 1170DEFUN ("process-name", Fprocess_name, Sprocess_name, 1, 1, 0,
@@ -6850,13 +6850,13 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */)
6850 tem = string_to_number (SSDATA (process), 10, 0); 6850 tem = string_to_number (SSDATA (process), 10, 0);
6851 process = tem; 6851 process = tem;
6852 } 6852 }
6853 else if (!FIXED_OR_FLOATP (process)) 6853 else if (!NUMBERP (process))
6854 process = get_process (process); 6854 process = get_process (process);
6855 6855
6856 if (NILP (process)) 6856 if (NILP (process))
6857 return process; 6857 return process;
6858 6858
6859 if (FIXED_OR_FLOATP (process)) 6859 if (NUMBERP (process))
6860 CONS_TO_INTEGER (process, pid_t, pid); 6860 CONS_TO_INTEGER (process, pid_t, pid);
6861 else 6861 else
6862 { 6862 {
@@ -7053,13 +7053,10 @@ handle_child_signal (int sig)
7053 if (! CONSP (head)) 7053 if (! CONSP (head))
7054 continue; 7054 continue;
7055 xpid = XCAR (head); 7055 xpid = XCAR (head);
7056 if (all_pids_are_fixnums ? FIXNUMP (xpid) : FIXED_OR_FLOATP (xpid)) 7056 if (all_pids_are_fixnums ? FIXNUMP (xpid) : INTEGERP (xpid))
7057 { 7057 {
7058 pid_t deleted_pid; 7058 pid_t deleted_pid = (FIXNUMP (xpid) ? XFIXNUM (xpid)
7059 if (FIXNUMP (xpid)) 7059 : bignum_to_intmax (xpid));
7060 deleted_pid = XFIXNUM (xpid);
7061 else
7062 deleted_pid = XFLOAT_DATA (xpid);
7063 if (child_status_changed (deleted_pid, 0, 0)) 7060 if (child_status_changed (deleted_pid, 0, 0))
7064 { 7061 {
7065 if (STRINGP (XCDR (head))) 7062 if (STRINGP (XCDR (head)))
diff --git a/src/syntax.c b/src/syntax.c
index a9bc36ae9f2..432d82cdf0f 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -614,7 +614,7 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte)
614 error ("syntax-ppss modified the buffer!"); 614 error ("syntax-ppss modified the buffer!");
615 TEMP_SET_PT_BOTH (opoint, opoint_byte); 615 TEMP_SET_PT_BOTH (opoint, opoint_byte);
616 Lisp_Object boc = Fnth (make_fixnum (8), ppss); 616 Lisp_Object boc = Fnth (make_fixnum (8), ppss);
617 if (FIXED_OR_FLOATP (boc)) 617 if (FIXNUMP (boc))
618 { 618 {
619 find_start_value = XFIXNUM (boc); 619 find_start_value = XFIXNUM (boc);
620 find_start_value_byte = CHAR_TO_BYTE (find_start_value); 620 find_start_value_byte = CHAR_TO_BYTE (find_start_value);
diff --git a/src/sysdep.c b/src/sysdep.c
index 889ad6bdb01..52afa2f0e16 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -3045,9 +3045,9 @@ list_system_processes (void)
3045 for (i = 0; i < len; i++) 3045 for (i = 0; i < len; i++)
3046 { 3046 {
3047#ifdef DARWIN_OS 3047#ifdef DARWIN_OS
3048 proclist = Fcons (make_fixnum_or_float (procs[i].kp_proc.p_pid), proclist); 3048 proclist = Fcons (INT_TO_INTEGER (procs[i].kp_proc.p_pid), proclist);
3049#else 3049#else
3050 proclist = Fcons (make_fixnum_or_float (procs[i].ki_pid), proclist); 3050 proclist = Fcons (INT_TO_INTEGER (procs[i].ki_pid), proclist);
3051#endif 3051#endif
3052 } 3052 }
3053 3053
@@ -3261,7 +3261,7 @@ system_process_attributes (Lisp_Object pid)
3261 Lisp_Object decoded_cmd; 3261 Lisp_Object decoded_cmd;
3262 ptrdiff_t count; 3262 ptrdiff_t count;
3263 3263
3264 CHECK_FIXNUM_OR_FLOAT (pid); 3264 CHECK_NUMBER (pid);
3265 CONS_TO_INTEGER (pid, pid_t, proc_id); 3265 CONS_TO_INTEGER (pid, pid_t, proc_id);
3266 sprintf (procfn, "/proc/%"pMd, proc_id); 3266 sprintf (procfn, "/proc/%"pMd, proc_id);
3267 if (stat (procfn, &st) < 0) 3267 if (stat (procfn, &st) < 0)
@@ -3269,7 +3269,7 @@ system_process_attributes (Lisp_Object pid)
3269 3269
3270 /* euid egid */ 3270 /* euid egid */
3271 uid = st.st_uid; 3271 uid = st.st_uid;
3272 attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); 3272 attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (uid)), attrs);
3273 block_input (); 3273 block_input ();
3274 pw = getpwuid (uid); 3274 pw = getpwuid (uid);
3275 unblock_input (); 3275 unblock_input ();
@@ -3277,7 +3277,7 @@ system_process_attributes (Lisp_Object pid)
3277 attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); 3277 attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
3278 3278
3279 gid = st.st_gid; 3279 gid = st.st_gid;
3280 attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); 3280 attrs = Fcons (Fcons (Qegid, INT_TO_INTEGER (gid)), attrs);
3281 block_input (); 3281 block_input ();
3282 gr = getgrgid (gid); 3282 gr = getgrgid (gid);
3283 unblock_input (); 3283 unblock_input ();
@@ -3335,17 +3335,15 @@ system_process_attributes (Lisp_Object pid)
3335 state_str[0] = c; 3335 state_str[0] = c;
3336 state_str[1] = '\0'; 3336 state_str[1] = '\0';
3337 attrs = Fcons (Fcons (Qstate, build_string (state_str)), attrs); 3337 attrs = Fcons (Fcons (Qstate, build_string (state_str)), attrs);
3338 attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (ppid)), attrs); 3338 attrs = Fcons (Fcons (Qppid, INT_TO_INTEGER (ppid)), attrs);
3339 attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (pgrp)), attrs); 3339 attrs = Fcons (Fcons (Qpgrp, INT_TO_INTEGER (pgrp)), attrs);
3340 attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (sess)), attrs); 3340 attrs = Fcons (Fcons (Qsess, INT_TO_INTEGER (sess)), attrs);
3341 attrs = Fcons (Fcons (Qttname, procfs_ttyname (tty)), attrs); 3341 attrs = Fcons (Fcons (Qttname, procfs_ttyname (tty)), attrs);
3342 attrs = Fcons (Fcons (Qtpgid, make_fixnum_or_float (tpgid)), attrs); 3342 attrs = Fcons (Fcons (Qtpgid, INT_TO_INTEGER (tpgid)), attrs);
3343 attrs = Fcons (Fcons (Qminflt, make_fixnum_or_float (minflt)), attrs); 3343 attrs = Fcons (Fcons (Qminflt, INT_TO_INTEGER (minflt)), attrs);
3344 attrs = Fcons (Fcons (Qmajflt, make_fixnum_or_float (majflt)), attrs); 3344 attrs = Fcons (Fcons (Qmajflt, INT_TO_INTEGER (majflt)), attrs);
3345 attrs = Fcons (Fcons (Qcminflt, make_fixnum_or_float (cminflt)), 3345 attrs = Fcons (Fcons (Qcminflt, INT_TO_INTEGER (cminflt)), attrs);
3346 attrs); 3346 attrs = Fcons (Fcons (Qcmajflt, INT_TO_INTEGER (cmajflt)), attrs);
3347 attrs = Fcons (Fcons (Qcmajflt, make_fixnum_or_float (cmajflt)),
3348 attrs);
3349 clocks_per_sec = sysconf (_SC_CLK_TCK); 3347 clocks_per_sec = sysconf (_SC_CLK_TCK);
3350 if (clocks_per_sec < 0) 3348 if (clocks_per_sec < 0)
3351 clocks_per_sec = 100; 3349 clocks_per_sec = 100;
@@ -3371,17 +3369,15 @@ system_process_attributes (Lisp_Object pid)
3371 attrs); 3369 attrs);
3372 attrs = Fcons (Fcons (Qpri, make_fixnum (priority)), attrs); 3370 attrs = Fcons (Fcons (Qpri, make_fixnum (priority)), attrs);
3373 attrs = Fcons (Fcons (Qnice, make_fixnum (niceness)), attrs); 3371 attrs = Fcons (Fcons (Qnice, make_fixnum (niceness)), attrs);
3374 attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (thcount)), 3372 attrs = Fcons (Fcons (Qthcount, INT_TO_INTEGER (thcount)), attrs);
3375 attrs);
3376 tnow = current_timespec (); 3373 tnow = current_timespec ();
3377 telapsed = get_up_time (); 3374 telapsed = get_up_time ();
3378 tboot = timespec_sub (tnow, telapsed); 3375 tboot = timespec_sub (tnow, telapsed);
3379 tstart = time_from_jiffies (start, clocks_per_sec); 3376 tstart = time_from_jiffies (start, clocks_per_sec);
3380 tstart = timespec_add (tboot, tstart); 3377 tstart = timespec_add (tboot, tstart);
3381 attrs = Fcons (Fcons (Qstart, make_lisp_time (tstart)), attrs); 3378 attrs = Fcons (Fcons (Qstart, make_lisp_time (tstart)), attrs);
3382 attrs = Fcons (Fcons (Qvsize, make_fixnum_or_float (vsize / 1024)), 3379 attrs = Fcons (Fcons (Qvsize, INT_TO_INTEGER (vsize / 1024)), attrs);
3383 attrs); 3380 attrs = Fcons (Fcons (Qrss, INT_TO_INTEGER (4 * rss)), attrs);
3384 attrs = Fcons (Fcons (Qrss, make_fixnum_or_float (4 * rss)), attrs);
3385 telapsed = timespec_sub (tnow, tstart); 3381 telapsed = timespec_sub (tnow, tstart);
3386 attrs = Fcons (Fcons (Qetime, make_lisp_time (telapsed)), attrs); 3382 attrs = Fcons (Fcons (Qetime, make_lisp_time (telapsed)), attrs);
3387 us_time = time_from_jiffies (u_time + s_time, clocks_per_sec); 3383 us_time = time_from_jiffies (u_time + s_time, clocks_per_sec);
@@ -3495,7 +3491,7 @@ system_process_attributes (Lisp_Object pid)
3495 Lisp_Object decoded_cmd; 3491 Lisp_Object decoded_cmd;
3496 ptrdiff_t count; 3492 ptrdiff_t count;
3497 3493
3498 CHECK_FIXNUM_OR_FLOAT (pid); 3494 CHECK_NUMBER (pid);
3499 CONS_TO_INTEGER (pid, pid_t, proc_id); 3495 CONS_TO_INTEGER (pid, pid_t, proc_id);
3500 sprintf (procfn, "/proc/%"pMd, proc_id); 3496 sprintf (procfn, "/proc/%"pMd, proc_id);
3501 if (stat (procfn, &st) < 0) 3497 if (stat (procfn, &st) < 0)
@@ -3503,7 +3499,7 @@ system_process_attributes (Lisp_Object pid)
3503 3499
3504 /* euid egid */ 3500 /* euid egid */
3505 uid = st.st_uid; 3501 uid = st.st_uid;
3506 attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); 3502 attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (uid)), attrs);
3507 block_input (); 3503 block_input ();
3508 pw = getpwuid (uid); 3504 pw = getpwuid (uid);
3509 unblock_input (); 3505 unblock_input ();
@@ -3511,7 +3507,7 @@ system_process_attributes (Lisp_Object pid)
3511 attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); 3507 attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
3512 3508
3513 gid = st.st_gid; 3509 gid = st.st_gid;
3514 attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); 3510 attrs = Fcons (Fcons (Qegid, INT_TO_INTEGER (gid)), attrs);
3515 block_input (); 3511 block_input ();
3516 gr = getgrgid (gid); 3512 gr = getgrgid (gid);
3517 unblock_input (); 3513 unblock_input ();
@@ -3533,9 +3529,9 @@ system_process_attributes (Lisp_Object pid)
3533 3529
3534 if (nread == sizeof pinfo) 3530 if (nread == sizeof pinfo)
3535 { 3531 {
3536 attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (pinfo.pr_ppid)), attrs); 3532 attrs = Fcons (Fcons (Qppid, INT_TO_INTEGER (pinfo.pr_ppid)), attrs);
3537 attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (pinfo.pr_pgid)), attrs); 3533 attrs = Fcons (Fcons (Qpgrp, INT_TO_INTEGER (pinfo.pr_pgid)), attrs);
3538 attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (pinfo.pr_sid)), attrs); 3534 attrs = Fcons (Fcons (Qsess, INT_TO_INTEGER (pinfo.pr_sid)), attrs);
3539 3535
3540 { 3536 {
3541 char state_str[2]; 3537 char state_str[2];
@@ -3565,14 +3561,11 @@ system_process_attributes (Lisp_Object pid)
3565 attrs = Fcons (Fcons (Qctime, make_lisp_time (pinfo.pr_ctime)), attrs); 3561 attrs = Fcons (Fcons (Qctime, make_lisp_time (pinfo.pr_ctime)), attrs);
3566 attrs = Fcons (Fcons (Qpri, make_fixnum (pinfo.pr_lwp.pr_pri)), attrs); 3562 attrs = Fcons (Fcons (Qpri, make_fixnum (pinfo.pr_lwp.pr_pri)), attrs);
3567 attrs = Fcons (Fcons (Qnice, make_fixnum (pinfo.pr_lwp.pr_nice)), attrs); 3563 attrs = Fcons (Fcons (Qnice, make_fixnum (pinfo.pr_lwp.pr_nice)), attrs);
3568 attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (pinfo.pr_nlwp)), 3564 attrs = Fcons (Fcons (Qthcount, INT_TO_INTEGER (pinfo.pr_nlwp)), attrs);
3569 attrs);
3570 3565
3571 attrs = Fcons (Fcons (Qstart, make_lisp_time (pinfo.pr_start)), attrs); 3566 attrs = Fcons (Fcons (Qstart, make_lisp_time (pinfo.pr_start)), attrs);
3572 attrs = Fcons (Fcons (Qvsize, make_fixnum_or_float (pinfo.pr_size)), 3567 attrs = Fcons (Fcons (Qvsize, INT_TO_INTEGER (pinfo.pr_size)), attrs);
3573 attrs); 3568 attrs = Fcons (Fcons (Qrss, INT_TO_INTEGER (pinfo.pr_rssize)), attrs);
3574 attrs = Fcons (Fcons (Qrss, make_fixnum_or_float (pinfo.pr_rssize)),
3575 attrs);
3576 3569
3577 /* pr_pctcpu and pr_pctmem are unsigned integers in the 3570 /* pr_pctcpu and pr_pctmem are unsigned integers in the
3578 range 0 .. 2**15, representing 0.0 .. 1.0. */ 3571 range 0 .. 2**15, representing 0.0 .. 1.0. */
@@ -3630,14 +3623,14 @@ system_process_attributes (Lisp_Object pid)
3630 Lisp_Object attrs = Qnil; 3623 Lisp_Object attrs = Qnil;
3631 Lisp_Object decoded_comm; 3624 Lisp_Object decoded_comm;
3632 3625
3633 CHECK_FIXNUM_OR_FLOAT (pid); 3626 CHECK_NUMBER (pid);
3634 CONS_TO_INTEGER (pid, int, proc_id); 3627 CONS_TO_INTEGER (pid, int, proc_id);
3635 mib[3] = proc_id; 3628 mib[3] = proc_id;
3636 3629
3637 if (sysctl (mib, 4, &proc, &proclen, NULL, 0) != 0) 3630 if (sysctl (mib, 4, &proc, &proclen, NULL, 0) != 0)
3638 return attrs; 3631 return attrs;
3639 3632
3640 attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (proc.ki_uid)), attrs); 3633 attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (proc.ki_uid)), attrs);
3641 3634
3642 block_input (); 3635 block_input ();
3643 pw = getpwuid (proc.ki_uid); 3636 pw = getpwuid (proc.ki_uid);
@@ -3645,7 +3638,7 @@ system_process_attributes (Lisp_Object pid)
3645 if (pw) 3638 if (pw)
3646 attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); 3639 attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
3647 3640
3648 attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (proc.ki_svgid)), attrs); 3641 attrs = Fcons (Fcons (Qegid, INT_TO_INTEGER (proc.ki_svgid)), attrs);
3649 3642
3650 block_input (); 3643 block_input ();
3651 gr = getgrgid (proc.ki_svgid); 3644 gr = getgrgid (proc.ki_svgid);
@@ -3684,9 +3677,9 @@ system_process_attributes (Lisp_Object pid)
3684 attrs = Fcons (Fcons (Qstate, build_string (state)), attrs); 3677 attrs = Fcons (Fcons (Qstate, build_string (state)), attrs);
3685 } 3678 }
3686 3679
3687 attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (proc.ki_ppid)), attrs); 3680 attrs = Fcons (Fcons (Qppid, INT_TO_INTEGER (proc.ki_ppid)), attrs);
3688 attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (proc.ki_pgid)), attrs); 3681 attrs = Fcons (Fcons (Qpgrp, INT_TO_INTEGER (proc.ki_pgid)), attrs);
3689 attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (proc.ki_sid)), attrs); 3682 attrs = Fcons (Fcons (Qsess, INT_TO_INTEGER (proc.ki_sid)), attrs);
3690 3683
3691 block_input (); 3684 block_input ();
3692 ttyname = proc.ki_tdev == NODEV ? NULL : devname (proc.ki_tdev, S_IFCHR); 3685 ttyname = proc.ki_tdev == NODEV ? NULL : devname (proc.ki_tdev, S_IFCHR);
@@ -3694,9 +3687,11 @@ system_process_attributes (Lisp_Object pid)
3694 if (ttyname) 3687 if (ttyname)
3695 attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs); 3688 attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs);
3696 3689
3697 attrs = Fcons (Fcons (Qtpgid, make_fixnum_or_float (proc.ki_tpgid)), attrs); 3690 attrs = Fcons (Fcons (Qtpgid, INT_TO_INTEGER (proc.ki_tpgid)), attrs);
3698 attrs = Fcons (Fcons (Qminflt, make_fixnum_or_float (proc.ki_rusage.ru_minflt)), attrs); 3691 attrs = Fcons (Fcons (Qminflt, INT_TO_INTEGER (proc.ki_rusage.ru_minflt)),
3699 attrs = Fcons (Fcons (Qmajflt, make_fixnum_or_float (proc.ki_rusage.ru_majflt)), attrs); 3692 attrs);
3693 attrs = Fcons (Fcons (Qmajflt, INT_TO_INTEGER (proc.ki_rusage.ru_majflt)),
3694 attrs);
3700 attrs = Fcons (Fcons (Qcminflt, make_fixnum (proc.ki_rusage_ch.ru_minflt)), attrs); 3695 attrs = Fcons (Fcons (Qcminflt, make_fixnum (proc.ki_rusage_ch.ru_minflt)), attrs);
3701 attrs = Fcons (Fcons (Qcmajflt, make_fixnum (proc.ki_rusage_ch.ru_majflt)), attrs); 3696 attrs = Fcons (Fcons (Qcmajflt, make_fixnum (proc.ki_rusage_ch.ru_majflt)), attrs);
3702 3697
@@ -3718,8 +3713,7 @@ system_process_attributes (Lisp_Object pid)
3718 timeval_to_timespec (proc.ki_rusage_ch.ru_stime)); 3713 timeval_to_timespec (proc.ki_rusage_ch.ru_stime));
3719 attrs = Fcons (Fcons (Qctime, make_lisp_time (t)), attrs); 3714 attrs = Fcons (Fcons (Qctime, make_lisp_time (t)), attrs);
3720 3715
3721 attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (proc.ki_numthreads)), 3716 attrs = Fcons (Fcons (Qthcount, INT_TO_INTEGER (proc.ki_numthreads)), attrs);
3722 attrs);
3723 attrs = Fcons (Fcons (Qpri, make_fixnum (proc.ki_pri.pri_native)), attrs); 3717 attrs = Fcons (Fcons (Qpri, make_fixnum (proc.ki_pri.pri_native)), attrs);
3724 attrs = Fcons (Fcons (Qnice, make_fixnum (proc.ki_nice)), attrs); 3718 attrs = Fcons (Fcons (Qnice, make_fixnum (proc.ki_nice)), attrs);
3725 attrs = Fcons (Fcons (Qstart, make_lisp_timeval (proc.ki_start)), attrs); 3719 attrs = Fcons (Fcons (Qstart, make_lisp_timeval (proc.ki_start)), attrs);
@@ -3741,7 +3735,7 @@ system_process_attributes (Lisp_Object pid)
3741 { 3735 {
3742 pcpu = (100.0 * proc.ki_pctcpu / fscale 3736 pcpu = (100.0 * proc.ki_pctcpu / fscale
3743 / (1 - exp (proc.ki_swtime * log ((double) ccpu / fscale)))); 3737 / (1 - exp (proc.ki_swtime * log ((double) ccpu / fscale))));
3744 attrs = Fcons (Fcons (Qpcpu, make_fixnum_or_float (pcpu)), attrs); 3738 attrs = Fcons (Fcons (Qpcpu, INT_TO_INTEGER (pcpu)), attrs);
3745 } 3739 }
3746 } 3740 }
3747 3741
@@ -3751,7 +3745,7 @@ system_process_attributes (Lisp_Object pid)
3751 double pmem = (proc.ki_flag & P_INMEM 3745 double pmem = (proc.ki_flag & P_INMEM
3752 ? 100.0 * proc.ki_rssize / npages 3746 ? 100.0 * proc.ki_rssize / npages
3753 : 0); 3747 : 0);
3754 attrs = Fcons (Fcons (Qpmem, make_fixnum_or_float (pmem)), attrs); 3748 attrs = Fcons (Fcons (Qpmem, INT_TO_INTEGER (pmem)), attrs);
3755 } 3749 }
3756 3750
3757 mib[2] = KERN_PROC_ARGS; 3751 mib[2] = KERN_PROC_ARGS;
@@ -3810,7 +3804,7 @@ system_process_attributes (Lisp_Object pid)
3810 Lisp_Object attrs = Qnil; 3804 Lisp_Object attrs = Qnil;
3811 Lisp_Object decoded_comm; 3805 Lisp_Object decoded_comm;
3812 3806
3813 CHECK_FIXNUM_OR_FLOAT (pid); 3807 CHECK_NUMBER (pid);
3814 CONS_TO_INTEGER (pid, int, proc_id); 3808 CONS_TO_INTEGER (pid, int, proc_id);
3815 mib[3] = proc_id; 3809 mib[3] = proc_id;
3816 3810
@@ -3818,7 +3812,7 @@ system_process_attributes (Lisp_Object pid)
3818 return attrs; 3812 return attrs;
3819 3813
3820 uid = proc.kp_eproc.e_ucred.cr_uid; 3814 uid = proc.kp_eproc.e_ucred.cr_uid;
3821 attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); 3815 attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (uid)), attrs);
3822 3816
3823 block_input (); 3817 block_input ();
3824 pw = getpwuid (uid); 3818 pw = getpwuid (uid);
@@ -3827,7 +3821,7 @@ system_process_attributes (Lisp_Object pid)
3827 attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); 3821 attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
3828 3822
3829 gid = proc.kp_eproc.e_pcred.p_svgid; 3823 gid = proc.kp_eproc.e_pcred.p_svgid;
3830 attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); 3824 attrs = Fcons (Fcons (Qegid, INT_TO_INTEGER (gid)), attrs);
3831 3825
3832 block_input (); 3826 block_input ();
3833 gr = getgrgid (gid); 3827 gr = getgrgid (gid);
@@ -3867,10 +3861,8 @@ system_process_attributes (Lisp_Object pid)
3867 attrs = Fcons (Fcons (Qstate, build_string (state)), attrs); 3861 attrs = Fcons (Fcons (Qstate, build_string (state)), attrs);
3868 } 3862 }
3869 3863
3870 attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (proc.kp_eproc.e_ppid)), 3864 attrs = Fcons (Fcons (Qppid, INT_TO_INTEGER (proc.kp_eproc.e_ppid)), attrs);
3871 attrs); 3865 attrs = Fcons (Fcons (Qpgrp, INT_TO_INTEGER (proc.kp_eproc.e_pgid)), attrs);
3872 attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (proc.kp_eproc.e_pgid)),
3873 attrs);
3874 3866
3875 tdev = proc.kp_eproc.e_tdev; 3867 tdev = proc.kp_eproc.e_tdev;
3876 block_input (); 3868 block_input ();
@@ -3879,15 +3871,15 @@ system_process_attributes (Lisp_Object pid)
3879 if (ttyname) 3871 if (ttyname)
3880 attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs); 3872 attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs);
3881 3873
3882 attrs = Fcons (Fcons (Qtpgid, make_fixnum_or_float (proc.kp_eproc.e_tpgid)), 3874 attrs = Fcons (Fcons (Qtpgid, INT_TO_INTEGER (proc.kp_eproc.e_tpgid)),
3883 attrs); 3875 attrs);
3884 3876
3885 rusage = proc.kp_proc.p_ru; 3877 rusage = proc.kp_proc.p_ru;
3886 if (rusage) 3878 if (rusage)
3887 { 3879 {
3888 attrs = Fcons (Fcons (Qminflt, make_fixnum_or_float (rusage->ru_minflt)), 3880 attrs = Fcons (Fcons (Qminflt, INT_TO_INTEGER (rusage->ru_minflt)),
3889 attrs); 3881 attrs);
3890 attrs = Fcons (Fcons (Qmajflt, make_fixnum_or_float (rusage->ru_majflt)), 3882 attrs = Fcons (Fcons (Qmajflt, INT_TO_INTEGER (rusage->ru_majflt)),
3891 attrs); 3883 attrs);
3892 3884
3893 attrs = Fcons (Fcons (Qutime, make_lisp_timeval (rusage->ru_utime)), 3885 attrs = Fcons (Fcons (Qutime, make_lisp_timeval (rusage->ru_utime)),
diff --git a/src/w32.c b/src/w32.c
index 78f946c6341..4b57d916416 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -6873,7 +6873,7 @@ list_system_processes (void)
6873 res = process32_next (h_snapshot, &proc_entry)) 6873 res = process32_next (h_snapshot, &proc_entry))
6874 { 6874 {
6875 proc_id = proc_entry.th32ProcessID; 6875 proc_id = proc_entry.th32ProcessID;
6876 proclist = Fcons (make_fixnum_or_float (proc_id), proclist); 6876 proclist = Fcons (INT_TO_INTEGER (proc_id), proclist);
6877 } 6877 }
6878 6878
6879 CloseHandle (h_snapshot); 6879 CloseHandle (h_snapshot);
@@ -7031,7 +7031,7 @@ system_process_attributes (Lisp_Object pid)
7031 double pcpu; 7031 double pcpu;
7032 BOOL result = FALSE; 7032 BOOL result = FALSE;
7033 7033
7034 CHECK_FIXNUM_OR_FLOAT (pid); 7034 CHECK_NUMBER (pid);
7035 proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XFIXNUM (pid); 7035 proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XFIXNUM (pid);
7036 7036
7037 h_snapshot = create_toolhelp32_snapshot (TH32CS_SNAPPROCESS, 0); 7037 h_snapshot = create_toolhelp32_snapshot (TH32CS_SNAPPROCESS, 0);
@@ -7061,12 +7061,12 @@ system_process_attributes (Lisp_Object pid)
7061 } 7061 }
7062 attrs = Fcons (Fcons (Qcomm, decoded_cmd), attrs); 7062 attrs = Fcons (Fcons (Qcomm, decoded_cmd), attrs);
7063 attrs = Fcons (Fcons (Qppid, 7063 attrs = Fcons (Fcons (Qppid,
7064 make_fixnum_or_float (pe.th32ParentProcessID)), 7064 INT_TO_INTEGER (pe.th32ParentProcessID)),
7065 attrs); 7065 attrs);
7066 attrs = Fcons (Fcons (Qpri, make_fixnum (pe.pcPriClassBase)), 7066 attrs = Fcons (Fcons (Qpri, make_fixnum (pe.pcPriClassBase)),
7067 attrs); 7067 attrs);
7068 attrs = Fcons (Fcons (Qthcount, 7068 attrs = Fcons (Fcons (Qthcount,
7069 make_fixnum_or_float (pe.cntThreads)), 7069 INT_TO_INTEGER (pe.cntThreads)),
7070 attrs); 7070 attrs);
7071 found_proc = 1; 7071 found_proc = 1;
7072 break; 7072 break;
@@ -7214,12 +7214,12 @@ system_process_attributes (Lisp_Object pid)
7214 CloseHandle (token); 7214 CloseHandle (token);
7215 } 7215 }
7216 7216
7217 attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (euid)), attrs); 7217 attrs = Fcons (Fcons (Qeuid, INT_TO_INTEGER (euid)), attrs);
7218 tem = make_unibyte_string (uname, ulength); 7218 tem = make_unibyte_string (uname, ulength);
7219 attrs = Fcons (Fcons (Quser, 7219 attrs = Fcons (Fcons (Quser,
7220 code_convert_string_norecord (tem, Vlocale_coding_system, 0)), 7220 code_convert_string_norecord (tem, Vlocale_coding_system, 0)),
7221 attrs); 7221 attrs);
7222 attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (egid)), attrs); 7222 attrs = Fcons (Fcons (Qegid, INT_TO_INTEGER (egid)), attrs);
7223 tem = make_unibyte_string (gname, glength); 7223 tem = make_unibyte_string (gname, glength);
7224 attrs = Fcons (Fcons (Qgroup, 7224 attrs = Fcons (Fcons (Qgroup,
7225 code_convert_string_norecord (tem, Vlocale_coding_system, 0)), 7225 code_convert_string_norecord (tem, Vlocale_coding_system, 0)),
@@ -7249,12 +7249,12 @@ system_process_attributes (Lisp_Object pid)
7249 SIZE_T rss = mem_ex.WorkingSetSize / 1024; 7249 SIZE_T rss = mem_ex.WorkingSetSize / 1024;
7250 7250
7251 attrs = Fcons (Fcons (Qmajflt, 7251 attrs = Fcons (Fcons (Qmajflt,
7252 make_fixnum_or_float (mem_ex.PageFaultCount)), 7252 INT_TO_INTEGER (mem_ex.PageFaultCount)),
7253 attrs); 7253 attrs);
7254 attrs = Fcons (Fcons (Qvsize, 7254 attrs = Fcons (Fcons (Qvsize,
7255 make_fixnum_or_float (mem_ex.PrivateUsage / 1024)), 7255 INT_TO_INTEGER (mem_ex.PrivateUsage / 1024)),
7256 attrs); 7256 attrs);
7257 attrs = Fcons (Fcons (Qrss, make_fixnum_or_float (rss)), attrs); 7257 attrs = Fcons (Fcons (Qrss, INT_TO_INTEGER (rss)), attrs);
7258 if (totphys) 7258 if (totphys)
7259 attrs = Fcons (Fcons (Qpmem, make_float (100. * rss / totphys)), attrs); 7259 attrs = Fcons (Fcons (Qpmem, make_float (100. * rss / totphys)), attrs);
7260 } 7260 }
@@ -7264,9 +7264,9 @@ system_process_attributes (Lisp_Object pid)
7264 SIZE_T rss = mem_ex.WorkingSetSize / 1024; 7264 SIZE_T rss = mem_ex.WorkingSetSize / 1024;
7265 7265
7266 attrs = Fcons (Fcons (Qmajflt, 7266 attrs = Fcons (Fcons (Qmajflt,
7267 make_fixnum_or_float (mem.PageFaultCount)), 7267 INT_TO_INTEGER (mem.PageFaultCount)),
7268 attrs); 7268 attrs);
7269 attrs = Fcons (Fcons (Qrss, make_fixnum_or_float (rss)), attrs); 7269 attrs = Fcons (Fcons (Qrss, INT_TO_INTEGER (rss)), attrs);
7270 if (totphys) 7270 if (totphys)
7271 attrs = Fcons (Fcons (Qpmem, make_float (100. * rss / totphys)), attrs); 7271 attrs = Fcons (Fcons (Qpmem, make_float (100. * rss / totphys)), attrs);
7272 } 7272 }
@@ -7275,7 +7275,7 @@ system_process_attributes (Lisp_Object pid)
7275 { 7275 {
7276 DWORD rss = maxrss / 1024; 7276 DWORD rss = maxrss / 1024;
7277 7277
7278 attrs = Fcons (Fcons (Qrss, make_fixnum_or_float (maxrss / 1024)), attrs); 7278 attrs = Fcons (Fcons (Qrss, INT_TO_INTEGER (maxrss / 1024)), attrs);
7279 if (totphys) 7279 if (totphys)
7280 attrs = Fcons (Fcons (Qpmem, make_float (100. * rss / totphys)), attrs); 7280 attrs = Fcons (Fcons (Qpmem, make_float (100. * rss / totphys)), attrs);
7281 } 7281 }
@@ -9433,10 +9433,10 @@ w32_read_registry (HKEY rootkey, Lisp_Object lkey, Lisp_Object lname)
9433 retval = Qt; 9433 retval = Qt;
9434 break; 9434 break;
9435 case REG_DWORD: 9435 case REG_DWORD:
9436 retval = INTEGER_TO_CONS (*((DWORD *)pvalue)); 9436 retval = INT_TO_INTEGER (*((DWORD *)pvalue));
9437 break; 9437 break;
9438 case REG_QWORD: 9438 case REG_QWORD:
9439 retval = INTEGER_TO_CONS (*((long long *)pvalue)); 9439 retval = INT_TO_INTEGER (*((long long *)pvalue));
9440 break; 9440 break;
9441 case REG_BINARY: 9441 case REG_BINARY:
9442 { 9442 {
diff --git a/src/w32fns.c b/src/w32fns.c
index b587677f090..153cba9f755 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -2027,7 +2027,7 @@ x_set_undecorated (struct frame *f, Lisp_Object new_value, Lisp_Object old_value
2027 if (!NILP (new_value) && !FRAME_UNDECORATED (f)) 2027 if (!NILP (new_value) && !FRAME_UNDECORATED (f))
2028 { 2028 {
2029 dwStyle = ((dwStyle & ~WS_THICKFRAME & ~WS_CAPTION) 2029 dwStyle = ((dwStyle & ~WS_THICKFRAME & ~WS_CAPTION)
2030 | ((FIXED_OR_FLOATP (border_width) && (XFIXNUM (border_width) > 0)) 2030 | ((FIXNUMP (border_width) && (XFIXNUM (border_width) > 0))
2031 ? WS_BORDER : false)); 2031 ? WS_BORDER : false));
2032 SetWindowLong (hwnd, GWL_STYLE, dwStyle); 2032 SetWindowLong (hwnd, GWL_STYLE, dwStyle);
2033 SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0, 2033 SetWindowPos (hwnd, HWND_TOP, 0, 0, 0, 0,
@@ -2334,7 +2334,7 @@ w32_createwindow (struct frame *f, int *coords)
2334 if (FRAME_UNDECORATED (f)) 2334 if (FRAME_UNDECORATED (f))
2335 { 2335 {
2336 /* If we want a thin border, specify it here. */ 2336 /* If we want a thin border, specify it here. */
2337 if (FIXED_OR_FLOATP (border_width) && (XFIXNUM (border_width) > 0)) 2337 if (FIXNUMP (border_width) && (XFIXNUM (border_width) > 0))
2338 f->output_data.w32->dwStyle |= WS_BORDER; 2338 f->output_data.w32->dwStyle |= WS_BORDER;
2339 } 2339 }
2340 else 2340 else
@@ -2350,7 +2350,7 @@ w32_createwindow (struct frame *f, int *coords)
2350 f->output_data.w32->dwStyle = WS_POPUP; 2350 f->output_data.w32->dwStyle = WS_POPUP;
2351 2351
2352 /* If we want a thin border, specify it here. */ 2352 /* If we want a thin border, specify it here. */
2353 if (FIXED_OR_FLOATP (border_width) && (XFIXNUM (border_width) > 0)) 2353 if (FIXNUMP (border_width) && (XFIXNUM (border_width) > 0))
2354 f->output_data.w32->dwStyle |= WS_BORDER; 2354 f->output_data.w32->dwStyle |= WS_BORDER;
2355 } 2355 }
2356 else 2356 else
@@ -4199,7 +4199,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
4199 press of Space which we will ignore. */ 4199 press of Space which we will ignore. */
4200 if (GetAsyncKeyState (wParam) & 1) 4200 if (GetAsyncKeyState (wParam) & 1)
4201 { 4201 {
4202 if (FIXED_OR_FLOATP (Vw32_phantom_key_code)) 4202 if (FIXNUMP (Vw32_phantom_key_code))
4203 key = XUFIXNUM (Vw32_phantom_key_code) & 255; 4203 key = XUFIXNUM (Vw32_phantom_key_code) & 255;
4204 else 4204 else
4205 key = VK_SPACE; 4205 key = VK_SPACE;
@@ -4215,7 +4215,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
4215 { 4215 {
4216 if (GetAsyncKeyState (wParam) & 1) 4216 if (GetAsyncKeyState (wParam) & 1)
4217 { 4217 {
4218 if (FIXED_OR_FLOATP (Vw32_phantom_key_code)) 4218 if (FIXNUMP (Vw32_phantom_key_code))
4219 key = XUFIXNUM (Vw32_phantom_key_code) & 255; 4219 key = XUFIXNUM (Vw32_phantom_key_code) & 255;
4220 else 4220 else
4221 key = VK_SPACE; 4221 key = VK_SPACE;
@@ -5921,11 +5921,11 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
5921 because `frame-windows-min-size' needs them. */ 5921 because `frame-windows-min-size' needs them. */
5922 tem = x_get_arg (dpyinfo, parameters, Qmin_width, NULL, NULL, 5922 tem = x_get_arg (dpyinfo, parameters, Qmin_width, NULL, NULL,
5923 RES_TYPE_NUMBER); 5923 RES_TYPE_NUMBER);
5924 if (FIXED_OR_FLOATP (tem)) 5924 if (FIXNUMP (tem))
5925 store_frame_param (f, Qmin_width, tem); 5925 store_frame_param (f, Qmin_width, tem);
5926 tem = x_get_arg (dpyinfo, parameters, Qmin_height, NULL, NULL, 5926 tem = x_get_arg (dpyinfo, parameters, Qmin_height, NULL, NULL,
5927 RES_TYPE_NUMBER); 5927 RES_TYPE_NUMBER);
5928 if (FIXED_OR_FLOATP (tem)) 5928 if (FIXNUMP (tem))
5929 store_frame_param (f, Qmin_height, tem); 5929 store_frame_param (f, Qmin_height, tem);
5930 adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), 5930 adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
5931 FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, true, 5931 FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, true,
@@ -7430,7 +7430,7 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
7430 /* Show tooltip frame. */ 7430 /* Show tooltip frame. */
7431 { 7431 {
7432 RECT rect; 7432 RECT rect;
7433 int pad = (FIXED_OR_FLOATP (Vw32_tooltip_extra_pixels) 7433 int pad = (FIXNUMP (Vw32_tooltip_extra_pixels)
7434 ? max (0, XFIXNUM (Vw32_tooltip_extra_pixels)) 7434 ? max (0, XFIXNUM (Vw32_tooltip_extra_pixels))
7435 : FRAME_COLUMN_WIDTH (tip_f)); 7435 : FRAME_COLUMN_WIDTH (tip_f));
7436 7436
@@ -9431,7 +9431,7 @@ w32_console_toggle_lock_key (int vk_code, Lisp_Object new_state)
9431 int cur_state = (GetKeyState (vk_code) & 1); 9431 int cur_state = (GetKeyState (vk_code) & 1);
9432 9432
9433 if (NILP (new_state) 9433 if (NILP (new_state)
9434 || (FIXED_OR_FLOATP (new_state) 9434 || (FIXNUMP (new_state)
9435 && ((XUFIXNUM (new_state)) & 1) != cur_state)) 9435 && ((XUFIXNUM (new_state)) & 1) != cur_state))
9436 { 9436 {
9437#ifdef WINDOWSNT 9437#ifdef WINDOWSNT
diff --git a/src/w32inevt.c b/src/w32inevt.c
index e8494c88bc1..f5558bb3d54 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -181,7 +181,7 @@ key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
181 Space which we will ignore. */ 181 Space which we will ignore. */
182 if ((mod_key_state & LEFT_WIN_PRESSED) == 0) 182 if ((mod_key_state & LEFT_WIN_PRESSED) == 0)
183 { 183 {
184 if (FIXED_OR_FLOATP (Vw32_phantom_key_code)) 184 if (FIXNUMP (Vw32_phantom_key_code))
185 faked_key = XUFIXNUM (Vw32_phantom_key_code) & 255; 185 faked_key = XUFIXNUM (Vw32_phantom_key_code) & 255;
186 else 186 else
187 faked_key = VK_SPACE; 187 faked_key = VK_SPACE;
@@ -198,7 +198,7 @@ key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
198 { 198 {
199 if ((mod_key_state & RIGHT_WIN_PRESSED) == 0) 199 if ((mod_key_state & RIGHT_WIN_PRESSED) == 0)
200 { 200 {
201 if (FIXED_OR_FLOATP (Vw32_phantom_key_code)) 201 if (FIXNUMP (Vw32_phantom_key_code))
202 faked_key = XUFIXNUM (Vw32_phantom_key_code) & 255; 202 faked_key = XUFIXNUM (Vw32_phantom_key_code) & 255;
203 else 203 else
204 faked_key = VK_SPACE; 204 faked_key = VK_SPACE;
diff --git a/src/w32proc.c b/src/w32proc.c
index 5c2cb327495..cb02ba63412 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -3206,7 +3206,7 @@ If LCID (a 16-bit number) is not a valid locale, the result is nil. */)
3206 if (got_full) 3206 if (got_full)
3207 return DECODE_SYSTEM (build_string (full_name)); 3207 return DECODE_SYSTEM (build_string (full_name));
3208 } 3208 }
3209 else if (FIXED_OR_FLOATP (longform)) 3209 else if (FIXNUMP (longform))
3210 { 3210 {
3211 got_full = GetLocaleInfo (XFIXNUM (lcid), 3211 got_full = GetLocaleInfo (XFIXNUM (lcid),
3212 XFIXNUM (longform), 3212 XFIXNUM (longform),
diff --git a/src/window.c b/src/window.c
index 67cfdc12b5d..d4fc5568a5a 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1383,8 +1383,8 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\
1383 CHECK_CONS (coordinates); 1383 CHECK_CONS (coordinates);
1384 lx = Fcar (coordinates); 1384 lx = Fcar (coordinates);
1385 ly = Fcdr (coordinates); 1385 ly = Fcdr (coordinates);
1386 CHECK_FIXNUM_OR_FLOAT (lx); 1386 CHECK_NUMBER (lx);
1387 CHECK_FIXNUM_OR_FLOAT (ly); 1387 CHECK_NUMBER (ly);
1388 x = FRAME_PIXEL_X_FROM_CANON_X (f, lx) + FRAME_INTERNAL_BORDER_WIDTH (f); 1388 x = FRAME_PIXEL_X_FROM_CANON_X (f, lx) + FRAME_INTERNAL_BORDER_WIDTH (f);
1389 y = FRAME_PIXEL_Y_FROM_CANON_Y (f, ly) + FRAME_INTERNAL_BORDER_WIDTH (f); 1389 y = FRAME_PIXEL_Y_FROM_CANON_Y (f, ly) + FRAME_INTERNAL_BORDER_WIDTH (f);
1390 1390
@@ -1533,9 +1533,8 @@ column 0. */)
1533{ 1533{
1534 struct frame *f = decode_live_frame (frame); 1534 struct frame *f = decode_live_frame (frame);
1535 1535
1536 /* Check that arguments are integers or floats. */ 1536 CHECK_NUMBER (x);
1537 CHECK_FIXNUM_OR_FLOAT (x); 1537 CHECK_NUMBER (y);
1538 CHECK_FIXNUM_OR_FLOAT (y);
1539 1538
1540 return window_from_coordinates (f, 1539 return window_from_coordinates (f,
1541 (FRAME_PIXEL_X_FROM_CANON_X (f, x) 1540 (FRAME_PIXEL_X_FROM_CANON_X (f, x)
@@ -1972,7 +1971,7 @@ though when run from an idle timer with a delay of zero seconds. */)
1972 row = (NILP (body) 1971 row = (NILP (body)
1973 ? MATRIX_ROW (w->current_matrix, 0) 1972 ? MATRIX_ROW (w->current_matrix, 0)
1974 : MATRIX_FIRST_TEXT_ROW (w->current_matrix)); 1973 : MATRIX_FIRST_TEXT_ROW (w->current_matrix));
1975 else if (FIXED_OR_FLOATP (first)) 1974 else if (FIXNUMP (first))
1976 { 1975 {
1977 CHECK_RANGED_INTEGER (first, 0, w->current_matrix->nrows); 1976 CHECK_RANGED_INTEGER (first, 0, w->current_matrix->nrows);
1978 row = MATRIX_ROW (w->current_matrix, XFIXNUM (first)); 1977 row = MATRIX_ROW (w->current_matrix, XFIXNUM (first));
@@ -1985,7 +1984,7 @@ though when run from an idle timer with a delay of zero seconds. */)
1985 end_row = (NILP (body) 1984 end_row = (NILP (body)
1986 ? MATRIX_ROW (w->current_matrix, w->current_matrix->nrows) 1985 ? MATRIX_ROW (w->current_matrix, w->current_matrix->nrows)
1987 : MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w)); 1986 : MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w));
1988 else if (FIXED_OR_FLOATP (last)) 1987 else if (FIXNUMP (last))
1989 { 1988 {
1990 CHECK_RANGED_INTEGER (last, 0, w->current_matrix->nrows); 1989 CHECK_RANGED_INTEGER (last, 0, w->current_matrix->nrows);
1991 end_row = MATRIX_ROW (w->current_matrix, XFIXNUM (last)); 1990 end_row = MATRIX_ROW (w->current_matrix, XFIXNUM (last));
@@ -3994,7 +3993,7 @@ window_resize_apply (struct window *w, bool horflag)
3994 { 3993 {
3995 w->pixel_width = XFIXNAT (w->new_pixel); 3994 w->pixel_width = XFIXNAT (w->new_pixel);
3996 w->total_cols = w->pixel_width / unit; 3995 w->total_cols = w->pixel_width / unit;
3997 if (FIXED_OR_FLOATP (w->new_normal)) 3996 if (NUMBERP (w->new_normal))
3998 wset_normal_cols (w, w->new_normal); 3997 wset_normal_cols (w, w->new_normal);
3999 3998
4000 edge = w->pixel_left; 3999 edge = w->pixel_left;
@@ -4003,7 +4002,7 @@ window_resize_apply (struct window *w, bool horflag)
4003 { 4002 {
4004 w->pixel_height = XFIXNAT (w->new_pixel); 4003 w->pixel_height = XFIXNAT (w->new_pixel);
4005 w->total_lines = w->pixel_height / unit; 4004 w->total_lines = w->pixel_height / unit;
4006 if (FIXED_OR_FLOATP (w->new_normal)) 4005 if (NUMBERP (w->new_normal))
4007 wset_normal_lines (w, w->new_normal); 4006 wset_normal_lines (w, w->new_normal);
4008 4007
4009 edge = w->pixel_top; 4008 edge = w->pixel_top;
@@ -7360,7 +7359,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */)
7360 struct window *w = decode_live_window (window); 7359 struct window *w = decode_live_window (window);
7361 struct frame *f = XFRAME (w->frame); 7360 struct frame *f = XFRAME (w->frame);
7362 7361
7363 CHECK_FIXNUM_OR_FLOAT (vscroll); 7362 CHECK_NUMBER (vscroll);
7364 7363
7365 if (FRAME_WINDOW_P (f)) 7364 if (FRAME_WINDOW_P (f))
7366 { 7365 {
diff --git a/src/xdisp.c b/src/xdisp.c
index 0835ccafd4d..11b14e2cf95 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4978,10 +4978,10 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4978 Lisp_Object height; 4978 Lisp_Object height;
4979 height = safe_call1 (it->font_height, 4979 height = safe_call1 (it->font_height,
4980 face->lface[LFACE_HEIGHT_INDEX]); 4980 face->lface[LFACE_HEIGHT_INDEX]);
4981 if (FIXED_OR_FLOATP (height)) 4981 if (NUMBERP (height))
4982 new_height = XFLOATINT (height); 4982 new_height = XFLOATINT (height);
4983 } 4983 }
4984 else if (FIXED_OR_FLOATP (it->font_height)) 4984 else if (NUMBERP (it->font_height))
4985 { 4985 {
4986 /* Value is a multiple of the canonical char height. */ 4986 /* Value is a multiple of the canonical char height. */
4987 struct face *f; 4987 struct face *f;
@@ -5002,7 +5002,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
5002 value = safe_eval (it->font_height); 5002 value = safe_eval (it->font_height);
5003 value = unbind_to (count, value); 5003 value = unbind_to (count, value);
5004 5004
5005 if (FIXED_OR_FLOATP (value)) 5005 if (NUMBERP (value))
5006 new_height = XFLOATINT (value); 5006 new_height = XFLOATINT (value);
5007 } 5007 }
5008 5008
@@ -5025,7 +5025,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
5025 return 0; 5025 return 0;
5026 5026
5027 value = XCAR (XCDR (spec)); 5027 value = XCAR (XCDR (spec));
5028 if (FIXED_OR_FLOATP (value) && XFLOATINT (value) > 0) 5028 if (NUMBERP (value) && XFLOATINT (value) > 0)
5029 it->space_width = value; 5029 it->space_width = value;
5030 } 5030 }
5031 5031
@@ -5074,7 +5074,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
5074 5074
5075#ifdef HAVE_WINDOW_SYSTEM 5075#ifdef HAVE_WINDOW_SYSTEM
5076 value = XCAR (XCDR (spec)); 5076 value = XCAR (XCDR (spec));
5077 if (FIXED_OR_FLOATP (value)) 5077 if (NUMBERP (value))
5078 { 5078 {
5079 struct face *face = FACE_FROM_ID (it->f, it->face_id); 5079 struct face *face = FACE_FROM_ID (it->f, it->face_id);
5080 it->voffset = - (XFLOATINT (value) 5080 it->voffset = - (XFLOATINT (value)
@@ -15729,8 +15729,8 @@ try_scrolling (Lisp_Object window, bool just_this_one_p,
15729 scroll_max = (max (scroll_step, 15729 scroll_max = (max (scroll_step,
15730 max (arg_scroll_conservatively, temp_scroll_step)) 15730 max (arg_scroll_conservatively, temp_scroll_step))
15731 * frame_line_height); 15731 * frame_line_height);
15732 else if (FIXED_OR_FLOATP (BVAR (current_buffer, scroll_down_aggressively)) 15732 else if (NUMBERP (BVAR (current_buffer, scroll_down_aggressively))
15733 || FIXED_OR_FLOATP (BVAR (current_buffer, scroll_up_aggressively))) 15733 || NUMBERP (BVAR (current_buffer, scroll_up_aggressively)))
15734 /* We're trying to scroll because of aggressive scrolling but no 15734 /* We're trying to scroll because of aggressive scrolling but no
15735 scroll_step is set. Choose an arbitrary one. */ 15735 scroll_step is set. Choose an arbitrary one. */
15736 scroll_max = 10 * frame_line_height; 15736 scroll_max = 10 * frame_line_height;
@@ -15830,7 +15830,7 @@ try_scrolling (Lisp_Object window, bool just_this_one_p,
15830 { 15830 {
15831 aggressive = BVAR (current_buffer, scroll_up_aggressively); 15831 aggressive = BVAR (current_buffer, scroll_up_aggressively);
15832 height = WINDOW_BOX_TEXT_HEIGHT (w); 15832 height = WINDOW_BOX_TEXT_HEIGHT (w);
15833 if (FIXED_OR_FLOATP (aggressive)) 15833 if (NUMBERP (aggressive))
15834 { 15834 {
15835 double float_amount = XFLOATINT (aggressive) * height; 15835 double float_amount = XFLOATINT (aggressive) * height;
15836 int aggressive_scroll = float_amount; 15836 int aggressive_scroll = float_amount;
@@ -15946,7 +15946,7 @@ try_scrolling (Lisp_Object window, bool just_this_one_p,
15946 { 15946 {
15947 aggressive = BVAR (current_buffer, scroll_down_aggressively); 15947 aggressive = BVAR (current_buffer, scroll_down_aggressively);
15948 height = WINDOW_BOX_TEXT_HEIGHT (w); 15948 height = WINDOW_BOX_TEXT_HEIGHT (w);
15949 if (FIXED_OR_FLOATP (aggressive)) 15949 if (NUMBERP (aggressive))
15950 { 15950 {
15951 double float_amount = XFLOATINT (aggressive) * height; 15951 double float_amount = XFLOATINT (aggressive) * height;
15952 int aggressive_scroll = float_amount; 15952 int aggressive_scroll = float_amount;
@@ -17223,8 +17223,8 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
17223 if ((scroll_conservatively 17223 if ((scroll_conservatively
17224 || emacs_scroll_step 17224 || emacs_scroll_step
17225 || temp_scroll_step 17225 || temp_scroll_step
17226 || FIXED_OR_FLOATP (BVAR (current_buffer, scroll_up_aggressively)) 17226 || NUMBERP (BVAR (current_buffer, scroll_up_aggressively))
17227 || FIXED_OR_FLOATP (BVAR (current_buffer, scroll_down_aggressively))) 17227 || NUMBERP (BVAR (current_buffer, scroll_down_aggressively)))
17228 && CHARPOS (startp) >= BEGV 17228 && CHARPOS (startp) >= BEGV
17229 && CHARPOS (startp) <= ZV) 17229 && CHARPOS (startp) <= ZV)
17230 { 17230 {
@@ -17299,13 +17299,13 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
17299 : BVAR (current_buffer, scroll_down_aggressively); 17299 : BVAR (current_buffer, scroll_down_aggressively);
17300 17300
17301 if (!MINI_WINDOW_P (w) 17301 if (!MINI_WINDOW_P (w)
17302 && (scroll_conservatively > SCROLL_LIMIT || FIXED_OR_FLOATP (aggressive))) 17302 && (scroll_conservatively > SCROLL_LIMIT || NUMBERP (aggressive)))
17303 { 17303 {
17304 int pt_offset = 0; 17304 int pt_offset = 0;
17305 17305
17306 /* Setting scroll-conservatively overrides 17306 /* Setting scroll-conservatively overrides
17307 scroll-*-aggressively. */ 17307 scroll-*-aggressively. */
17308 if (!scroll_conservatively && FIXED_OR_FLOATP (aggressive)) 17308 if (!scroll_conservatively && NUMBERP (aggressive))
17309 { 17309 {
17310 double float_amount = XFLOATINT (aggressive); 17310 double float_amount = XFLOATINT (aggressive);
17311 17311
@@ -25520,7 +25520,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
25520 prop = Qnil; 25520 prop = Qnil;
25521 } 25521 }
25522 25522
25523 if (FIXED_OR_FLOATP (prop)) 25523 if (NUMBERP (prop))
25524 { 25524 {
25525 int base_unit = (width_p 25525 int base_unit = (width_p
25526 ? FRAME_COLUMN_WIDTH (it->f) 25526 ? FRAME_COLUMN_WIDTH (it->f)
@@ -25584,8 +25584,8 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
25584 } 25584 }
25585 25585
25586 /* '(NUM)': absolute number of pixels. */ 25586 /* '(NUM)': absolute number of pixels. */
25587 if (FIXED_OR_FLOATP (car)) 25587 if (NUMBERP (car))
25588 { 25588{
25589 double fact; 25589 double fact;
25590 int offset = 25590 int offset =
25591 width_p && align_to && *align_to < 0 ? it->lnum_pixel_width : 0; 25591 width_p && align_to && *align_to < 0 ? it->lnum_pixel_width : 0;
@@ -27852,14 +27852,14 @@ calc_line_height_property (struct it *it, Lisp_Object val, struct font *font,
27852 Lisp_Object face_name = Qnil; 27852 Lisp_Object face_name = Qnil;
27853 int ascent, descent, height; 27853 int ascent, descent, height;
27854 27854
27855 if (NILP (val) || FIXNUMP (val) || (override && EQ (val, Qt))) 27855 if (NILP (val) || INTEGERP (val) || (override && EQ (val, Qt)))
27856 return val; 27856 return val;
27857 27857
27858 if (CONSP (val)) 27858 if (CONSP (val))
27859 { 27859 {
27860 face_name = XCAR (val); 27860 face_name = XCAR (val);
27861 val = XCDR (val); 27861 val = XCDR (val);
27862 if (!FIXED_OR_FLOATP (val)) 27862 if (!NUMBERP (val))
27863 val = make_fixnum (1); 27863 val = make_fixnum (1);
27864 if (NILP (face_name)) 27864 if (NILP (face_name))
27865 { 27865 {
@@ -27903,10 +27903,13 @@ calc_line_height_property (struct it *it, Lisp_Object val, struct font *font,
27903 height = ascent + descent; 27903 height = ascent + descent;
27904 27904
27905 scale: 27905 scale:
27906 /* FIXME: Check for overflow in multiplication or conversion. */
27906 if (FLOATP (val)) 27907 if (FLOATP (val))
27907 height = (int)(XFLOAT_DATA (val) * height); 27908 height = (int)(XFLOAT_DATA (val) * height);
27908 else if (FIXNUMP (val)) 27909 else if (FIXNUMP (val))
27909 height *= XFIXNUM (val); 27910 height *= XFIXNUM (val);
27911 else
27912 height *= bignum_to_intmax (val);
27910 27913
27911 return make_fixnum (height); 27914 return make_fixnum (height);
27912} 27915}
@@ -30770,7 +30773,7 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
30770 Lisp_Object lr, lx0, ly0; 30773 Lisp_Object lr, lx0, ly0;
30771 if (CONSP (circ) 30774 if (CONSP (circ)
30772 && CONSP (XCAR (circ)) 30775 && CONSP (XCAR (circ))
30773 && (lr = XCDR (circ), FIXED_OR_FLOATP (lr)) 30776 && (lr = XCDR (circ), NUMBERP (lr))
30774 && (lx0 = XCAR (XCAR (circ)), FIXNUMP (lx0)) 30777 && (lx0 = XCAR (XCAR (circ)), FIXNUMP (lx0))
30775 && (ly0 = XCDR (XCAR (circ)), FIXNUMP (ly0))) 30778 && (ly0 = XCDR (XCAR (circ)), FIXNUMP (ly0)))
30776 { 30779 {
diff --git a/src/xfaces.c b/src/xfaces.c
index 23822b11261..50593f6804c 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1659,7 +1659,7 @@ check_lface_attrs (Lisp_Object attrs[LFACE_VECTOR_SIZE])
1659 || SYMBOLP (attrs[LFACE_SWIDTH_INDEX])); 1659 || SYMBOLP (attrs[LFACE_SWIDTH_INDEX]));
1660 eassert (UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX]) 1660 eassert (UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX])
1661 || IGNORE_DEFFACE_P (attrs[LFACE_HEIGHT_INDEX]) 1661 || IGNORE_DEFFACE_P (attrs[LFACE_HEIGHT_INDEX])
1662 || FIXED_OR_FLOATP (attrs[LFACE_HEIGHT_INDEX]) 1662 || NUMBERP (attrs[LFACE_HEIGHT_INDEX])
1663 || FUNCTIONP (attrs[LFACE_HEIGHT_INDEX])); 1663 || FUNCTIONP (attrs[LFACE_HEIGHT_INDEX]));
1664 eassert (UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX]) 1664 eassert (UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX])
1665 || IGNORE_DEFFACE_P (attrs[LFACE_WEIGHT_INDEX]) 1665 || IGNORE_DEFFACE_P (attrs[LFACE_WEIGHT_INDEX])
diff --git a/src/xfns.c b/src/xfns.c
index f365241bdb0..e19fcff9b05 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3866,10 +3866,10 @@ This function is an internal primitive--use `make-frame' instead. */)
3866 Also process `min-width' and `min-height' parameters right here 3866 Also process `min-width' and `min-height' parameters right here
3867 because `frame-windows-min-size' needs them. */ 3867 because `frame-windows-min-size' needs them. */
3868 tem = x_get_arg (dpyinfo, parms, Qmin_width, NULL, NULL, RES_TYPE_NUMBER); 3868 tem = x_get_arg (dpyinfo, parms, Qmin_width, NULL, NULL, RES_TYPE_NUMBER);
3869 if (FIXED_OR_FLOATP (tem)) 3869 if (FIXNUMP (tem))
3870 store_frame_param (f, Qmin_width, tem); 3870 store_frame_param (f, Qmin_width, tem);
3871 tem = x_get_arg (dpyinfo, parms, Qmin_height, NULL, NULL, RES_TYPE_NUMBER); 3871 tem = x_get_arg (dpyinfo, parms, Qmin_height, NULL, NULL, RES_TYPE_NUMBER);
3872 if (FIXED_OR_FLOATP (tem)) 3872 if (FIXNUMP (tem))
3873 store_frame_param (f, Qmin_height, tem); 3873 store_frame_param (f, Qmin_height, tem);
3874 adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), 3874 adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
3875 FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, true, 3875 FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, true,
diff --git a/src/xselect.c b/src/xselect.c
index dd3da8e1243..4b28d474a03 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -321,7 +321,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value,
321 Lisp_Object prev_value; 321 Lisp_Object prev_value;
322 322
323 selection_data = list4 (selection_name, selection_value, 323 selection_data = list4 (selection_name, selection_value,
324 INTEGER_TO_CONS (timestamp), frame); 324 INT_TO_INTEGER (timestamp), frame);
325 prev_value = LOCAL_SELECTION (selection_name, dpyinfo); 325 prev_value = LOCAL_SELECTION (selection_name, dpyinfo);
326 326
327 tset_selection_alist 327 tset_selection_alist
@@ -401,16 +401,16 @@ x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
401 if (STRINGP (check) 401 if (STRINGP (check)
402 || VECTORP (check) 402 || VECTORP (check)
403 || SYMBOLP (check) 403 || SYMBOLP (check)
404 || FIXNUMP (check) 404 || INTEGERP (check)
405 || NILP (value)) 405 || NILP (value))
406 return value; 406 return value;
407 /* Check for a value that CONS_TO_INTEGER could handle. */ 407 /* Check for a value that CONS_TO_INTEGER could handle. */
408 else if (CONSP (check) 408 else if (CONSP (check)
409 && FIXNUMP (XCAR (check)) 409 && INTEGERP (XCAR (check))
410 && (FIXNUMP (XCDR (check)) 410 && (INTEGERP (XCDR (check))
411 || 411 ||
412 (CONSP (XCDR (check)) 412 (CONSP (XCDR (check))
413 && FIXNUMP (XCAR (XCDR (check))) 413 && INTEGERP (XCAR (XCDR (check)))
414 && NILP (XCDR (XCDR (check)))))) 414 && NILP (XCDR (XCDR (check))))))
415 return value; 415 return value;
416 416
@@ -1620,9 +1620,9 @@ selection_data_to_lisp_data (struct x_display_info *dpyinfo,
1620 else if (format == 32 && size == sizeof (int)) 1620 else if (format == 32 && size == sizeof (int))
1621 { 1621 {
1622 if (type == XA_INTEGER) 1622 if (type == XA_INTEGER)
1623 return INTEGER_TO_CONS (((int *) data) [0]); 1623 return INT_TO_INTEGER (((int *) data) [0]);
1624 else 1624 else
1625 return INTEGER_TO_CONS (((unsigned int *) data) [0]); 1625 return INT_TO_INTEGER (((unsigned int *) data) [0]);
1626 } 1626 }
1627 else if (format == 16 && size == sizeof (short)) 1627 else if (format == 16 && size == sizeof (short))
1628 { 1628 {
@@ -1668,7 +1668,7 @@ selection_data_to_lisp_data (struct x_display_info *dpyinfo,
1668 for (i = 0; i < size / X_LONG_SIZE; i++) 1668 for (i = 0; i < size / X_LONG_SIZE; i++)
1669 { 1669 {
1670 int j = ((int *) data) [i]; 1670 int j = ((int *) data) [i];
1671 ASET (v, i, INTEGER_TO_CONS (j)); 1671 ASET (v, i, INT_TO_INTEGER (j));
1672 } 1672 }
1673 } 1673 }
1674 else 1674 else
@@ -1676,7 +1676,7 @@ selection_data_to_lisp_data (struct x_display_info *dpyinfo,
1676 for (i = 0; i < size / X_LONG_SIZE; i++) 1676 for (i = 0; i < size / X_LONG_SIZE; i++)
1677 { 1677 {
1678 unsigned int j = ((unsigned int *) data) [i]; 1678 unsigned int j = ((unsigned int *) data) [i];
1679 ASET (v, i, INTEGER_TO_CONS (j)); 1679 ASET (v, i, INT_TO_INTEGER (j));
1680 } 1680 }
1681 } 1681 }
1682 return v; 1682 return v;
@@ -1693,7 +1693,7 @@ static unsigned long
1693cons_to_x_long (Lisp_Object obj) 1693cons_to_x_long (Lisp_Object obj)
1694{ 1694{
1695 if (X_ULONG_MAX <= INTMAX_MAX 1695 if (X_ULONG_MAX <= INTMAX_MAX
1696 || XFIXNUM (FIXNUMP (obj) ? obj : XCAR (obj)) < 0) 1696 || !Fnatnump (CONSP (obj) ? XCAR (obj) : obj))
1697 return cons_to_signed (obj, X_LONG_MIN, min (X_ULONG_MAX, INTMAX_MAX)); 1697 return cons_to_signed (obj, X_LONG_MIN, min (X_ULONG_MAX, INTMAX_MAX));
1698 else 1698 else
1699 return cons_to_unsigned (obj, X_ULONG_MAX); 1699 return cons_to_unsigned (obj, X_ULONG_MAX);
@@ -1759,8 +1759,8 @@ lisp_data_to_selection_data (struct x_display_info *dpyinfo,
1759 *short_ptr = XFIXNUM (obj); 1759 *short_ptr = XFIXNUM (obj);
1760 if (NILP (type)) type = QINTEGER; 1760 if (NILP (type)) type = QINTEGER;
1761 } 1761 }
1762 else if (FIXNUMP (obj) 1762 else if (INTEGERP (obj)
1763 || (CONSP (obj) && FIXNUMP (XCAR (obj)) 1763 || (CONSP (obj) && INTEGERP (XCAR (obj))
1764 && (FIXNUMP (XCDR (obj)) 1764 && (FIXNUMP (XCDR (obj))
1765 || (CONSP (XCDR (obj)) 1765 || (CONSP (XCDR (obj))
1766 && FIXNUMP (XCAR (XCDR (obj))))))) 1766 && FIXNUMP (XCAR (XCDR (obj)))))))
@@ -1846,19 +1846,19 @@ static Lisp_Object
1846clean_local_selection_data (Lisp_Object obj) 1846clean_local_selection_data (Lisp_Object obj)
1847{ 1847{
1848 if (CONSP (obj) 1848 if (CONSP (obj)
1849 && FIXNUMP (XCAR (obj)) 1849 && INTEGERP (XCAR (obj))
1850 && CONSP (XCDR (obj)) 1850 && CONSP (XCDR (obj))
1851 && FIXNUMP (XCAR (XCDR (obj))) 1851 && FIXNUMP (XCAR (XCDR (obj)))
1852 && NILP (XCDR (XCDR (obj)))) 1852 && NILP (XCDR (XCDR (obj))))
1853 obj = Fcons (XCAR (obj), XCDR (obj)); 1853 obj = Fcons (XCAR (obj), XCDR (obj));
1854 1854
1855 if (CONSP (obj) 1855 if (CONSP (obj)
1856 && FIXNUMP (XCAR (obj)) 1856 && INTEGERP (XCAR (obj))
1857 && FIXNUMP (XCDR (obj))) 1857 && FIXNUMP (XCDR (obj)))
1858 { 1858 {
1859 if (XFIXNUM (XCAR (obj)) == 0) 1859 if (EQ (XCAR (obj), make_fixnum (0)))
1860 return XCDR (obj); 1860 return XCDR (obj);
1861 if (XFIXNUM (XCAR (obj)) == -1) 1861 if (EQ (XCAR (obj), make_fixnum (-1)))
1862 return make_fixnum (- XFIXNUM (XCDR (obj))); 1862 return make_fixnum (- XFIXNUM (XCDR (obj)));
1863 } 1863 }
1864 if (VECTORP (obj)) 1864 if (VECTORP (obj))
@@ -2264,10 +2264,10 @@ x_check_property_data (Lisp_Object data)
2264 { 2264 {
2265 Lisp_Object o = XCAR (iter); 2265 Lisp_Object o = XCAR (iter);
2266 2266
2267 if (! FIXED_OR_FLOATP (o) && ! STRINGP (o) && ! CONSP (o)) 2267 if (! NUMBERP (o) && ! STRINGP (o) && ! CONSP (o))
2268 return -1; 2268 return -1;
2269 else if (CONSP (o) && 2269 else if (CONSP (o) &&
2270 (! FIXED_OR_FLOATP (XCAR (o)) || ! FIXED_OR_FLOATP (XCDR (o)))) 2270 (! NUMBERP (XCAR (o)) || ! NUMBERP (XCDR (o))))
2271 return -1; 2271 return -1;
2272 if (size == INT_MAX) 2272 if (size == INT_MAX)
2273 return -1; 2273 return -1;
@@ -2303,7 +2303,7 @@ x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format)
2303 { 2303 {
2304 Lisp_Object o = XCAR (iter); 2304 Lisp_Object o = XCAR (iter);
2305 2305
2306 if (FIXED_OR_FLOATP (o) || CONSP (o)) 2306 if (NUMBERP (o) || CONSP (o))
2307 { 2307 {
2308 if (CONSP (o) 2308 if (CONSP (o)
2309 && RANGED_FIXNUMP (X_LONG_MIN >> 16, XCAR (o), X_LONG_MAX >> 16) 2309 && RANGED_FIXNUMP (X_LONG_MIN >> 16, XCAR (o), X_LONG_MAX >> 16)
@@ -2580,7 +2580,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from,
2580 else 2580 else
2581 error ("DEST as a string must be one of PointerWindow or InputFocus"); 2581 error ("DEST as a string must be one of PointerWindow or InputFocus");
2582 } 2582 }
2583 else if (FIXED_OR_FLOATP (dest) || CONSP (dest)) 2583 else if (NUMBERP (dest) || CONSP (dest))
2584 CONS_TO_INTEGER (dest, Window, wdest); 2584 CONS_TO_INTEGER (dest, Window, wdest);
2585 else 2585 else
2586 error ("DEST must be a frame, nil, string, number or cons"); 2586 error ("DEST must be a frame, nil, string, number or cons");
diff --git a/src/xterm.c b/src/xterm.c
index 06c84463c66..f8ea787e8df 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10507,9 +10507,9 @@ set_wm_state (Lisp_Object frame, bool add, Atom atom, Atom value)
10507 Fcons 10507 Fcons
10508 (make_fixnum (add), 10508 (make_fixnum (add),
10509 Fcons 10509 Fcons
10510 (make_fixnum_or_float (atom), 10510 (INT_TO_INTEGER (atom),
10511 (value != 0 10511 (value != 0
10512 ? list1 (make_fixnum_or_float (value)) 10512 ? list1 (INT_TO_INTEGER (value))
10513 : Qnil)))); 10513 : Qnil))));
10514} 10514}
10515 10515