How to get a long long mask by number?

Say that all the masks we use are listed:

for (unsigned long long mask = 1; mask != 0; mask <<= 1) { } 

but here we use the operator <<= to move one value of our mask one by one, how do we move on to masking the numbers 20 or 55 ?

0
c ++
source share
1 answer

Just set mask value you want to set.

 mask = 1LL << 20; 
+2
source share

All Articles