Merge branch 'master' of git://factorcode.org/git/factor
commit
2f96db70b5
|
@ -5,7 +5,7 @@ cpu.architecture generic kernel kernel.private math memory
|
|||
namespaces sequences words assocs compiler.generator
|
||||
compiler.generator.registers compiler.generator.fixup system
|
||||
layouts classes words.private alien combinators
|
||||
compiler.constants math.order ;
|
||||
compiler.constants math.order make ;
|
||||
IN: cpu.ppc.architecture
|
||||
|
||||
! PowerPC register assignments
|
||||
|
|
|
@ -14,7 +14,7 @@ GENERIC: random-32* ( tuple -- r )
|
|||
GENERIC: 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> ;
|
||||
|
||||
|
|
|
@ -11,14 +11,12 @@ IN: blum-blum-shub.tests
|
|||
[ 70576473 ] [
|
||||
T{ blum-blum-shub f 590695557939 811977232793 } clone [
|
||||
32 random-bits
|
||||
little-endian? [ <uint> reverse *uint ] unless
|
||||
] with-random
|
||||
] unit-test
|
||||
|
||||
[ 5570804936418322777 ] [
|
||||
T{ blum-blum-shub f 590695557939 811977232793 } clone [
|
||||
64 random-bits
|
||||
little-endian? [ <ulonglong> 4 group [ reverse ] map concat *ulonglong ] unless
|
||||
] with-random
|
||||
] unit-test
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ TUPLE: blum-blum-shub x n ;
|
|||
[ [ random-prime ] curry [ 4 mod 3 = ] generate ] dup bi ;
|
||||
|
||||
: 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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue