3 ms·
For maximal portability, you wouldn't want to shift a 12 bit field by more than 3 bits. Because you know that is narrower than int, but int can be as narrow as
by kazinator 7mo ago
For maximal portability, you wouldn't want to shift a 12 bit field by more than 3 bits. Because you know that is narrower than int, but int can be as narrow as 16 bits, which includes a sign bit.
If you assume that int is 32 bits, you can left shift an 12 bit field by 19 bits without hitting the sign bit.