def window_compress16

mylsm-lsm-store@0.6.0.1 · src/hub_sha/core.bend:195

import mylsm-lsm-store@0.6.0.1/src/hub_sha/core.bend as Core
import Base
import mylsm-lsm-store@0.6.0.1/src/hub_sha/state.bend as S

195# Fast path for the 16-word blocks produced by block_bytes. It executes the
196# seed rounds directly and constructs only the fixed rolling window.
197def window_compress16(
198  +word_a: U32,
199  +word_b: U32,
200  +word_c: U32,
201  +word_d: U32,
202  +word_e: U32,
203  +word_f: U32,
204  +word_g: U32,
205  +word_h: U32,
206  +word_i: U32,
207  +word_j: U32,
208  +round_constant: U32,
209  +word_l: U32,
210  +word_m: U32,
211  +count: U32,
212  +word_o: U32,
213  +word_p: U32,
214  +extra: Nat,
215  +ks: List<&2, U32>,
216  +state: S.State
217) -> S.State:
218  match ks:
219    case k0 <> k1 <> k2 <> k3 <> k4 <> k5 <> k6 <> k7 <>
220      k8 <> k9 <> k10 <> k11 <> k12 <> k13 <> k14 <> k15 <> kt:
221      s1 = step(state, k0, word_a)
222      s2 = step(s1, k1, word_b)
223      s3 = step(s2, k2, word_c)
224      s4 = step(s3, k3, word_d)
225      s5 = step(s4, k4, word_e)
226      s6 = step(s5, k5, word_f)
227      s7 = step(s6, k6, word_g)
228      s8 = step(s7, k7, word_h)
229      s9 = step(s8, k8, word_i)
230      s10 = step(s9, k9, word_j)
231      s11 = step(s10, k10, round_constant)
232      s12 = step(s11, k11, word_l)
233      s13 = step(s12, k12, word_m)
234      s14 = step(s13, k13, count)
235      s15 = step(s14, k14, word_o)
236      s16 = step(s15, k15, word_p)
237      feedforward(state, window_rounds(extra,
238        W{word_p, word_o, count, word_m, word_l, round_constant, word_j, word_i, word_h, word_g, word_f, word_e, word_d, word_c, word_b, word_a}, kt, s16))
239    case _:
240      fused_compress([word_a, word_b, word_c, word_d, word_e, word_f, word_g, word_h, word_i, word_j, round_constant, word_l, word_m, count, word_o, word_p], extra, ks, state)

Uses (9)

Used by (1)