OK, what I’m trying to do may sound a bit complicated, but I still cannot figure it out :
- Let’s say we have an
unsigned long long64-bit integer - I want to set some “Variable”-bit positions and get all possible derived numbers
E.g.
Pattern = 00000000XXXXX000XX000X
Positions = 0,4,5,9,10,11,12,13
Result (Pattern, Positions) = {
0000000000000000000000
0000000000000000000001
0000000000000000010000
0000000000000000010001
0000000000000000100000
0000000000000000100001
0000000000000000110000
0000000000000000110001
etc...
}
How should I go about that? Any ideas?
They’re too easy.
Make a mask of the bit positions you want to stay constant. On each iteration: