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