Mercurial > hg > xemacs-beta
annotate src/number.h @ 4885:6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
lisp/ChangeLog addition:
2010-01-24 Aidan Kehoe <kehoea@parhasard.net>
Correct the semantics of #'member*, #'eql, #'assoc* in the
presence of bignums; change the integerp byte code to fixnump
semantics.
* bytecomp.el (fixnump, integerp, byte-compile-integerp):
Change the integerp byte code to fixnump; add a byte-compile
method to integerp using fixnump and numberp and avoiding a
funcall most of the time, since in the non-core contexts where
integerp is used, it's mostly distinguishing between fixnums and
things that are not numbers at all.
* byte-optimize.el (side-effect-free-fns, byte-after-unbind-ops)
(byte-compile-side-effect-and-error-free-ops):
Replace the integerp bytecode with fixnump; add fixnump to the
side-effect-free-fns. Add the other extended number type
predicates to the list in passing.
* obsolete.el (floatp-safe): Mark this as obsolete.
* cl.el (eql): Go into more detail in the docstring here. Don't
bother checking whether both arguments are numbers; one is enough,
#'equal will fail correctly if they have distinct types.
(subst): Replace a call to #'integerp (deciding whether to use
#'memq or not) with one to #'fixnump.
Delete most-positive-fixnum, most-negative-fixnum from this file;
they're now always in C, so they can't be modified from Lisp.
* cl-seq.el (member*, assoc*, rassoc*):
Correct these functions in the presence of bignums.
* cl-macs.el (cl-make-type-test): The type test for a fixnum is
now fixnump. Ditch floatp-safe, use floatp instead.
(eql): Correct this compiler macro in the presence of bignums.
(assoc*): Correct this compiler macro in the presence of bignums.
* simple.el (undo):
Change #'integerp to #'fixnump here, since we use #'delq with the
same value as ELT a few lines down.
src/ChangeLog addition:
2010-01-24 Aidan Kehoe <kehoea@parhasard.net>
Fix problems with #'eql, extended number types, and the hash table
implementation; change the Bintegerp bytecode to fixnump semantics
even on bignum builds, since #'integerp can have a fast
implementation in terms of #'fixnump for most of its extant uses,
but not vice-versa.
* lisp.h: Always #include number.h; we want the macros provided in
it, even if the various number types are not available.
* number.h (NON_FIXNUM_NUMBER_P): New macro, giving 1 when its
argument is of non-immediate number type. Equivalent to FLOATP if
WITH_NUMBER_TYPES is not defined.
* elhash.c (lisp_object_eql_equal, lisp_object_eql_hash):
Use NON_FIXNUM_NUMBER_P in these functions, instead of FLOATP,
giving more correct behaviour in the presence of the extended
number types.
* bytecode.c (Bfixnump, execute_optimized_program):
Rename Bintegerp to Bfixnump; change its semantics to reflect the
new name on builds with bignum support.
* data.c (Ffixnump, Fintegerp, syms_of_data, vars_of_data):
Always make #'fixnump available, even on non-BIGNUM builds;
always implement #'integerp in this file, even on BIGNUM builds.
Move most-positive-fixnum, most-negative-fixnum here from
number.c, so they are Lisp constants even on builds without number
types, and attempts to change or bind them error.
Use the NUMBERP and INTEGERP macros even on builds without
extended number types.
* data.c (fixnum_char_or_marker_to_int):
Rename this function from integer_char_or_marker_to_int, to better
reflect the arguments it accepts.
* number.c (Fevenp, Foddp, syms_of_number):
Never provide #'integerp in this file. Remove #'oddp,
#'evenp; their implementations are overridden by those in cl.el.
* number.c (vars_of_number):
most-positive-fixnum, most-negative-fixnum are no longer here.
man/ChangeLog addition:
2010-01-23 Aidan Kehoe <kehoea@parhasard.net>
Generally: be careful to say fixnum, not integer, when talking
about fixed-precision integral types. I'm sure I've missed
instances, both here and in the docstrings, but this is a decent
start.
* lispref/text.texi (Columns):
Document where only fixnums, not integers generally, are accepted.
(Registers):
Remove some ancient char-int confoundance here.
* lispref/strings.texi (Creating Strings, Creating Strings):
Be more exact in describing where fixnums but not integers in
general are accepted.
(Creating Strings): Use a more contemporary example to illustrate
how concat deals with lists including integers about #xFF. Delete
some obsolete documentation on same.
(Char Table Types): Document that only fixnums are accepted as
values in syntax tables.
* lispref/searching.texi (String Search, Search and Replace):
Be exact in describing where fixnums but not integers in general
are accepted.
* lispref/range-tables.texi (Range Tables): Be exact in describing
them; only fixnums are accepted to describe ranges.
* lispref/os.texi (Killing XEmacs, User Identification)
(Time of Day, Time Conversion):
Be more exact about using fixnum where only fixed-precision
integers are accepted.
* lispref/objects.texi (Integer Type): Be more exact (and
up-to-date) about the possible values for
integers. Cross-reference to documentation of the bignum extension.
(Equality Predicates):
(Range Table Type):
(Array Type): Use fixnum, not integer, to describe a
fixed-precision integer.
(Syntax Table Type): Correct some English syntax here.
* lispref/numbers.texi (Numbers): Change the phrasing here to use
fixnum to mean the fixed-precision integers normal in emacs.
Document that our terminology deviates from that of Common Lisp,
and that we're working on it.
(Compatibility Issues): Reiterate the Common Lisp versus Emacs
Lisp compatibility issues.
(Comparison of Numbers, Arithmetic Operations):
* lispref/commands.texi (Command Loop Info, Working With Events):
* lispref/buffers.texi (Modification Time):
Be more exact in describing where fixnums but not integers in
general are accepted.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 24 Jan 2010 15:21:27 +0000 |
parents | 2fc0e2f18322 |
children | db2db229ee82 |
rev | line source |
---|---|
1983 | 1 /* Definitions of numeric types for XEmacs. |
2 Copyright (C) 2004 Jerry James. | |
3 | |
4 This file is part of XEmacs. | |
5 | |
6 XEmacs is free software; you can redistribute it and/or modify it | |
7 under the terms of the GNU General Public License as published by the | |
8 Free Software Foundation; either version 2, or (at your option) any | |
9 later version. | |
10 | |
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with XEmacs; see the file COPYING. If not, write to | |
4802
2fc0e2f18322
Don't create any bignums before pdumping. Add bignum, ratio, and bigfloat
Jerry James <james@xemacs.org>
parents:
4678
diff
changeset
|
18 the Free Software Foundation, Inc., 51 Franklin St - Fifth Floor, |
2fc0e2f18322
Don't create any bignums before pdumping. Add bignum, ratio, and bigfloat
Jerry James <james@xemacs.org>
parents:
4678
diff
changeset
|
19 Boston, MA 02111-1301, USA. */ |
1983 | 20 |
21 /* Synched up with: Not in FSF. */ | |
22 | |
23 #ifndef INCLUDED_number_h_ | |
24 #define INCLUDED_number_h_ | |
25 | |
26 /* The following types are always defined in the same manner: | |
27 fixnum = whatever fits in the Lisp_Object type | |
28 integer = union (fixnum, bignum) | |
29 rational = union (integer, ratio) | |
30 float = C double | |
31 floating = union(float, bigfloat) Anybody got a better name? | |
32 real = union (rational, floating) | |
33 number = real (should be union(real, complex) but no complex yet) | |
34 | |
35 It is up to the library-specific code to define the remaining types, | |
36 namely: bignum, ratio, and bigfloat. Not all of these types may be | |
37 available. The top-level configure script should define the symbols | |
38 HAVE_BIGNUM, HAVE_RATIO, and HAVE_BIGFLOAT to indicate which it provides. | |
39 If some type is not defined by the library, this is what happens: | |
40 | |
41 - bignum: bignump(x) is false for all x; any attempt to create a bignum | |
42 causes an error to be raised. | |
43 | |
44 - ratio: we define our own structure consisting of two Lisp_Objects, which | |
45 are presumed to be integers (i.e., either fixnums or bignums). We do our | |
46 own GCD calculation, which is bound to be slow, to keep the ratios | |
47 reduced to canonical form. (FIXME: Not yet implemented.) | |
48 | |
49 - bigfloat: bigfloat(x) is false for all x; any attempt to create a | |
50 bigfloat causes an error to be raised. | |
51 | |
52 We (provide) the following symbols, so that Lisp code has some hope of | |
53 using this correctly: | |
54 | |
55 - (provide 'bignum) if HAVE_BIGNUM | |
56 - (provde 'ratio) if HAVE_RATIO | |
57 - (provide 'bigfloat) if HAVE_BIGFLOAT | |
58 */ | |
59 | |
60 /* Load the library definitions */ | |
61 #ifdef WITH_GMP | |
62 #include "number-gmp.h" | |
63 #endif | |
64 #ifdef WITH_MP | |
65 #include "number-mp.h" | |
66 #endif | |
67 | |
68 | |
69 /********************************* Bignums **********************************/ | |
70 #ifdef HAVE_BIGNUM | |
71 | |
72 struct Lisp_Bignum | |
73 { | |
74 struct lrecord_header lheader; | |
75 bignum data; | |
76 }; | |
77 typedef struct Lisp_Bignum Lisp_Bignum; | |
78 | |
79 DECLARE_LRECORD (bignum, Lisp_Bignum); | |
80 #define XBIGNUM(x) XRECORD (x, bignum, Lisp_Bignum) | |
81 #define wrap_bignum(p) wrap_record (p, bignum) | |
82 #define BIGNUMP(x) RECORDP (x, bignum) | |
83 #define CHECK_BIGNUM(x) CHECK_RECORD (x, bignum) | |
84 #define CONCHECK_BIGNUM(x) CONCHECK_RECORD (x, bignum) | |
85 | |
86 #define bignum_data(b) (b)->data | |
87 #define XBIGNUM_DATA(x) bignum_data (XBIGNUM (x)) | |
88 | |
89 #define BIGNUM_ARITH_RETURN(b,op) do \ | |
90 { \ | |
91 Lisp_Object retval = make_bignum (0); \ | |
92 bignum_##op (XBIGNUM_DATA (retval), XBIGNUM_DATA (b)); \ | |
93 return Fcanonicalize_number (retval); \ | |
94 } while (0) | |
95 | |
96 #define BIGNUM_ARITH_RETURN1(b,op,arg) do \ | |
97 { \ | |
98 Lisp_Object retval = make_bignum(0); \ | |
99 bignum_##op (XBIGNUM_DATA (retval), XBIGNUM_DATA (b), arg); \ | |
100 return Fcanonicalize_number (retval); \ | |
101 } while (0) | |
102 | |
3391 | 103 #if SIZEOF_EMACS_INT == SIZEOF_LONG |
104 # define bignum_fits_emacs_int_p(b) bignum_fits_long_p(b) | |
105 # define bignum_to_emacs_int(b) bignum_to_long(b) | |
106 #elif SIZEOF_EMACS_INT == SIZEOF_INT | |
107 # define bignum_fits_emacs_int_p(b) bignum_fits_int_p(b) | |
108 # define bignum_to_emacs_int(b) bignum_to_int(b) | |
109 #else | |
110 # error Bignums currently do not work with long long Emacs integers. | |
111 #endif | |
112 | |
1983 | 113 extern Lisp_Object make_bignum (long); |
114 extern Lisp_Object make_bignum_bg (bignum); | |
115 extern bignum scratch_bignum, scratch_bignum2; | |
116 | |
117 #else /* !HAVE_BIGNUM */ | |
118 | |
119 #define BIGNUMP(x) 0 | |
120 #define CHECK_BIGNUM(x) dead_wrong_type_argument (Qbignump, x) | |
121 #define CONCHECK_BIGNUM(x) dead_wrong_type_argument (Qbignump, x) | |
122 typedef void bignum; | |
123 #define make_bignum(l) This XEmacs does not support bignums | |
124 #define make_bignum_bg(b) This XEmacs does not support bignums | |
125 | |
126 #endif /* HAVE_BIGNUM */ | |
127 | |
2092 | 128 extern Lisp_Object Qbignump; |
1983 | 129 EXFUN (Fbignump, 1); |
130 | |
131 | |
132 /********************************* Integers *********************************/ | |
133 extern Lisp_Object Qintegerp; | |
134 | |
135 #define INTEGERP(x) (INTP(x) || BIGNUMP(x)) | |
136 #define CHECK_INTEGER(x) do { \ | |
137 if (!INTEGERP (x)) \ | |
138 dead_wrong_type_argument (Qintegerp, x); \ | |
139 } while (0) | |
140 #define CONCHECK_INTEGER(x) do { \ | |
141 if (!INTEGERP (x)) \ | |
142 x = wrong_type_argument (Qintegerp, x); \ | |
143 } while (0) | |
144 | |
145 #ifdef HAVE_BIGNUM | |
146 #define make_integer(x) \ | |
147 (NUMBER_FITS_IN_AN_EMACS_INT (x) ? make_int (x) : make_bignum (x)) | |
148 #else | |
149 #define make_integer(x) make_int (x) | |
150 #endif | |
151 | |
152 extern Fixnum Vmost_negative_fixnum, Vmost_positive_fixnum; | |
153 EXFUN (Fintegerp, 1); | |
154 EXFUN (Fevenp, 1); | |
155 EXFUN (Foddp, 1); | |
156 | |
157 | |
158 /********************************** Ratios **********************************/ | |
159 #ifdef HAVE_RATIO | |
160 | |
161 struct Lisp_Ratio | |
162 { | |
163 struct lrecord_header lheader; | |
164 ratio data; | |
165 }; | |
166 typedef struct Lisp_Ratio Lisp_Ratio; | |
167 | |
168 DECLARE_LRECORD (ratio, Lisp_Ratio); | |
169 #define XRATIO(x) XRECORD (x, ratio, Lisp_Ratio) | |
170 #define wrap_ratio(p) wrap_record (p, ratio) | |
171 #define RATIOP(x) RECORDP (x, ratio) | |
172 #define CHECK_RATIO(x) CHECK_RECORD (x, ratio) | |
173 #define CONCHECK_RATIO(x) CONCHECK_RECORD (x, ratio) | |
174 | |
175 #define ratio_data(r) (r)->data | |
176 | |
177 #define XRATIO_DATA(r) ratio_data (XRATIO (r)) | |
178 #define XRATIO_NUMERATOR(r) ratio_numerator (XRATIO_DATA (r)) | |
179 #define XRATIO_DENOMINATOR(r) ratio_denominator (XRATIO_DATA (r)) | |
180 | |
181 #define RATIO_ARITH_RETURN(r,op) do \ | |
182 { \ | |
183 Lisp_Object retval = make_ratio (0L, 1UL); \ | |
184 ratio_##op (XRATIO_DATA (retval), XRATIO_DATA (r)); \ | |
185 return Fcanonicalize_number (retval); \ | |
186 } while (0) | |
187 | |
188 #define RATIO_ARITH_RETURN1(r,op,arg) do \ | |
189 { \ | |
190 Lisp_Object retval = make_ratio (0L, 1UL); \ | |
191 ratio_##op (XRATIO_DATA (retval), XRATIO_DATA (r), arg); \ | |
192 return Fcanonicalize_number (retval); \ | |
193 } while (0) | |
194 | |
195 extern Lisp_Object make_ratio (long, unsigned long); | |
196 extern Lisp_Object make_ratio_bg (bignum, bignum); | |
197 extern Lisp_Object make_ratio_rt (ratio); | |
4678
b5e1d4f6b66f
Make #'floor, #'ceiling, #'round, #'truncate conform to Common Lisp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
3391
diff
changeset
|
198 extern ratio scratch_ratio, scratch_ratio2; |
1983 | 199 |
200 #else /* !HAVE_RATIO */ | |
201 | |
202 #define RATIOP(x) 0 | |
203 #define CHECK_RATIO(x) dead_wrong_type_argument (Qratiop, x) | |
204 #define CONCHECK_RATIO(x) dead_wrong_type_argument (Qratiop, x) | |
205 typedef void ratio; | |
206 #define make_ratio(n,d) This XEmacs does not support ratios | |
207 #define make_ratio_bg(n,d) This XEmacs does not support ratios | |
208 | |
209 #endif /* HAVE_RATIO */ | |
210 | |
2092 | 211 extern Lisp_Object Qratiop; |
1983 | 212 EXFUN (Fratiop, 1); |
213 | |
214 | |
215 /******************************** Rationals *********************************/ | |
216 extern Lisp_Object Qrationalp; | |
217 | |
218 #define RATIONALP(x) (INTEGERP(x) || RATIOP(x)) | |
219 #define CHECK_RATIONAL(x) do { \ | |
220 if (!RATIONALP (x)) \ | |
221 dead_wrong_type_argument (Qrationalp, x); \ | |
222 } while (0) | |
223 #define CONCHECK_RATIONAL(x) do { \ | |
224 if (!RATIONALP (x)) \ | |
225 x = wrong_type_argument (Qrationalp, x); \ | |
226 } while (0) | |
227 | |
228 EXFUN (Frationalp, 1); | |
229 EXFUN (Fnumerator, 1); | |
230 EXFUN (Fdenominator, 1); | |
231 | |
232 | |
233 /******************************** Bigfloats *********************************/ | |
234 #ifdef HAVE_BIGFLOAT | |
235 struct Lisp_Bigfloat | |
236 { | |
237 struct lrecord_header lheader; | |
238 bigfloat bf; | |
239 }; | |
240 typedef struct Lisp_Bigfloat Lisp_Bigfloat; | |
241 | |
242 DECLARE_LRECORD (bigfloat, Lisp_Bigfloat); | |
243 #define XBIGFLOAT(x) XRECORD (x, bigfloat, Lisp_Bigfloat) | |
244 #define wrap_bigfloat(p) wrap_record (p, bigfloat) | |
245 #define BIGFLOATP(x) RECORDP (x, bigfloat) | |
246 #define CHECK_BIGFLOAT(x) CHECK_RECORD (x, bigfloat) | |
247 #define CONCHECK_BIGFLOAT(x) CONCHECK_RECORD (x, bigfloat) | |
248 | |
249 #define bigfloat_data(f) ((f)->bf) | |
250 #define XBIGFLOAT_DATA(x) bigfloat_data (XBIGFLOAT (x)) | |
251 #define XBIGFLOAT_GET_PREC(x) bigfloat_get_prec (XBIGFLOAT_DATA (x)) | |
252 #define XBIGFLOAT_SET_PREC(x,p) bigfloat_set_prec (XBIGFLOAT_DATA (x), p) | |
253 | |
4678
b5e1d4f6b66f
Make #'floor, #'ceiling, #'round, #'truncate conform to Common Lisp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
3391
diff
changeset
|
254 #define BIGFLOAT_ARITH_RETURN(f,op) do \ |
b5e1d4f6b66f
Make #'floor, #'ceiling, #'round, #'truncate conform to Common Lisp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
3391
diff
changeset
|
255 { \ |
b5e1d4f6b66f
Make #'floor, #'ceiling, #'round, #'truncate conform to Common Lisp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
3391
diff
changeset
|
256 Lisp_Object retval = make_bigfloat (0.0, bigfloat_get_default_prec()); \ |
1983 | 257 bigfloat_##op (XBIGFLOAT_DATA (retval), XBIGFLOAT_DATA (f)); \ |
258 return retval; \ | |
259 } while (0) | |
260 | |
261 #define BIGFLOAT_ARITH_RETURN1(f,op,arg) do \ | |
262 { \ | |
4678
b5e1d4f6b66f
Make #'floor, #'ceiling, #'round, #'truncate conform to Common Lisp.
Aidan Kehoe <kehoea@parhasard.net>
parents:
3391
diff
changeset
|
263 Lisp_Object retval = make_bigfloat (0.0, bigfloat_get_default_prec()); \ |
1983 | 264 bigfloat_##op (XBIGFLOAT_DATA (retval), XBIGFLOAT_DATA (f), arg); \ |
265 return retval; \ | |
266 } while (0) | |
267 | |
268 extern Lisp_Object make_bigfloat (double, unsigned long); | |
269 extern Lisp_Object make_bigfloat_bf (bigfloat); | |
270 extern Lisp_Object Vdefault_float_precision; | |
271 extern bigfloat scratch_bigfloat, scratch_bigfloat2; | |
272 | |
273 #else /* !HAVE_BIGFLOAT */ | |
274 | |
275 #define BIGFLOATP(x) 0 | |
276 #define CHECK_BIGFLOAT(x) dead_wrong_type_argument (Qbigfloatp, x) | |
277 #define CONCHECK_BIGFLOAT(x) dead_wrong_type_argument (Qbigfloatp, x) | |
278 typedef void bigfloat; | |
279 #define make_bigfloat(f) This XEmacs does not support bigfloats | |
280 #define make_bigfloat_bf(f) This XEmacs does not support bigfloast | |
281 | |
282 #endif /* HAVE_BIGFLOAT */ | |
283 | |
2092 | 284 extern Lisp_Object Qbigfloatp; |
1983 | 285 EXFUN (Fbigfloatp, 1); |
286 | |
287 /********************************* Floating *********************************/ | |
288 extern Lisp_Object Qfloatingp, Qbigfloat; | |
289 extern Lisp_Object Qread_default_float_format, Vread_default_float_format; | |
290 | |
291 #define FLOATINGP(x) (FLOATP (x) || BIGFLOATP (x)) | |
292 #define CHECK_FLOATING(x) do { \ | |
293 if (!FLOATINGP (x)) \ | |
294 dead_wrong_type_argument (Qfloatingp, x); \ | |
295 } while (0) | |
296 #define CONCHECK_FLOATING(x) do { \ | |
297 if (!FLOATINGP (x)) \ | |
298 x = wrong_type_argument (Qfloating, x); \ | |
299 } while (0) | |
300 | |
2057 | 301 extern Lisp_Object make_floating (double); |
1983 | 302 EXFUN (Ffloatp, 1); |
303 | |
304 | |
305 /********************************** Reals ***********************************/ | |
306 extern Lisp_Object Qrealp; | |
307 | |
308 #define REALP(x) (RATIONALP (x) || FLOATINGP (x)) | |
309 #define CHECK_REAL(x) do { \ | |
310 if (!REALP (x)) \ | |
311 dead_wrong_type_argument (Qrealp, x); \ | |
312 } while (0) | |
313 #define CONCHECK_REAL(x) do { \ | |
314 if (!REALP (x)) \ | |
315 x = wrong_type_argument (Qrealp, x); \ | |
316 } while (0) | |
317 | |
318 EXFUN (Frealp, 1); | |
319 | |
320 | |
321 /********************************* Numbers **********************************/ | |
322 extern Lisp_Object Qnumberp; | |
323 | |
324 #define NUMBERP(x) REALP (x) | |
325 #define CHECK_NUMBER(x) do { \ | |
326 if (!NUMBERP (x)) \ | |
327 dead_wrong_type_argument (Qnumberp, x); \ | |
328 } while (0) | |
329 #define CONCHECK_NUMBER(x) do { \ | |
330 if (!NUMBERP (x)) \ | |
331 x = wrong_type_argument (Qnumberp, x); \ | |
332 } while (0) | |
333 | |
334 EXFUN (Fcanonicalize_number, 1); | |
335 | |
336 enum number_type {FIXNUM_T, BIGNUM_T, RATIO_T, FLOAT_T, BIGFLOAT_T}; | |
337 | |
1995 | 338 extern enum number_type get_number_type (Lisp_Object); |
1983 | 339 extern enum number_type promote_args (Lisp_Object *, Lisp_Object *); |
340 | |
4885
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
341 #ifdef WITH_NUMBER_TYPES |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
342 DECLARE_INLINE_HEADER ( |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
343 int |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
344 non_fixnum_number_p (Lisp_Object object)) |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
345 { |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
346 if (LRECORDP (object)) |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
347 { |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
348 switch (XRECORD_LHEADER (object)->type) |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
349 { |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
350 case lrecord_type_float: |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
351 #ifdef HAVE_BIGNUM |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
352 case lrecord_type_bignum: |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
353 #endif |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
354 #ifdef HAVE_RATIO |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
355 case lrecord_type_ratio: |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
356 #endif |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
357 #ifdef HAVE_BIGFLOAT |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
358 case lrecord_type_bigfloat: |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
359 #endif |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
360 return 1; |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
361 } |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
362 } |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
363 return 0; |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
364 } |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
365 #define NON_FIXNUM_NUMBER_P(X) non_fixnum_number_p (X) |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
366 |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
367 #else |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
368 #define NON_FIXNUM_NUMBER_P FLOATP |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
369 #endif |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
370 |
6772ce4d982b
Fix hash tables, #'member*, #'assoc*, #'eql compiler macros if bignums
Aidan Kehoe <kehoea@parhasard.net>
parents:
4802
diff
changeset
|
371 |
1983 | 372 #endif /* INCLUDED_number_h_ */ |