Converting Endianess on a bit field structure

前端 未结 8 698
心在旅途
心在旅途 2021-02-02 03:48

I need to convert a bit-field structure from little-endian to big-endia architecture. What is the best way to do that, as there will be issues in byte boundaries, if I simply sw

8条回答
  •  南笙
    南笙 (楼主)
    2021-02-02 04:19

    You should not use bit-fields when the physical layout is important because it is implementation-defined in which order the larger word is populated.

提交回复
热议问题