Make >integer faster
parent
dd69af757a
commit
2fda7b114d
|
@ -25,8 +25,14 @@ SYMBOL: type-numbers
|
|||
: tag-fixnum ( n -- tagged )
|
||||
tag-bits get shift ;
|
||||
|
||||
! We do this in its own compilation unit so that they can be
|
||||
! folded below
|
||||
<<
|
||||
: cell ( -- n ) 7 getenv ; foldable
|
||||
|
||||
: (first-bignum) ( m -- n ) tag-bits get - 1 - 2^ ; foldable
|
||||
>>
|
||||
|
||||
: cells ( m -- n ) cell * ; inline
|
||||
|
||||
: cell-bits ( -- n ) 8 cells ; inline
|
||||
|
@ -37,23 +43,20 @@ SYMBOL: type-numbers
|
|||
|
||||
: bootstrap-cell-bits 8 bootstrap-cells ; inline
|
||||
|
||||
: (first-bignum) ( m -- n )
|
||||
tag-bits get - 1 - 2^ ;
|
||||
|
||||
: first-bignum ( -- n )
|
||||
cell-bits (first-bignum) ;
|
||||
cell-bits (first-bignum) ; inline
|
||||
|
||||
: most-positive-fixnum ( -- n )
|
||||
first-bignum 1- ;
|
||||
first-bignum 1- ; inline
|
||||
|
||||
: most-negative-fixnum ( -- n )
|
||||
first-bignum neg ;
|
||||
first-bignum neg ; inline
|
||||
|
||||
: (max-array-capacity) ( b -- n )
|
||||
5 - 2^ 1- ;
|
||||
5 - 2^ 1- ; inline
|
||||
|
||||
: max-array-capacity ( -- n )
|
||||
cell-bits (max-array-capacity) ;
|
||||
cell-bits (max-array-capacity) ; inline
|
||||
|
||||
: bootstrap-first-bignum ( -- n )
|
||||
bootstrap-cell-bits (first-bignum) ;
|
||||
|
|
Loading…
Reference in New Issue