Function bitrange

Source
pub(crate) fn bitrange(lo: u64, hi: u64) -> u64
Expand description

Helper: return a new u64 in which bits lo through hi inclusive are set to 1, and all the other bits are set to 0.

In other words, bitrange(a,b) is how we represent the range of versions a-b in a protocol version bitmask.

assert_eq!(bitrange(0, 5), 0b111111);
assert_eq!(bitrange(2, 5), 0b111100);
assert_eq!(bitrange(2, 7), 0b11111100);