fix next-power-of-2

cvs
Slava Pestov 2005-11-23 04:29:21 +00:00
parent 52e24115ea
commit a06c259947
2 changed files with 3 additions and 3 deletions

View File

@ -25,11 +25,11 @@ UNION: integer fixnum bignum ;
2dup >= [
drop
] [
>r 1 shift 1 max r> (next-power-of-2)
>r 1 shift r> (next-power-of-2)
] if ;
: next-power-of-2 ( n -- n )
0 swap (next-power-of-2) ;
1 swap (next-power-of-2) ;
IN: math-internals

View File

@ -83,7 +83,7 @@ unit-test
[ 0 ] [ -7/8 ceiling ] unit-test
[ -1 ] [ -3/2 ceiling ] unit-test
[ 0 ] [ 0 next-power-of-2 ] unit-test
[ 1 ] [ 0 next-power-of-2 ] unit-test
[ 1 ] [ 1 next-power-of-2 ] unit-test
[ 2 ] [ 2 next-power-of-2 ] unit-test
[ 4 ] [ 3 next-power-of-2 ] unit-test