Big or Little Endian
2018-08-05
This article will show you what is Big Endian and Little Endian and how to check your cpu’s endian in Python3.
What is endian?
Endian is the order how your CPU store data.
For an short int in a 32-bit computer, it needs 2 bytes to store. So the CPU have to store it in two continuous addresses. Endian decides which part should be writen to memory first!
Note:
Most significat bit(MSB) is the most left 1 in bit array, which has the highest weight. (It must be a 1.)
Least significat bit(LSB) is the most right bit in bit array, which has the lowest weight. (No matter it is a 0 or 1.)
How to judge your cpu’s endian?
Little endian is more popular than Big endian. In python you can judge your endian in following ways.
|
|