def window_rounds

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

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

152# A fixed rolling window drops schedule words as soon as they are older than 16
153# rounds. This avoids growing and reference-counting the reverse history list.
154def window_rounds(rounds_left: Nat, win: ShaWindow, ks: List<&2, U32>, state: S.State) -> S.State:
155  match rounds_left win ks:
156    case 0n _ _:
157      state
158    case 1n+q _ Nil{}:
159      state
160    case 1n+q W{a, +b, c, d, e, f, +g, h, i, j, l, m, o, r, +t, +u} k <> kt:
161      +w = (small1(b) + g + small0(t) + u : U32)
162      window_rounds(q, W{w, a, b, c, d, e, f, g, h, i, j, l, m, o, r, t}, kt,
163        step(state, k, w))

Uses (9)

Used by (2)