pub(crate) fn dumpmask(mask: u64) -> String
Expand description
Given a bitmask, return a list of the bits set in the mask, as a String in the format expected by Tor consensus documents.
This implementation constructs ranges greedily. For example, the
bitmask 0b0111011
will be represented as 0-1,3-5
, and not
0,1,3,4,5
or 0,1,3-5
.
ⓘ
assert_eq!(dumpmask(0b111111), "0-5");
assert_eq!(dumpmask(0b111100), "2-5");
assert_eq!(dumpmask(0b11111100), "2-7");