作者thanksgive (乾溫)
看板Grad-ProbAsk
標題[理工] 關於Big-Endian 與 Little-Endian
時間Fri Jul 29 18:17:46 2011
我在恐龍本上看到的解釋和其他地方的解釋似乎有衝突
想請問是我的理解有問題還是其中一個寫錯了?
※A:恐龍本7th p.112 寫到
※Consider the representation of 32-bit integers. Some systems (known as
※big-endian) use the high memory address to store the most significant byte,
※while other systems (known as little-endian) store
※the least significant byte at the high memory address.
勘誤網址:
http://www.docstoc.com/docs/19696073/Errata-OPERATING-SYSTEM-CONCEPTS-
SEVENTH-EDITION-Silberschatz
這邊說法和B一樣,"Some systems (known as big-endiam store the MSB byte first,
while other systems (known as little-endian) store LSB firtst )"
抱歉讓W大白忙了
B:取自網站
http://jyhshin.pixnet.net/blog/post/26587992
如果你在文件上看到一個雙字組的data,Ex: long MyData=0x12345678,
要寫到從0x0000開始的記憶體位址時。
如果是Big Endian的系統,存到記憶體會變成 0x12 0x34 0x56 0x78,
最高位元組在位址最低位元,最低位元組在位址最高位元,依次排列。
如果是Little Endian的系統,存到記憶體會變成 0x78 0x56 0x34 0x12,
最低位元組在最低位元,最高位元組在最高位元,反序排列。
比較的結果就是這樣:
big-endian little-endian
0x0000 0x12 0x78
0x0001 0x34 0x56
0x0002 0x56 0x34
0x0003 0x78 0x12
請問哪一個才對呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.160.35.239
※ 編輯: thanksgive 來自: 118.160.35.239 (07/29 18:18)
推 wheels:第二個網站的最高位元指的是78 恐龍的most significant指 07/29 23:42
→ wheels:的是12 I guess. 07/29 23:42
→ wheels:但是第二個網站下面那個排法應該是正確的 07/29 23:43
推 wheels:更正 我查過計組課本後發現我記錯了...第二個網站說的是對 07/29 23:53
→ wheels:的 最大位元組(Most significand bit)放在最低記憶體位址 07/29 23:54
→ wheels:的放法為Big endian 07/29 23:54
→ wheels:而最大位元組在第二個網站的例子裡指的是12沒錯! 07/29 23:56
推 wheels:還有我在恐龍112頁裡找不到你說的那段啊...? 07/30 00:04
→ wheels: (我的也是7th) 07/30 00:36
→ thanksgive:不好意思我一時混亂,第6版的122;第7的112才是 07/31 23:16
※ 編輯: thanksgive 來自: 61.224.223.52 (07/31 23:16)
→ thanksgive:Remote Procedure Calls那個小節,7th應該是3.6.2 07/31 23:18
→ thanksgive:我找到在網路上的7th的勘誤,應該是原恐龍本上錯了 07/31 23:27
※ 編輯: thanksgive 來自: 61.224.223.52 (07/31 23:33)