* Added fixnum-width, least-fixnum, greatest-fixnum

This commit is contained in:
Abdulaziz Ghuloum 2007-09-15 02:06:16 -04:00
parent 82a00e2628
commit 96bd57c922
5 changed files with 33 additions and 11 deletions

Binary file not shown.

View File

@ -1,15 +1,20 @@
(library (ikarus singular-objects)
(export base-rtd eof-object void #;fixnum-width)
(export base-rtd eof-object void fixnum-width least-fixnum
greatest-fixnum)
(import
(rename (ikarus system $records) (base-rtd sys:base-rtd))
(rename (ikarus)
(void sys:void)
#; (fixnum-width sys:fixnum-width)
(fixnum-width sys:fixnum-width)
(least-fixnum sys:least-fixnum)
(greatest-fixnum sys:greatest-fixnum)
(eof-object sys:eof-object)))
(define (void) (sys:void))
#; (define (fixnum-width) (sys:fixnum-width))
(define (fixnum-width) (sys:fixnum-width))
(define (least-fixnum) (sys:least-fixnum))
(define (greatest-fixnum) (sys:greatest-fixnum))
(define (eof-object) (sys:eof-object))
(define (base-rtd) (sys:base-rtd)))

View File

@ -459,7 +459,9 @@
[fxarithmetic-shift i]
[fxmin i]
[fxmax i]
[fixnum-width i]
[fixnum-width i]
[least-fixnum i]
[greatest-fixnum i]
[for-each i r]
[map i r]

View File

@ -545,14 +545,26 @@
[(P x) (tag-test (T x) fixnum-mask fixnum-tag)]
[(E x) (nop)])
;(define-primop foo safe
; [(V) (K 0)])
;(define-primop fixnum-width safe
; [(V) (K 0)] ;(K (fxsll (- (* wordsize 8) fx-shift) fx-shift))]
; ;[(E) (nop)]
; ;[(P) (K #t)]
; )
(define-primop fixnum-width safe
[(V) (K (fxsll (- (* wordsize 8) fx-shift) fx-shift))]
[(E) (nop)]
[(P) (K #t)])
(define-primop least-fixnum safe
[(V) (K (sll (- (expt 2 (- (- (* wordsize 8) fx-shift) 1)))
fx-shift))]
[(E) (nop)]
[(P) (K #t)])
(define-primop greatest-fixnum safe
[(V) (K (sll (- (expt 2 (- (- (* wordsize 8) fx-shift) 1)) 1)
fx-shift))]
[(E) (nop)]
[(P) (K #t)])
(define-primop $fxzero? unsafe
[(P x) (prm '= (T x) (K 0))]

View File

@ -257,6 +257,9 @@
[bitwise-rotate-bit-field D bw]
;;;
[fixnum? C fx]
[fixnum-width C fx]
[least-fixnum C fx]
[greatest-fixnum C fx]
[fx* C fx]
[fx*/carry D fx]
[fx+ C fx]