测试以确定Atmega16的对齐模式和大小端
先贴出结果:
- 小端模式
- 无对齐要求(1字节对齐)
- 测试代码
// 测试变量
struct {
uint8_t type0;
uint16_t code0;
uint8_t type1;
uint16_t code1;
uint32_t data;
}code_data;
uint32_t second = 0x00989680;
uint8_t *pSecond = (uint8_t *)&second;
uint8_t dSecond[4] = {
10,20,30,40};
// 求取结果
dSecond[0] = *(pSecond + 0);
dSecond[1] = *(pSecond + 1<