当前位置:网站首页>byte alignment
byte alignment
2022-07-03 09:52:00 【0725 you Guangchuan】
Byte alignment :
If it takes N Bytes , His starting address must be N Integer multiple ; namely : Initial address %N=0;
Structure alignment
The structure is aligned with the largest member : Initial address %N=0;( The starting address of the structure is an integer multiple of the widest member type )
pragma pack(N)
When the space requirements are relatively high , Can pass #pragma pack(N) To change the alignment of structure members
e.g #pragma pack(1)
struct Test {
char b;
int a;
}
#pragma pack()// Unalign
(1)#pragma pack() You can set N Byte alignment (1,2,4,8 VC Compiler defaults 8)
N=min( The maximum occupied bytes of structure members , Align bytes )
Calculate the size of the structure as N Integer multiple
#prgma pack(1,2,4,8)
typedef struct
{
char a;
int b;
char ;
}
#pragma pack () The starting address of the structure is 4 Integer multiple ( namely Initial address %4 =0)
Total size of structure :N = Min( The largest member , Alignment parameters )
yes N Integer multiple
边栏推荐
- Nr-prach: access scenario and access process
- UCI and data multiplexing are transmitted on Pusch - placement of data and UCI positions (Part III)
- [male nanny style] teach you to open the first wechat applet
- The cyclic shift of PUCCH in NR channel is generated by MATLAB
- QT qcombobox QSS style settings
- 一个可执行的二进制文件包含的不仅仅是机器指令
- Comment la base de données mémoire joue - t - elle l'avantage de la mémoire?
- MYSQL数据库底层基础专栏
- 新系列单片机还延续了STM32产品家族的低电压和节能两大优势
- The number of weak characters in the game (1996)
猜你喜欢

Fundamentals of Electronic Technology (III)__ Logic gate symbols in Chapter 5

Idea remote breakpoint debugging jar package project

JMX、MBean、MXBean、MBeanServer 入门

单片机职业发展:能做下去的都成牛人了,熬不动就辞职或者改行了

干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己
![[CSDN]C1训练题解析_第四部分_Web进阶](/img/ee/2e9756cc0e2e6eda83e1b2304c0bd6.png)
[CSDN]C1训练题解析_第四部分_Web进阶

一个可执行的二进制文件包含的不仅仅是机器指令

STM32 serial communication principle

MySQL environment variable configuration

Fundamentals of Electronic Technology (III)_ Chapter 2 principle of amplification circuit__ Crystal triode and field effect triode
随机推荐
开学实验里要用到mysql,忘记基本的select语句怎么玩啦?补救来啦~
NR PUCCH format0 sequence generation and detection mechanism
I didn't think so much when I was in the field of single chip microcomputer. I just wanted to earn money to support myself first
新系列单片机还延续了STM32产品家族的低电压和节能两大优势
Shell logic case
Install local sources using yum
Vector processor 9_ Basic multilevel interconnection network
How does the nr-prach receiver detect the relationship between prembleid and Ta
Raspberry pie installation SciPy
Idea remote breakpoint debugging jar package project
Chromium Embedded Framework (CEF) 介绍
Implementing distributed lock with redis
Leetcode daily question (745. prefix and suffix search)
[graduation successful] [1] - tour [Student Management Information System]
UCI and data multiplexing are transmitted on Pusch - placement of data and UCI positions (Part III)
Introduction to chromium embedded framework (CEF)
Education is a pass and ticket. With it, you can step into a higher-level environment
【力扣刷题笔记(二)】特别技巧,模块突破,45道经典题目分类总结,在不断巩固中精进
干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己
Flink CDC practice (including practical steps and screenshots)