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

Method new

src/sponges_avx.rs:108–136  ·  view source on GitHub ↗
(
        function_name: &SmallString,
        nonce: u64,
        function_params: &SmallString,
    )

Source from the content-addressed store, hash-verified

106 /// This function is unsafe because it uses SIMD instructions and a union type.
107 #[inline(always)]
108 pub unsafe fn new<const N: usize>(
109 function_name: &SmallString,
110 nonce: u64,
111 function_params: &SmallString,
112 ) -> Self {
113 let mut sponges = <[Sponge; 4]>::default();
114 sponges.iter_mut().enumerate().for_each(|(idx, sponge)| {
115 sponge.fill::<N>(function_name, nonce + idx as u64, function_params)
116 });
117
118 let compute_slices = [
119 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
120 24,
121 ]
122 .map(|idx| {
123 SpongeComputeSlice(if idx < 17 {
124 _mm256_set_epi64x(
125 sponges[3].uint64s[idx] as i64,
126 sponges[2].uint64s[idx] as i64,
127 sponges[1].uint64s[idx] as i64,
128 sponges[0].uint64s[idx] as i64,
129 )
130 } else {
131 _mm256_set1_epi64x(0)
132 })
133 });
134
135 Self { compute_slices }
136 }
137
138 /// # Safety
139 ///

Callers

nothing calls this directly

Calls 1

SpongeComputeSliceClass · 0.85

Tested by

no test coverage detected