Casting a negative value??

A union is not ideal, I think, if there is different endianness.
The shift-OR approach is probably preferable from a portability POV.