let get_unsigned_max sz =
  assert(sz <= 32);
  let max32 = Int64.of_string "0xffffffff"
  and shift_value = 32 - sz
  in
    if shift_value > 0
    then Int64.shift_right max32 shift_value
    else max32