def est_pick
import bend-collections@1.0.0.0/src/math/w64.bend as W64import Base
import bend-collections@1.0.0.0/src/math/u64.bend as W
330# min(floor(y / d), 2^32 - 1) for d > 0: when hi(y) >= d the quotient needs
331# more than 32 bits; otherwise the high word is its own remainder, and div32's
332# two 16-bit Nat digit steps finish the division without dividing the high
333# word.
334def est_pick(+y: W.U64, +d: U32, big: Bool) -> U32:
335 match big:
336 case True{}:
337 4294967295
338 case False{}:
339 est_mid(lo(y), dig_t(U32.to_nat(hi(y)), 65536n, dig1(lo(y))), U32.to_nat(d))