1. 修改对齐方式
This commit is contained in:
parent
ec1531f32a
commit
4a15c91dda
@ -35,13 +35,11 @@ enum eHBitFlag {
|
|||||||
kHBitInitFlag = 0x80,
|
kHBitInitFlag = 0x80,
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(1)
|
typedef struct __attribute__ ((__packed__)) _HBitBase {
|
||||||
typedef struct _HBitBase {
|
|
||||||
uint8_t flag;
|
uint8_t flag;
|
||||||
HBitLenType len;
|
HBitLenType len;
|
||||||
uint8_t data[0];
|
uint8_t data[0];
|
||||||
} _HBitBase;
|
} _HBitBase;
|
||||||
#pragma pack()
|
|
||||||
|
|
||||||
#define _HBIT_CALC_LEN(num) (sizeof(_HBitBase) + (((num) + 7) / 8))
|
#define _HBIT_CALC_LEN(num) (sizeof(_HBitBase) + (((num) + 7) / 8))
|
||||||
|
|
||||||
|
|||||||
@ -41,28 +41,26 @@ enum eHByteStackFlag {
|
|||||||
kHByteStackNeedInit = 0x80, // 需要初始化
|
kHByteStackNeedInit = 0x80, // 需要初始化
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(1)
|
typedef struct __attribute__ ((__packed__)) _HByteStackBase {
|
||||||
typedef struct _HByteStackBase {
|
|
||||||
uint8_t flag;
|
uint8_t flag;
|
||||||
HByteLenType len;
|
HByteLenType len;
|
||||||
HByteLenType useLen;
|
HByteLenType useLen;
|
||||||
} _HByteStackBase;
|
} _HByteStackBase;
|
||||||
|
|
||||||
typedef struct _HByteStack8 {
|
typedef struct __attribute__ ((__packed__)) _HByteStack8 {
|
||||||
_HByteStackBase base;
|
_HByteStackBase base;
|
||||||
uint8_t data[];
|
uint8_t data[];
|
||||||
} _HByteStack8;
|
} _HByteStack8;
|
||||||
|
|
||||||
typedef struct _HByteStack16 {
|
typedef struct __attribute__ ((__packed__)) _HByteStack16 {
|
||||||
_HByteStackBase base;
|
_HByteStackBase base;
|
||||||
uint16_t data[];
|
uint16_t data[];
|
||||||
} _HByteStack16;
|
} _HByteStack16;
|
||||||
|
|
||||||
typedef struct _HByteStack32 {
|
typedef struct __attribute__ ((__packed__)) _HByteStack32 {
|
||||||
_HByteStackBase base;
|
_HByteStackBase base;
|
||||||
uint32_t data[];
|
uint32_t data[];
|
||||||
} _HByteStack32;
|
} _HByteStack32;
|
||||||
#pragma pack()
|
|
||||||
|
|
||||||
// 用于支持多数据类型的宏
|
// 用于支持多数据类型的宏
|
||||||
#define _HBYTE_STACK_CALC_LEN8(num) (sizeof(_HByteStack8) + num)
|
#define _HBYTE_STACK_CALC_LEN8(num) (sizeof(_HByteStack8) + num)
|
||||||
|
|||||||
@ -39,29 +39,27 @@ typedef uint16_t HVectorLenType;
|
|||||||
typedef uint8_t HVectorLenType; // vector长度类型
|
typedef uint8_t HVectorLenType; // vector长度类型
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma pack(1)
|
|
||||||
|
|
||||||
typedef struct _HVectorBase {
|
typedef struct __attribute__ ((__packed__)) _HVectorBase {
|
||||||
uint8_t flag;
|
uint8_t flag;
|
||||||
HVectorLenType len;
|
HVectorLenType len;
|
||||||
HVectorLenType useLen;
|
HVectorLenType useLen;
|
||||||
} _HVectorBase;
|
} _HVectorBase;
|
||||||
|
|
||||||
typedef struct _HVector8 {
|
typedef struct __attribute__ ((__packed__)) _HVector8 {
|
||||||
_HVectorBase base;
|
_HVectorBase base;
|
||||||
uint8_t data[0];
|
uint8_t data[0];
|
||||||
} _HVector8;
|
} _HVector8;
|
||||||
|
|
||||||
typedef struct _HVector16 {
|
typedef struct __attribute__ ((__packed__)) _HVector16 {
|
||||||
_HVectorBase base;
|
_HVectorBase base;
|
||||||
uint16_t data[0];
|
uint16_t data[0];
|
||||||
} _HVector16;
|
} _HVector16;
|
||||||
|
|
||||||
typedef struct _HVector32 {
|
typedef struct __attribute__ ((__packed__)) _HVector32 {
|
||||||
_HVectorBase base;
|
_HVectorBase base;
|
||||||
uint32_t data[0];
|
uint32_t data[0];
|
||||||
} _HVector32;
|
} _HVector32;
|
||||||
#pragma pack()
|
|
||||||
|
|
||||||
// 用于支持多数据类型的宏
|
// 用于支持多数据类型的宏
|
||||||
#define _HVECTOR_CALC_LEN8(len) (sizeof(_HVector8) + (len))
|
#define _HVECTOR_CALC_LEN8(len) (sizeof(_HVector8) + (len))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user