Make >integer faster

db4
Slava Pestov 2008-09-27 11:39:14 -05:00
parent dd69af757a
commit 2fda7b114d
1 changed files with 11 additions and 8 deletions

View File

@ -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) ;