Bitshift help.

Does this work?

b = ~((1 << (8-temp)) -1);