def word64.shr
import bendonnect-rpc@0.1.0.0/src/pb.bend as Pbimport Base
import bend-kit-protobuf@0.1.0.0/protobuf.bend as Pb
89def word64.shr(w: Pb.Word64, +n: U32) -> Pb.Word64:
90 Pb.Word64{+h, +l} = w
91 +a = (n .&. 31 : U32)
92 +big = U32.is_ge(n, 32)
93 Pb.Word64{
94 Bool.pick(U32, big, 0, (h >> U32.to_nat(a) : U32)),
95 Bool.pick(U32, big, (h >> U32.to_nat(a) : U32), ((l >> U32.to_nat(a)) .|. (h << U32.to_nat((32 - a : U32))) : U32))}