Union and struct packing problem

后端 未结 5 2002
无人共我
无人共我 2021-01-02 20:55

I\'m writing some software where each bit must be exact(it\'s for the CPU) so __packed is very important.

typedef union{
uint32_t raw;
struct{
    unsigned          


        
5条回答
  •  再見小時候
    2021-01-02 21:09

    For reference to anyone who might find this, try the packed attribute:

    struct __attribute__((packed)){
    
    }
    

提交回复
热议问题