Big End Mode
The so-called big endian mode means that the lower bits of the data (that is, the latter bits with smaller weights) are stored in the high address of the memory, and the high bits of the data are stored in In the low address of memory, such a storage mode is somewhat similar to processing data as a string: the address is increased from small to large, and the data is placed from high to low;
Little Endian
The so-called little endian mode means that the lower bits of data are stored in the lower address of the memory, and the upper bits of the data are stored in the upper address of the memory. This storage mode effectively combines the address level and the data bit weight. The high address part has a high weight and the low address part has a low weight, which is consistent with our logical method.
Why is there a big endian mode?
Why is there a big endian mode? This is because in a computer system, we are in bytes, each address unit corresponds to one byte, and one byte is 8 bits. However, in addition to the 8-bit char in the C language, there are 16-bit short type, 32-bit long type (depending on the specific compiler), and, for the processor with more than 8 bits, for example, 16-bit or 32-bit. The processor, since the register width is larger than one byte, there must be a problem of how to arrange multiple bytes. As a result, the big endian storage mode and the little endian storage mode are caused. For example, a 16-bit short type x, the address in memory is 0x0010, and the value of x is 0x1122, then 0x11 is the high byte and 0x22 is the low byte. For big endian mode, put 0x11 in the low address, ie 0x0010, and 0x22 in the high address, ie 0x0011. Little endian mode, just the opposite. Our commonly used X86 architecture is the little endian mode, while the KEIL C51 is the big endian mode. Many ARM and DSP are in little endian mode. Some ARM processors can also be selected by hardware to be big endian or little endian.
Test:
#include <stdio.h>
#include <sys/types>
main()
{
int x=0x12345678; /* 305419896 */
unsigned char *p=(char *)&x;
printf("%0x % 0x %0x %0x",xp[0],xp[1],xp[2],xp[3]);
}
Output: 78 56 34 12
Description is little end! The other way around is big endian
>> load heart_scale error using the loadASCII file The number of columns in the third row of h
1. Lock the redundant self-built account in the systemCheck method:Execute the command#cat /etc/pas
The linux shell has its own set of flow control statements, including conditional statements (if),
Microsoft announced the extension of the Windows Vista and Windows 7 lifecycle. The life cycle of W
Three ways to run PHP under Linux
Linux operating system network card installation guide (below)
Linux operating system, Advanced Power Management
How to use magent to build a memcached cluster
Linux Standard Input/Output Tutorial
Neighbor subsystem of linux protocol stack (related process 5)
How to disguise Linux system Set the system illusion for hackers
Basic tutorial on the installation and use of SNMP under centos
Retrieve the Start menu on Win8.1
Win7 original system iso image installation method
The eight differences between Windows 8 and Win10
Windows 8 tutorial with built-in decompression
How to solve the baidusdsvc.exe application error of the WindowsXP system
How to solve the problem that the u disk capacity becomes smaller?
Small file big effect Inf file application strategy
Win10 9879 automatic update failure how to solve
Let WinXP be more secure, a few tricks, super killing technology