Hello.
In few cases, I move memory (always move-memory fix 32characters fix exactly one point of project.lpr).
In that case, other user, say Must I replace copymemory with Move_i32, but
the program-developer must be 100% sure the size=32characters.
Procedure Move_i32(const ASource; var ADest; ACount: Integer);
asm
mov ecx, [eax]
mov [edx], ecx {4}
mov ecx, [eax + 4]
mov [edx + 4], ecx {8}
mov ecx, [eax + 8]
mov [edx + 8], ecx {12}
mov ecx, [eax + 12]
mov [edx + 12], ecx {14}
mov ecx, [eax + 16]
mov [edx + 16], ecx {16}
mov ecx, [eax + 20]
mov [edx + 20], ecx {24}
mov ecx, [eax + 24]
mov [edx + 24], ecx {24}
mov ecx, [eax + 28]
mov [edx + 28], ecx {28}
end;
Example1:
Procedure Good10Solutionl
Var cnt:integer;
Begin //more fast
for cnt:= 1 to (01 shl 20) do Move_i32(srce,dest,32);
End;
Procedure Slow10Solution;
Var cnt:integer;
Begin
for cnt:= 1 to (01 shl 20) do copymemory(dest,srce,32);
End;
C:Q1=Can I use this trick? in general it is very good for CrossPlatforms = Android, Linux, BeOs..?
C:Q2=It is good-solution for Move_i04,Move_i06? at means I replace
copymemory with
Procedure Move_i04(const ASource; var ADest; ACount: Integer);
Procedure Move_i08(const ASource; var ADest; ACount: Integer);
Procedure Move_f08(src:pchar;ADest:pchar; ACount: Integer);
Thank.