Re: [问题] big-endian vs little-endian

楼主: enonrick (EnonRick)   2018-04-19 14:26:58
※ 引述《zzss2003 (brotherD)》之铭言:
: 网址: https://stackoverflow.com/questions/13926760/the-reason-behind-endianness
: 网址里面有提到big跟little的优缺点,但小弟资质不良,无法完全理解,想请各位前辈开
: 释
: little-endian:
: 1. The little-endian system has the property that the same value can be read
: from memory at different lengths without using different addresses
value 4A in little-endian
char [4A]
short [4A 00]
int [4A 00 00 00]
long [4A 00 00 00 00 00 00 00]
可以节省内存
https://en.wikipedia.org/wiki/Endianness#Optimization
: 请问,at different lengths without using different addresses是什么意思?
: 2. When adding or subtracting multi-byte numbers, the least significant byte
: must be fetched first to see if there is a carryover to more significant
: bytes. Because the least-significant byte is read first in little-endian
: numbers, the system can parallelize and begin calculation on this byte while
: fetching the following byte(s).
msb lsb
[010010101 10111010]
+[010001100 11100010]

Links booklink

Contact Us: admin [ a t ] ucptt.com