def W64.small.step

bend-osdev-word64@0.1.1.0 · word64.bend:304

import bend-osdev-word64@0.1.1.0/word64.bend as Word64
import Base

304# a divided by a small d (1 to 65536) and the remainder, through the four
305# 16-bit pieces of a, most significant first: every step fits in 32 bits
306def W64.small.step(+d: U32, qr: U32 & U32, +c: U32) -> U32 & U32:
307  (q, r) = qr
308  +v = U32.add(U32.mul(r, 65536), c)
309  (U32.or(U32.shln(q, 16n), U32.div(v, d)), U32.mod(v, d))

Uses (9)

Used by (2)