def jam_nat
import bend-collections@1.0.0.0/src/math/f64.bend as F64import Base
600# the jam of n >> d (the bits shifted out OR-ed into bit 0)
601def jam_nat(+d: Nat, +n: Nat) -> Nat:
602 Nat.add(Nat.mul(2n, Nat.div(high_bits(d, n), 2n)), Nat.max(Nat.mod(high_bits(d, n), 2n), Nat.min(low_bits(d, n), 1n)))