內存對齊的目的 - Purpose of memory alignment

問題:

Admittedly I don't get it.誠然,我不明白。 Say you have a memory with a memory word of length of 1 byte.假設您有一個內存字長爲 1 字節的內存。 Why can't you access a 4 byte long variable in a single memory access on an unaligned address(ie not divisible by 4), as it's the case with aligned addresses?爲什麼不能在未對齊地址(即不能被 4 整除)的單個內存訪問中訪問 4 字節長的變量,因爲對齊地址就是這種情況?


解決方案:

參考一: https://stackoom.com/question/1bB6
參考二: Purpose of memory alignment
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章