[Solved] How to divide up the unsigned long long bits into 3 ints with [1-2, 3-5, 6-7] bits in each? [closed]


unsigned long long a;
// bits 1 and 2 assuming 0 indexed
int first = static_cast<int>((a & (3ULL<<1))>>1);
// bits 3 and 5 assuming 0 indexed
int second = static_cast<int>((a & (3ULL << 3)) >> 3);
// bits 6 and 7 assuming 0 indexed
int third = static_cast<int>((a & (3ULL << 5)) >> 5);

solved How to divide up the unsigned long long bits into 3 ints with [1-2, 3-5, 6-7] bits in each? [closed]