What is the most efficient way to iterate through all bit masks of the integer in the bit count increasing order?
at first I need to iterate only through one bit masks:
0001 0010 0100 1000
then through two bit masks:
0011 0101 1001 0110 1010 1100
and so on.
Here's an attempt that uses recursion and iterates for 1 to 8 bit masks for all 8 bit numbers.
Output: