Big Endian and Little Endian

为君一笑 提交于 2019-11-30 05:14:09

问题


Given is the snap shot of memory of a byte-addressable computer. What would be loaded into register $16 after execution of instruction lw $16, 24($17) if machine is big endian and when Little Endian. Register $17 contains 200.

Now according to me, four bytes would be copied from the memory (224-227) irrespective of Little Endian or Big Endian,then if the machine is Big Endian then they will be copied to the register as they are.

If the machine is Little Endian then will be reversed and then copied to the register.

Please guide me if I am wrong with the concept.


回答1:


You're right.

More technically, in big-endian mode, the most significant byte is the one with the lowest address, and least significant byte is the one with the highest address. In little-endian mode, the most significant byte is the one with the highest address, while the least significant byte is the one with the lowest address.

So the contents of $16 register would be

If big-endian -> BADADBBD If little-endian -> BDDBDABA



来源:https://stackoverflow.com/questions/8050107/big-endian-and-little-endian

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!