def sip.last

bend-kit-hash@0.3.0.2 · hash.bend:631

import bend-kit-hash@0.3.0.2/hash.bend as Hash
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

631# The last block: the len % 8 bytes left, and len mod 256 in the top byte.
632def sip.last(+len: U32, r: Array<U32> & W64, s: S4) -> Bytes.Bytes & W64:
633  (a, W64{+hi, +lo}) = r
634  +k = (len .&. 7 : U32)
635  +top = ((len .&. 255) << 24n : U32)
636  (Bytes.Bytes{len, a}, sip.end(sip.block(s, W64{(sip.keep(hi, Bool.pick(U32, U32.is_lt(4, k), (k - 4 : U32), 0)) .|. top : U32), sip.keep(lo, U32.min(k, 4))})))

Uses (17)

Used by (1)