1 (define-module (lang elisp primitives numbers)
2 #:use-module (lang elisp internals fset)
3 #:use-module (lang elisp internals null))
7 (fset 'integerp (lambda->nil integer?))
21 (define (lsh num shift)
25 ;; Logical shift to the right. Do an arithmetic
26 ;; shift and then mask out the sign bit.
27 (lsh (logand (ash num -1) most-positive-fixnum)
30 ;; Logical shift to the left. Guile's ash will
31 ;; always preserve the sign of the result, which is
32 ;; not what we want for lsh, so we need to work
34 (let ((new-sign-bit (ash (logand num
35 (logxor most-positive-fixnum
36 (ash most-positive-fixnum -1)))
38 (lsh (logxor new-sign-bit
39 (ash (logand num most-positive-fixnum) 1))
43 (fset 'numberp (lambda->nil number?))