MCPcopy Create free account
hub / github.com/Vectorized/function-selector-miner / equivalent

Function equivalent

src/sponges_avx.rs:157–189  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

155
156#[test]
157fn equivalent() {
158 unsafe {
159 let mut s = Sponge::default();
160
161 let function_name = SmallString::new("foo");
162 let function_params = SmallString::new("foo");
163 s.fill::<0>(&function_name, 0, &function_params);
164 let mut s_avx = SpongesAvx::new(&function_name, 0, &function_params);
165 assert_eq!(s.uint64s[0], s_avx.compute_slices[0].vals()[0]);
166
167 let b = &mut [0u64; 5];
168 let b_avx = &mut [SpongeComputeSlice::default(); 5];
169 assert_eq!(b[0], b_avx[0].vals()[0]);
170
171 const X1: u64 = 0x0000000000000001;
172 const X2: u64 = 0x0000000000008082;
173
174 crate::iter(&mut s.uint64s, b, X1);
175 crate::iter(&mut s_avx.compute_slices, b_avx, X1);
176 assert_eq!(b[0], b_avx[0].vals()[0]);
177
178 crate::iter(&mut s.uint64s, b, X2);
179 crate::iter(&mut s_avx.compute_slices, b_avx, X2);
180 assert_eq!(b[0], b_avx[0].vals()[0]);
181
182 let c0 = s.compute_selectors();
183 let c1 = s_avx.compute_selectors();
184 println!("c0: {:X?}", c0);
185 println!("c1: {:X?}", c1);
186 assert_eq!(c0, c1[0], "compute_selectors() failed");
187 assert_eq!(c0, 0x67E41DE3)
188 }
189}
190
191#[test]
192fn ops() {

Callers

nothing calls this directly

Calls 2

iterFunction · 0.85
compute_selectorsMethod · 0.45

Tested by

no test coverage detected