All pastes #149618 Raw Edit

Miscellany

public text v1 · immutable
#149618 ·published 2006-08-26 00:02 UTC
rendered paste body
This code performs a very simple block copy, 48 bytes at a time, and approaches the maximum throughput
for a particular machine:

;  Simple block copy        function
;  R12 points to the        start of the source block
;  R13 points to the        start of the destination block
;  R14 points to the        end of the source block
loop        LDMIA        R12!, (R0-R11}                 ; load 48 bytes
            STMIA        R13!, {R0-R11}                 ; store 48 bytes
            CMP          R12, R14                       ; reached the end yet?
            BLO          loop                           ; branch to the top of the loop

The source and destination must be word-aligned, and if the object to be copied is not a multiple of 48 bytes
long, extra bytes are copied to bring the total to the next multiple of 48 bytes. A more sophisticated routine
is needed if this extra copying is to be avoided.