flat assembler
Message board for the users of flat assembler.
Index
> DOS > Reverse the order of bytes of an array |
Author |
|
donkey7 02 Jun 2005, 19:15
what about:
Code: mov si, bufSize/2-4 mov di, stdBuf+bufSize/2 cB_RBO_LP: mov eax, [stdBuf+si] mov ebx, [di] bswap eax bswap ebx mov [di], eax mov [stdBuf+si], ebx add di,4 sub si,4 jns cB_RBO_LP bufSize = 256 ; 8, 16, 24, 32, 40, 48, 56, 64, 72 ... stdBuf rb bufSize note1: this code requires 486+ (bswap) note2: this code works only if the array size in bytes is multiple of eight _________________ Keep coding! |
|||
02 Jun 2005, 19:15 |
|
YONG 04 Jun 2005, 08:27
A small bugfix for the suggested code:
Code: ... mov eax, dword [stdBuf+si] ; requires dword ... mov dword [stdBuf+si], ebx ; ditto ... Quote:
To me, these requirements are no problem. The suggested code is slightly faster than my approach. Thank donkey7 for the input. YONG |
|||
04 Jun 2005, 08:27 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.