内存对齐的目的 - 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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章