[問題] little endian

看板C_and_CPP (C/C++)作者 (椪柑)時間13年前 (2013/01/16 13:59), 編輯推噓0(007)
留言7則, 2人參與, 最新討論串1/1
開發環境是使用code::blocks 想請問一些關於little endian的問題 我要讀入的binary file是使用little endian 想請問 1. 0010是4嗎? 2. 假設一個6bit的數字 coding的時候 在16進位要加1的話是+0x20還是+0x1? 3. 在little endian裡面 有sign bit的情況下,做2補數 在code裡面需要轉換成big endian才能正確執行嗎? 感謝回答 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.114.221.54

01/16 14:16, , 1F
little endian 不是你說得那個意思,你在去查一下
01/16 14:16, 1F

01/16 14:17, , 2F
一樣還是8bits一組,不是整個顛倒
01/16 14:17, 2F

01/16 14:18, , 3F
01/16 14:18, 3F
懂了 感謝 ※ 編輯: kids1243 來自: 140.114.221.54 (01/16 14:23)

01/16 17:34, , 4F
如果你很hacky而且你很確定你在做什麼的話
01/16 17:34, 4F

01/16 17:34, , 5F
ntohl/htonl跟他那一族雖然多半用在網路上 可是也能用在
01/16 17:34, 5F

01/16 17:34, , 6F
你的case
01/16 17:34, 6F

01/16 17:35, , 7F
不用自己很麻煩的去一個一個case的算
01/16 17:35, 7F
文章代碼(AID): #1Gza6zBy (C_and_CPP)
文章代碼(AID): #1Gza6zBy (C_and_CPP)