@@ -50,7 +50,7 @@ fn count_same_bytes_and_nibbles(a: u64, b: u64) -> (i32, i32) {
50
50
( same_byte_count, same_nibble_count)
51
51
}
52
52
53
- fn gen_combinations ( options : & [ u32 ; 8 ] , depth : u32 , so_far : Vec < u32 > , combinations : & mut Vec < Vec < u32 > > ) {
53
+ fn gen_combinations ( options : & [ u32 ; 11 ] , depth : u32 , so_far : Vec < u32 > , combinations : & mut Vec < Vec < u32 > > ) {
54
54
if depth == 0 {
55
55
return ;
56
56
}
@@ -63,8 +63,9 @@ fn gen_combinations(options: &[u32; 8], depth: u32, so_far: Vec<u32>, combinatio
63
63
}
64
64
65
65
fn test_no_full_collisions < T : Hasher > ( gen_hash : impl Fn ( ) -> T ) {
66
- let options: [ u32 ; 8 ] = [
67
- 0x00000000 , 0x20000000 , 0x40000000 , 0x60000000 , 0x80000000 , 0xA0000000 , 0xC0000000 , 0xE0000000 ,
66
+ let options: [ u32 ; 11 ] = [
67
+ 0x00000000 , 0x10000000 , 0x20000000 , 0x40000000 , 0x80000000 , 0xF0000000 ,
68
+ 1 , 2 , 4 , 8 , 15
68
69
] ;
69
70
let mut combinations = Vec :: new ( ) ;
70
71
gen_combinations ( & options, 7 , Vec :: new ( ) , & mut combinations) ;
@@ -89,7 +90,7 @@ fn test_no_full_collisions<T: Hasher>(gen_hash: impl Fn() -> T) {
89
90
map. insert ( hash, array) ;
90
91
}
91
92
}
92
- assert_eq ! ( 2396744 , map. len( ) ) ;
93
+ assert_eq ! ( 21435887 , map. len( ) ) ; //11^7 + 11^6 ...
93
94
}
94
95
95
96
fn test_keys_change_output < T : Hasher > ( constructor : impl Fn ( u128 , u128 ) -> T ) {
@@ -150,9 +151,10 @@ fn assert_each_byte_differs(num: u64, base: u64, alternitives: Vec<u64>) {
150
151
assert_eq ! (
151
152
core:: u64 :: MAX ,
152
153
changed_bits,
153
- "Bits changed: {:x} on num: {:?}" ,
154
+ "Bits changed: {:x} on num: {:?}. base {:x} " ,
154
155
changed_bits,
155
- num
156
+ num,
157
+ base
156
158
) ;
157
159
}
158
160
0 commit comments