问题
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