作者:
zzss2003 (brotherD)
2018-04-18 21:02:15網址: 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
請問,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).
這一段我看得懂,大致上的意思是little-endian有辦法一邊fetch lower byte 一邊做計
算,如果是big-endian就必須全部fetch下來才可以做計算
big-endian:
1. it is simple to tell whether a number is positive or negative by simply
examining the bit at offset 0 in the lowest order byte.
這邊我也看得懂,big-endian的優點就是很容易比出兩個數字的大小。
2. binary digits are ordered as most people order base-10 digits. This is
advantageous performance-wise when converting from binary to decimal.
不懂,為什麼從2進制轉換成10進制會有performance-wise?
我認為不管是big還是little,轉成10進制的效能都是一樣的,只是big從MSB開始加,
little從LSB開始加
請各位指點迷津,謝謝