I need to create three bit masks that end up in three 32-bit unsigned ints
(let's call them x, y and z). The masks should end up like this:
x: 0000 0001 1111 1111 1111 1111 1111 1111
y: 0000 1110 0000 0000 0000 0000 0000 0000
z: 1111 0000 0000 0000 0000 0000 0000 0000
So far I've got this:
unsigned int x = (1<<25)-1;
unsigned int y = (~x)&((1<<28)-1);
unsigned int z = (~x)<<3;
But it seems a bit messy. Can anyone come up with a more concise (and readable) way?