| Module | Dnsruby::BitMapping |
| In: |
lib/dnsruby/bit_mapping.rb
|
Provides methods for converting between the various representations of a bitmap: number, binary encoded string, array, and sparse array.
Where an array is used to represent bits, the first element (0) will be the low (1) bit and the last bit will be the high bit.
Converts a number to a sparse array containing bit positions that are set/true/1. Note that these are bit positions, e.g. 76543210, and not bit column values such as 128/64/32/16/8/4/2/1.
Reverses a binary string. Note that it is not enough to reverse the string itself because although the bytes would be reversed, the bits within each byte would not.