当前位置:网站首页>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
边栏推荐
- Epoll read / write mode in LT and et modes
- [graduation successful] [1] - tour [Student Management Information System]
- [CSDN]C1训练题解析_第四部分_Web进阶
- Oracle数据库 SQL语句执行计划、语句跟踪与优化实例
- Runtime. getRuntime(). GC () and runtime getRuntime(). The difference between runfinalization()
- Find all possible recipes from given supplies
- UCI and data multiplexing are transmitted on Pusch - placement of data and UCI positions (Part III)
- 顺利毕业[2]-学生健康管理系统 功能开发中。。。
- Leetcode daily question (516. long palindromic subsequence)
- Leetcode daily question (985. sum of even numbers after queries)
猜你喜欢

Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 3 --blinker_ MIOT_ Light (lighting technology app control + Xiaoai classmate control)

STM32 interrupt priority management

MySQL Data Definition Language DDL common commands

端午节快乐!—— canvas写的粽子~~~~~

没有多少人能够最终把自己的兴趣带到大学毕业上

Schematic diagram and connection method of six pin self-locking switch

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

【男保姆式】教你打开第一个微信小程序

【力扣刷题笔记(二)】特别技巧,模块突破,45道经典题目分类总结,在不断巩固中精进

numpy. Reshape() and resize() functions
随机推荐
Getting started with JMX, MBean, mxbean, mbeanserver
[CSDN]C1训练题解析_第四部分_Web进阶
Convert IP address to int
[22 graduation season] I'm a graduate yo~
Implementing distributed lock with redis
CEF download, compile project
手机都算是单片机的一种,只不过它用的硬件不是51的芯片
Epollet lessons
Fundamentals of Electronic Technology (III)_ Chapter 2 principle of amplification circuit__ Crystal triode and field effect triode
Project scope management__ Scope management plan and scope specification
Introduction to chromium embedded framework (CEF)
应用最广泛的8位单片机当然也是初学者们最容易上手学习的单片机
Nr-prach:prach format and time-frequency domain
Development of electrical fire system
Fundamentals of Electronic Technology (III)__ Chapter 6 combinational logic circuit
SSB Introduction (PbCH and DMRs need to be supplemented)
Project cost management__ Cost management technology__ Article 6 prediction
Oracle database SQL statement execution plan, statement tracking and optimization instance
[CSDN] C1 training problem analysis_ Part II_ Web Foundation
Programming ideas are more important than anything, not more than who can use several functions, but more than the understanding of the program