当前位置:网站首页>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
边栏推荐
- Learn the contents of 5g toolbox supporting NR through the NR resources provided by MATLAB
- Flink learning notes (10) Flink fault tolerance mechanism
- Analysis of the implementation principle of an open source markdown to rich text editor
- You need to use MySQL in the opening experiment. How can you forget the basic select statement? Remedy is coming~
- Patent inquiry website
- Shell logic case
- CEF下载,编译工程
- Qt QComboBox QSS样式设置
- Convert IP address to int
- Runtime. getRuntime(). GC () and runtime getRuntime(). The difference between runfinalization()
猜你喜欢
Convert IP address to int
Development of fire evacuation system
STM32 port multiplexing and remapping
CEF download, compile project
STM32 interrupt priority management
In third tier cities and counties, it is difficult to get 10K after graduation
Difference of EOF
How does the nr-prach receiver detect the relationship between prembleid and Ta
Project cost management__ Topic of comprehensive calculation
NR technology -- MIMO
随机推荐
【順利畢業】[1]-遊覽 [學生管理信息系統]
Fundamentals of Electronic Technology (III)__ Logic gate symbols in Chapter 5
学习开发没有捷径,也几乎不存在带路会学的快一些的情况
内存数据库究竟是如何发挥内存优势的?
Epollet lessons
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
要選擇那種語言為單片機編寫程序呢
Fundamentals of Electronic Technology (III)__ Chapter 6 combinational logic circuit
Flink learning notes (VIII) multi stream conversion
The number of weak characters in the game (1996)
Successful graduation [3]- blog system update...
1300. sum of varied array closed to target
Leetcode daily question (2305. fair distribution of cookies)
【男保姆式】教你打开第一个微信小程序
[CSDN] C1 training problem analysis_ Part II_ Web Foundation
Directory and switching operation in file system
[CSDN]C1訓練題解析_第三部分_JS基礎
Convert IP address to int
UCI and data multiplexing are transmitted on Pusch (Part VI) -- LDPC coding