当前位置:网站首页>Big end and small end

Big end and small end

2022-06-25 21:14:00 Rabbit cloud program

Interview questions : Write how to test CPU The size of the code ? 

Method 1 : Direct high byte judgment

Method 2 : utilize union, principle : Consortium union The storage order of is that all members start from the low address , And all members share storage space , Easier to understand

The big and small end is the topic of long-term conversation in the interview , Especially in some embedded software positions , And the position of system engineer is often mentioned .

First, let's take a look at the big and small side patterns .

Big end model : High bit corresponds to low address , The low bit corresponds to the high address ; In other words , That is, the high bit of the number is stored in the low address of the memory , The low bit is stored in the high address of the memory .

The small end model : High bit corresponds to high address , Low order corresponds to low address ; That is, the high bit of the number is stored in the high address of the memory , The low bit is stored in the low address of memory .

Learn to compile from the beginning , Single chip microcomputer , When does the principle of microcomputer come into being , We always talk about big end and small end modes , But people who don't often play with programming will ignore this detail , And this detail is very important , Especially in hardware data storage , If you don't pay attention to this detail , Will cause your project to crash .

At the intersection with hardware

原网站

版权声明
本文为[Rabbit cloud program]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202181333001877.html