I'd like to write a method that takes an integer and a bit length and returns an array of integers corresponding to the bits.
For example:
decompose(100, 4)
#=> [4, 12]
because:
100 is 01001100 in binary
/ \
0100 1100
4 12
decompose(123456, 6)
#=> [1, 8, 60, 0]
because:
123456 is 000001001000111100000000 in binary
/ | | \
1 8 60 0
Note: I don't need to worry about bit lengths that aren't exact divisors.