Mercurial > hg > xemacs-beta
comparison lisp/cl-macs.el @ 5379:a32a108ae815
#'cl-non-fixnum-number-p: return t for integers > #x3fffffff and < -#x40000000
2011-03-21 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (cl-non-fixnum-number-p):
This should return t under 64-bit builds for fixnums that would
be bignums on a 32-bit machine; make it so.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Mon, 21 Mar 2011 12:19:25 +0000 |
parents | 4b529b940e2e |
children | 919c77c567bb |
comparison
equal
deleted
inserted
replaced
5378:4f0a1f4cc111 | 5379:a32a108ae815 |
---|---|
3228 (and unsafe (list (list argn argv)))) | 3228 (and unsafe (list (list argn argv)))) |
3229 (list (list argn argv)))) | 3229 (list (list argn argv)))) |
3230 argns argvs))) | 3230 argns argvs))) |
3231 (if lets (list 'let lets body) body)))) | 3231 (if lets (list 'let lets body) body)))) |
3232 | 3232 |
3233 ;; When a 64-bit build is byte-compiling code, some of its native fixnums | |
3234 ;; will not be represented as fixnums if the byte-compiled code is read by | |
3235 ;; the Lisp reader in a 32-bit build. So in that case we need to check the | |
3236 ;; range of fixnums as well as their types. XEmacs doesn't support machines | |
3237 ;; with word size less than 32, so it's OK to have that as the minimum. | |
3238 (macrolet | |
3239 ((most-negative-fixnum-on-32-bit-machines () (lognot (1- (lsh 1 30)))) | |
3240 (most-positive-fixnum-on-32-bit-machines () (lsh 1 30))) | |
3241 (defun cl-non-fixnum-number-p (object) | |
3242 "Return t if OBJECT is a number not guaranteed to be immediate." | |
3243 (and (numberp object) | |
3244 (or (not (fixnump object)) | |
3245 (not (<= (most-negative-fixnum-on-32-bit-machines) | |
3246 object | |
3247 (most-positive-fixnum-on-32-bit-machines))))))) | |
3233 | 3248 |
3234 ;;; Compile-time optimizations for some functions defined in this package. | 3249 ;;; Compile-time optimizations for some functions defined in this package. |
3235 ;;; Note that cl.el arranges to force cl-macs to be loaded at compile-time, | 3250 ;;; Note that cl.el arranges to force cl-macs to be loaded at compile-time, |
3236 ;;; mainly to make sure these macros will be present. | 3251 ;;; mainly to make sure these macros will be present. |
3237 | |
3238 (defun cl-non-fixnum-number-p (object) | |
3239 (and (numberp object) (not (fixnump object)))) | |
3240 | 3252 |
3241 (define-compiler-macro eql (&whole form a b) | 3253 (define-compiler-macro eql (&whole form a b) |
3242 (cond ((eq (cl-const-expr-p a) t) | 3254 (cond ((eq (cl-const-expr-p a) t) |
3243 (let ((val (cl-const-expr-val a))) | 3255 (let ((val (cl-const-expr-val a))) |
3244 (if (cl-non-fixnum-number-p val) | 3256 (if (cl-non-fixnum-number-p val) |