layouts: most-positive/negative-fixnum return fixnums now
parent
4ae9e71f5c
commit
3e27d06914
|
@ -6,3 +6,6 @@ IN: system.tests
|
||||||
|
|
||||||
! Smoke test
|
! Smoke test
|
||||||
[ t ] [ max-array-capacity cell-bits 2^ < ] unit-test
|
[ t ] [ max-array-capacity cell-bits 2^ < ] unit-test
|
||||||
|
|
||||||
|
[ t ] [ most-negative-fixnum fixnum? ] unit-test
|
||||||
|
[ t ] [ most-positive-fixnum fixnum? ] unit-test
|
||||||
|
|
|
@ -49,10 +49,10 @@ SYMBOL: mega-cache-size
|
||||||
cell-bits (first-bignum) ; inline
|
cell-bits (first-bignum) ; inline
|
||||||
|
|
||||||
: most-positive-fixnum ( -- n )
|
: most-positive-fixnum ( -- n )
|
||||||
first-bignum 1 - ; inline
|
first-bignum 1 - >fixnum ; inline
|
||||||
|
|
||||||
: most-negative-fixnum ( -- n )
|
: most-negative-fixnum ( -- n )
|
||||||
first-bignum neg ; inline
|
first-bignum neg >fixnum ; inline
|
||||||
|
|
||||||
: (max-array-capacity) ( b -- n )
|
: (max-array-capacity) ( b -- n )
|
||||||
5 - 2^ 1 - ; inline
|
5 - 2^ 1 - ; inline
|
||||||
|
|
|
@ -127,7 +127,7 @@ PRIVATE>
|
||||||
|
|
||||||
! Make sure it's a fixnum here to speed up double-hashing.
|
! Make sure it's a fixnum here to speed up double-hashing.
|
||||||
: hashcodes-from-hashcode ( n -- n n )
|
: hashcodes-from-hashcode ( n -- n n )
|
||||||
dup most-positive-fixnum >fixnum bitxor ;
|
dup most-positive-fixnum bitxor ;
|
||||||
|
|
||||||
: hashcodes-from-object ( obj -- n n )
|
: hashcodes-from-object ( obj -- n n )
|
||||||
hashcode abs hashcodes-from-hashcode ;
|
hashcode abs hashcodes-from-hashcode ;
|
||||||
|
|
|
@ -41,7 +41,7 @@ IN: project-euler.044
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: euler044 ( -- answer )
|
: euler044 ( -- answer )
|
||||||
most-positive-fixnum >fixnum
|
most-positive-fixnum
|
||||||
2500 [1,b] [
|
2500 [1,b] [
|
||||||
dup [1,b] [
|
dup [1,b] [
|
||||||
euler044-step
|
euler044-step
|
||||||
|
|
Loading…
Reference in New Issue