当前位置:网站首页>The difference between big-endian and little-endian storage is easy to understand at a glance
The difference between big-endian and little-endian storage is easy to understand at a glance
2022-08-09 08:40:00 【running little rabbit】
Byte ordering is divided into big endian and little endian, the concepts are as follows
Big endian: The low address stores the most significant bytes.The first byte of data is stored first.
little endian: low address stores the least significant byte
stm32 is a little-endian mode, such as a 32-bit unsigned number 0x12345678,
Store 78h 56h 34h 12h sequentially from low address to high address.
1. Method and judgment of big endian and little endian

LSB means: full nameIt is the Least Significant Bit, which means the least significant bit in the binary number. Generally speaking, the MSB is located at the far left of the binary number, and the LSB is located at the far right of the binary number.
MSB means: the full name is Most Significant Bit, which belongs to the most significant bit in binary numbers, and MSB is the highest weighted bit, similar to the leftmost bit in decimal numbers.
0x12345678 Hexadecimal, two numbers are one byte The first byte of the data is 12 (MSB)
High significant byte --> Low significant byte: 12 34 56 78
Low address bits High and low address bits
Big endian: 12 34 56 78
Little Endian: 78 56 34 12
#includeint main(void ){unsigned int x =0x12345678;unsigned char *p = (unsigned char *)&x;printf("%0x %0x %0x %0x",p[0],p[1],p[2],p[3]);return 0;} 边栏推荐
猜你喜欢
随机推荐
DeFi 项目中的治理Token
The working principle of switch
Use of prepareStatement
浅谈Flask_script
Max Flow P
小程序调用百度api实现图像识别
bs4的使用基础学习
[MySQL]mysql: Solve the problem of [Err] 1093 - You can't specify target table 'table name' for update in FROM clause
IO字节流读取文本中文乱码
897. 增加订单搜索树
网络层协议介绍
数制转换及子网划分
进程和计划任务
BUUCTF MISC刷题笔记(一)
OpenHarmony开源见面会(南京站)相关笔记
Process synchronization and mutual exclusion problem
泛型和lambda表达式
XCTF高校战“疫”网络安全分享赛Misc wp
App testing
进程同步与互斥问题纠错









![[漏洞复现]CVE-2018-12613(远程文件包含)](/img/0b/707eb4266cb5099ca1ef58225642bf.png)