Merge branch 'master' of git://factorcode.org/git/factor

db4
Slava Pestov 2008-09-11 01:21:49 -05:00
commit 2f96db70b5
4 changed files with 3 additions and 5 deletions

View File

@ -5,7 +5,7 @@ cpu.architecture generic kernel kernel.private math memory
namespaces sequences words assocs compiler.generator namespaces sequences words assocs compiler.generator
compiler.generator.registers compiler.generator.fixup system compiler.generator.registers compiler.generator.fixup system
layouts classes words.private alien combinators layouts classes words.private alien combinators
compiler.constants math.order ; compiler.constants math.order make ;
IN: cpu.ppc.architecture IN: cpu.ppc.architecture
! PowerPC register assignments ! PowerPC register assignments

View File

@ -14,7 +14,7 @@ GENERIC: random-32* ( tuple -- r )
GENERIC: random-bytes* ( n tuple -- byte-array ) GENERIC: random-bytes* ( n tuple -- byte-array )
M: object random-bytes* ( n tuple -- byte-array ) M: object random-bytes* ( n tuple -- byte-array )
swap [ drop random-32* ] with map >c-uint-array ; [ random-32* ] curry replicate [ 4 >le ] map concat ;
M: object random-32* ( tuple -- r ) 4 random-bytes* le> ; M: object random-32* ( tuple -- r ) 4 random-bytes* le> ;

View File

@ -11,14 +11,12 @@ IN: blum-blum-shub.tests
[ 70576473 ] [ [ 70576473 ] [
T{ blum-blum-shub f 590695557939 811977232793 } clone [ T{ blum-blum-shub f 590695557939 811977232793 } clone [
32 random-bits 32 random-bits
little-endian? [ <uint> reverse *uint ] unless
] with-random ] with-random
] unit-test ] unit-test
[ 5570804936418322777 ] [ [ 5570804936418322777 ] [
T{ blum-blum-shub f 590695557939 811977232793 } clone [ T{ blum-blum-shub f 590695557939 811977232793 } clone [
64 random-bits 64 random-bits
little-endian? [ <ulonglong> 4 group [ reverse ] map concat *ulonglong ] unless
] with-random ] with-random
] unit-test ] unit-test

View File

@ -13,7 +13,7 @@ TUPLE: blum-blum-shub x n ;
[ [ random-prime ] curry [ 4 mod 3 = ] generate ] dup bi ; [ [ random-prime ] curry [ 4 mod 3 = ] generate ] dup bi ;
: next-bbs-bit ( bbs -- bit ) : next-bbs-bit ( bbs -- bit )
[ [ x>> 2 ] [ n>> ] bi ^mod dup ] keep (>>x) 1 bitand ; dup [ x>> 2 ] [ n>> ] bi ^mod [ >>x drop ] [ 1 bitand ] bi ;
PRIVATE> PRIVATE>