math.integers: faster fixnum-log2.

db4
John Benediktsson 2013-02-27 16:01:34 -08:00
parent 927414c6c5
commit 7ba77673a8
1 changed files with 3 additions and 1 deletions

View File

@ -57,7 +57,9 @@ M: fixnum bitnot fixnum-bitnot ; inline
M: fixnum bit? fixnum-bit? ; inline
: fixnum-log2 ( x -- n )
0 swap [ dup 1 eq? ] [ [ 1 + ] [ 2/ ] bi* ] until drop ; inline
0 swap [ dup 1 eq? ] [
[ 1 fixnum+fast ] [ 2/ ] bi*
] until drop ; inline
M: fixnum (log2) fixnum-log2 ; inline