The constant 0x80000000 is specific to 32 bit types. Make the bit mask according to the size of types.