@@ -12,7 +12,7 @@ using Printf: @printf
1212 seed1 = 1
1313 seed2 = (1 ,2 )
1414 seed4 = (1 ,2 ,3 ,4 )
15- for (rng, alg, options) in [
15+ alg_choices = [
1616 (Threefry2x (UInt32, seed2) , threefry, (Val (20 ),)) ,
1717 (Threefry2x (UInt64, seed2) , threefry, (Val (20 ),)) ,
1818 (Threefry4x (UInt32, seed4) , threefry, (Val (20 ),)) ,
@@ -21,11 +21,16 @@ using Printf: @printf
2121 (Philox2x (UInt64 , seed1) , philox , (Val (10 ),)) ,
2222 (Philox4x (UInt32 , seed2) , philox , (Val (10 ),)) ,
2323 (Philox4x (UInt64 , seed2) , philox , (Val (10 ),)) ,
24- (AESNI1x (seed1) , aesni , () ) ,
25- (AESNI4x (seed4) , aesni , () ) ,
26- (ARS1x (seed1) , ars , (Val (7 ),) ) ,
27- (ARS4x (seed4) , ars , (Val (7 ),) ) ,
2824 ]
25+ if R123_USE_AESNI
26+ append! (alg_choices, [
27+ (AESNI1x (seed1) , aesni , () ) ,
28+ (AESNI4x (seed4) , aesni , () ) ,
29+ (ARS1x (seed1) , ars , (Val (7 ),) ) ,
30+ (ARS4x (seed4) , ars , (Val (7 ),) ) ,
31+ ])
32+ end
33+ for (rng, alg, options) in alg_choices
2934 key = @inferred get_key (rng)
3035 ctr = @inferred get_ctr (rng)
3136 @test isbitstype (typeof (key))
8994 @test x9 === y9
9095 end
9196
92- rng = ARS1x (1 )
93- @test (rand (rng, UInt128),) === ars (get_key (rng), get_ctr (rng), Val (7 ))
94- @test (rand (rng, UInt128),) === ars (get_key (rng), get_ctr (rng), Val (7 ))
95- @test (rand (rng, UInt128),) === ars (get_key (rng), get_ctr (rng), Val (7 ))
96- @test (rand (rng, UInt128),) === ars (get_key (rng), get_ctr (rng), Val (7 ))
97-
98- rng = AESNI1x (1 )
99- @test (rand (rng, UInt128),) === aesni (get_key (rng), get_ctr (rng))
100- @test (rand (rng, UInt128),) === aesni (get_key (rng), get_ctr (rng))
101- @test (rand (rng, UInt128),) === aesni (get_key (rng), get_ctr (rng))
102- @test (rand (rng, UInt128),) === aesni (get_key (rng), get_ctr (rng))
97+ if R123_USE_AESNI
98+ rng = ARS1x (1 )
99+ @test (rand (rng, UInt128),) === ars (get_key (rng), get_ctr (rng), Val (7 ))
100+ @test (rand (rng, UInt128),) === ars (get_key (rng), get_ctr (rng), Val (7 ))
101+ @test (rand (rng, UInt128),) === ars (get_key (rng), get_ctr (rng), Val (7 ))
102+ @test (rand (rng, UInt128),) === ars (get_key (rng), get_ctr (rng), Val (7 ))
103+
104+ rng = AESNI1x (1 )
105+ @test (rand (rng, UInt128),) === aesni (get_key (rng), get_ctr (rng))
106+ @test (rand (rng, UInt128),) === aesni (get_key (rng), get_ctr (rng))
107+ @test (rand (rng, UInt128),) === aesni (get_key (rng), get_ctr (rng))
108+ @test (rand (rng, UInt128),) === aesni (get_key (rng), get_ctr (rng))
109+ end
103110
104111end
105112
@@ -164,5 +171,7 @@ redirect_stdout(stdout_)
164171compare_dirs (" expected" , " actual" )
165172cd (pwd_)
166173
167- include (" aesni.jl" )
168- include (" ars.jl" )
174+ if Random123. R123_USE_X86_AES_NI
175+ include (" ./x86/aesni.jl" )
176+ include (" ./x86/ars.jl" )
177+ end
0 commit comments