hello all

im having some troubles with that thing... (Memory reversed bytes)

lets say that i have a file with :


assumind edi equ my buffer to the fle content..
i do :

mov eax,dword ptr

but ill have in the value :


right?.. yeah...
but .. is there any way so i can get the values in the order that the file was made?
finnally having = 12345678 ?? cant i ??


Posted on 2006-06-02 18:09:08 by GR33d
try bswap

(actually this was just discussed over at the other place...)

Posted on 2006-06-02 18:27:03 by Ossa

i was reading through opcodes reference and found it too :)

sorry my post, but i was unable to find the answer in the search

and about a word ?

im using the following opcode to get the 1st word:
ror eax,16

is ror a fast opcode??

and about bswap is it fast?

Posted on 2006-06-02 18:42:04 by GR33d
If I understood you right, you even don't need bswap, or other instructions. When you read a number from a file, it means that the first byte of the number in the file will become the lowest byte of the number in memory, the second byte in the file will become the second byte in memory and so on. Because of Intel's processors interpret numbers greater than byte "from low address to higher", actually 12345678 in a file means number 78563412 in memory.

Further actions depend on your goal. If you actually meant 78563412 number you have to write to the file 12345678. If your number is 12345678 in the file you have to write 78563412.
Posted on 2006-06-04 03:51:35 by Mika0x65

is ror a fast opcode??

and about bswap is it fast?

both are relatively fast, although I've not done a comparison to see which is faster. BSWAP came around in the Intel 80486 (IIRC) so if you do backwards compatibility to 80386 or older I don't suggest using BSWAP.
Posted on 2006-06-04 04:28:39 by Synfire

my need is to WRITE files like: 12345678 and read/use the value : 12345678 too
thats why i need to convert...bswap did the trick

im just concern cause ill use it a lot of times....


Posted on 2006-06-04 08:30:12 by GR33d