@@ -30,13 +30,18 @@ use core::fmt;
3030use core:: hash:: BuildHasher ;
3131use core:: hash:: Hasher ;
3232
33- pub ( crate ) const PI : [ u64 ; 4 ] = [
33+ pub ( crate ) const PI_U64X4 : [ u64 ; 4 ] = [
3434 0x243f_6a88_85a3_08d3 ,
3535 0x1319_8a2e_0370_7344 ,
3636 0xa409_3822_299f_31d0 ,
3737 0x082e_fa98_ec4e_6c89 ,
3838] ;
3939
40+ pub ( crate ) const PI_U128X2 : [ u128 ; 2 ] = [
41+ 0x1319_8a2e_0370_7344_243f_6a88_85a3_08d3 ,
42+ 0x082e_fa98_ec4e_6c89_a409_3822_299f_31d0 ,
43+ ] ;
44+
4045pub ( crate ) const PI2 : [ u64 ; 4 ] = [
4146 0x4528_21e6_38d0_1377 ,
4247 0xbe54_66cf_34e9_0c6c ,
@@ -101,7 +106,7 @@ cfg_if::cfg_if! {
101106 } else {
102107 #[ inline]
103108 fn get_fixed_seeds( ) -> & ' static [ [ u64 ; 4 ] ; 2 ] {
104- & [ PI , PI2 ]
109+ & [ PI_U64X4 , PI2 ]
105110 }
106111 }
107112}
@@ -135,14 +140,14 @@ struct DefaultRandomSource {
135140impl DefaultRandomSource {
136141 fn new ( ) -> DefaultRandomSource {
137142 DefaultRandomSource {
138- counter : AtomicUsize :: new ( & PI as * const _ as usize ) ,
143+ counter : AtomicUsize :: new ( & PI_U64X4 as * const _ as usize ) ,
139144 }
140145 }
141146
142147 #[ cfg( all( target_arch = "arm" , target_os = "none" ) ) ]
143148 const fn default ( ) -> DefaultRandomSource {
144149 DefaultRandomSource {
145- counter : AtomicUsize :: new ( PI [ 3 ] as usize ) ,
150+ counter : AtomicUsize :: new ( PI_U64X4 [ 3 ] as usize ) ,
146151 }
147152 }
148153}
@@ -501,19 +506,19 @@ mod test {
501506 #[ cfg( all( feature = "runtime-rng" , not( all( feature = "compile-time-rng" , test) ) ) ) ]
502507 #[ test]
503508 fn test_not_pi ( ) {
504- assert_ne ! ( PI , get_fixed_seeds( ) [ 0 ] ) ;
509+ assert_ne ! ( PI_U64X4 , get_fixed_seeds( ) [ 0 ] ) ;
505510 }
506511
507512 #[ cfg( all( feature = "compile-time-rng" , any( not( feature = "runtime-rng" ) , test) ) ) ]
508513 #[ test]
509514 fn test_not_pi_const ( ) {
510- assert_ne ! ( PI , get_fixed_seeds( ) [ 0 ] ) ;
515+ assert_ne ! ( PI_U64X4 , get_fixed_seeds( ) [ 0 ] ) ;
511516 }
512517
513518 #[ cfg( all( not( feature = "runtime-rng" ) , not( feature = "compile-time-rng" ) ) ) ]
514519 #[ test]
515520 fn test_pi ( ) {
516- assert_eq ! ( PI , get_fixed_seeds( ) [ 0 ] ) ;
521+ assert_eq ! ( PI_U64X4 , get_fixed_seeds( ) [ 0 ] ) ;
517522 }
518523
519524 #[ test]
0 commit comments