Operations and endianess

爷,独闯天下 提交于 2019-12-13 06:15:09

问题


I've seen by using gdb that when bytes are copied from memory into registers they are reversed, if the system in use adopts the little endian approach.

Since, at the best of my knowledgs, the x86 assembly instruction set does not allow operations whose operands are both in memory, I was wondering: is there any operation which is performed directly on little endian values without being reversed first?


回答1:


This answer may appear a little bit strange to the experienced folks, but what the questioner is looking for is called MOVBE. It does copy the data as is(!)(relating to his arguments) to a register. It is not available on all architectures, but still the best solution to this specific problem. So the answer to

I was wondering: is there any operation which is performed directly on little endian values without being reversed first?

is yes: MOVBE does copy the bytes in the required order.



来源:https://stackoverflow.com/questions/38002944/operations-and-endianess

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