mORMot and Open Source friends
Diff
Not logged in

Differences From Artifact [6281d4cc1e]:

To Artifact [f43d4dde9a]:


197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
...
358
359
360
361
362
363
364


365
366
367
368
369
370
371
....
1344
1345
1346
1347
1348
1349
1350













1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
....
9784
9785
9786
9787
9788
9789
9790




























































































































































































































































































































9791
9792
9793
9794
9795
9796
9797
9798
.....
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
.....
31860
31861
31862
31863
31864
31865
31866






31867
31868
31869
31870
31871
31872
31873
  - TSynTests now writes the elapsed time in each test in the final report
  - faster late binding process for our variants custom types (i.e.
    TSynTableVariantType and TSQLDBRowVariantType): you can call
    SynRegisterCustomVariantType() function to register any other custom
    variant type, and enhance GetProperty/SetProperty process speed
  - includes our optimized RecordCopy procedure in replacement to the slower
    default System.@CopyRecord internal RTL function
  - our optimized Move() and FillChar() will replac the default System RTL
    function, for Delphi versions prior to 2007 (which didn't contain those)
  - new AnsiCharToUTF8(), StringToWinAnsi(), WideStringToWinAnsi(),
    WideStringToUTF8(), CSVOfValue(), IdemPCharArray(), FindUnicode(),
    UpperCaseUnicode(), LowerCaseUnicode() and Split() functions
  - faster GetInt64() function
  - Iso8601ToSecondsPUTF8Char() now returns 0 in case of unexpected format
  - fixed issue in StrCurr64() low-level conversion routine
................................................................................
  - breaking change of TTextWriter.WriteObject() method: serialization is now
    defined with a new TTextWriterWriteObjectOptions set
  - unit fixed and tested with Delphi XE2/XE3 64-bit compiler under Windows
  - UTF-8 process will now handle UTF-16 surrogates - see ticket [4a0382367d] -
    UnicodeCharToUTF8/NextUTF8Char are renamed WideCharToUTF8/NextUTF8UCS4 and
    new UTF16CharToUTF8/UCS4ToUTF8 functions have been introduced
  - refactored function GetMimeContentType() implementation


  - added TypeInfo, ElemSize, ElemType read-only properties to TDynArray
  - added TDynArrayHashed.HashElement property
  - added TSynLogFile.Freq read-only property
  - now FileSize() function won't raise any exception if the file does not exist
  - added DirectoryDelete() function
  - added GetNextItemCardinalStrict() and UpperCaseCopy() functions
  - added JSONEncodeArrayOfConst() function
................................................................................
  // - used in mORMot.pas unit during TSQLTable rows sort and by TSQLQuery
  TUTF8Compare = function(P1,P2: PUTF8Char): PtrInt;

{$ifndef ISDELPHI2007ANDUP}
type
  TBytes = array of byte;
{$endif}














{$ifndef ENHANCEDRTL} { is our Enhanced Runtime (or LVCL) library not installed? }

{$define OWNNORMTOUPPER} { NormToUpper[] exists only in our enhanced RTL }

{$ifndef PUREPASCAL} { these functions are implemented in asm }
{$ifndef LVCL} { don't define these functions twice }

{$ifndef PUREPASCAL}

/// faster implementation of Move() for Delphi versions with no FastCode inside
// - Delphi RTL will be patched in memory to run this faster version
procedure FillChar(var Dest; Count: Integer; Value: Byte);

{$ifndef ISDELPHI2007ANDUP}
/// faster implementation of Move() for Delphi versions with no FastCode inside
// - Delphi RTL will be patched in memory to run this faster version
procedure Move(const Source; var Dest; Count: Integer);
................................................................................
{$endif UNICODE}

{$ifndef FPC}
procedure FillCharInvoke;
asm
  call System.@FillChar
end;




























































































































































































































































































































{$endif}

{$ifndef ENHANCEDRTL} { our Enhanced Runtime (or LVCL) library contain fast asm versions }

{ code below was extracted from our Enhanced Runtime (or LVCL) library
   and increases the framework performance
  - not compiled with FPC, since does call some low-level system.pas functions  }

................................................................................
  ret {do not remove - this is for alignment}
@@done:
end;
{$endif DELPHI5OROLDER}


{$ifndef ISDELPHI2007ANDUP}
procedure MoveInvoke;
asm
  call System.Move
end;

/// faster implementation of Move() for Delphi versions with no FastCode inside
procedure Move(const Source; var Dest; Count: Integer);
asm // eax=source edx=dest ecx=count
         // original code by John O'Harrow - included since delphi 2007
        cmp     ecx,32
        ja      @lrg                  // count > 32 or count < 0
        sub     ecx,8
................................................................................
{$else}
begin
{$endif PUREPASCAL}
{$else}
begin
{$endif DELPHI5OROLDER}
  {$ifndef FPC}






   {$ifndef ENHANCEDRTL}
    {$ifndef PUREPASCAL}
     {$ifndef DELPHI5OROLDER}
      {$ifndef USEPACKAGES}
       {$ifdef DOPATCHTRTL}
  RedirectCode(GetAddressFromCall(@RecordCopyInvoke),@RecordCopy);
       {$endif DOPATCHTRTL}







|







 







>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>










|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







 







<
<
<
<
<







 







>
>
>
>
>
>







197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
...
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
....
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
....
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
.....
10629
10630
10631
10632
10633
10634
10635





10636
10637
10638
10639
10640
10641
10642
.....
32186
32187
32188
32189
32190
32191
32192
32193
32194
32195
32196
32197
32198
32199
32200
32201
32202
32203
32204
32205
  - TSynTests now writes the elapsed time in each test in the final report
  - faster late binding process for our variants custom types (i.e.
    TSynTableVariantType and TSQLDBRowVariantType): you can call
    SynRegisterCustomVariantType() function to register any other custom
    variant type, and enhance GetProperty/SetProperty process speed
  - includes our optimized RecordCopy procedure in replacement to the slower
    default System.@CopyRecord internal RTL function
  - our optimized Move() and FillChar() will replace the default System RTL
    function, for Delphi versions prior to 2007 (which didn't contain those)
  - new AnsiCharToUTF8(), StringToWinAnsi(), WideStringToWinAnsi(),
    WideStringToUTF8(), CSVOfValue(), IdemPCharArray(), FindUnicode(),
    UpperCaseUnicode(), LowerCaseUnicode() and Split() functions
  - faster GetInt64() function
  - Iso8601ToSecondsPUTF8Char() now returns 0 in case of unexpected format
  - fixed issue in StrCurr64() low-level conversion routine
................................................................................
  - breaking change of TTextWriter.WriteObject() method: serialization is now
    defined with a new TTextWriterWriteObjectOptions set
  - unit fixed and tested with Delphi XE2/XE3 64-bit compiler under Windows
  - UTF-8 process will now handle UTF-16 surrogates - see ticket [4a0382367d] -
    UnicodeCharToUTF8/NextUTF8Char are renamed WideCharToUTF8/NextUTF8UCS4 and
    new UTF16CharToUTF8/UCS4ToUTF8 functions have been introduced
  - refactored function GetMimeContentType() implementation
  - included x64 asm of FillChar() and Move() for Win64 - Delphi RTL will be
    patched at startup, unless the NOX64PATCHRTL conditional is defined
  - added TypeInfo, ElemSize, ElemType read-only properties to TDynArray
  - added TDynArrayHashed.HashElement property
  - added TSynLogFile.Freq read-only property
  - now FileSize() function won't raise any exception if the file does not exist
  - added DirectoryDelete() function
  - added GetNextItemCardinalStrict() and UpperCaseCopy() functions
  - added JSONEncodeArrayOfConst() function
................................................................................
  // - used in mORMot.pas unit during TSQLTable rows sort and by TSQLQuery
  TUTF8Compare = function(P1,P2: PUTF8Char): PtrInt;

{$ifndef ISDELPHI2007ANDUP}
type
  TBytes = array of byte;
{$endif}

{$ifdef CPU64}
{$ifndef NOX64PATCHRTL}
/// faster implementation of Move() for x64 Delphi versions
// - Delphi RTL will be patched in memory to run this faster x64 asm version
procedure Move(const Source; var Dest; Count: NativeInt);

/// faster implementation of FillChar() for x64 Delphi versions
// - Delphi RTL will be patched in memory to run this faster x64 asm version
procedure FillChar(var Dest; Count: NativeInt; Value: Byte);
{$endif}
{$endif}


{$ifndef ENHANCEDRTL} { is our Enhanced Runtime (or LVCL) library not installed? }

{$define OWNNORMTOUPPER} { NormToUpper[] exists only in our enhanced RTL }

{$ifndef PUREPASCAL} { these functions are implemented in asm }
{$ifndef LVCL} { don't define these functions twice }

{$ifndef PUREPASCAL}

/// faster implementation of FillChar() for Delphi versions with no FastCode inside
// - Delphi RTL will be patched in memory to run this faster version
procedure FillChar(var Dest; Count: Integer; Value: Byte);

{$ifndef ISDELPHI2007ANDUP}
/// faster implementation of Move() for Delphi versions with no FastCode inside
// - Delphi RTL will be patched in memory to run this faster version
procedure Move(const Source; var Dest; Count: Integer);
................................................................................
{$endif UNICODE}

{$ifndef FPC}
procedure FillCharInvoke;
asm
  call System.@FillChar
end;

procedure MoveInvoke;
asm
  call System.Move
end;


{$ifdef CPU64}
{$ifndef NOX64PATCHRTL}
procedure Move(const Source; var Dest; Count: NativeInt);
asm // rcx=Source, rdx=Dest, r8=Count
     .noframe
     mov rax,r8
     sub rcx,rdx
     je @11
     jnc @03
     add rax,rcx
     jc @17
@03: cmp r8,8
     jl @09
     test dl,07H
     jz @06
     test dl,01H
     jz @04
     mov al,byte ptr [rcx+rdx]
     dec r8
     mov byte ptr [rdx],al
     add rdx,1
@04: test dl,02H
     jz @05
     mov ax,word ptr [rcx+rdx]
     sub r8,2
     mov word ptr [rdx],ax
     add rdx,2
@05: test dl,04H
     jz @06
     mov eax,dword ptr [rcx+rdx]
     sub r8,4
     mov dword ptr [rdx],eax
     add rdx,4
@06: mov r9,r8
     shr r9,5
     jnz @12
@07: mov r9,r8
     shr r9,3
     jz @09
     nop
@08: dec r9
     mov rax,qword ptr [rcx+rdx]
     mov qword ptr [rdx],rax
     lea rdx,rdx+8
     jnz @08
     and r8,07H
@09: test r8,r8
     jle @11
     db 66H,66H,66H,90H,66H,66H,90H
@10: dec r8
     mov al,byte ptr [rcx+rdx]
     mov byte ptr [rdx],al
     lea rdx,rdx+1
     jnz @10
@11: ret
@12: cmp r9,8192
     jc @13
     cmp rcx,4096
     jnc @14
@13: dec r9
     lea rdx,rdx+32
     mov rax,qword ptr [rcx+rdx-20H]
     mov r10,qword ptr [rcx+rdx-18H]
     mov qword ptr [rdx-20H],rax
     mov qword ptr [rdx-18H],r10
     mov rax,qword ptr [rcx+rdx-10H]
     mov r10,qword ptr [rcx+rdx-8H]
     mov qword ptr [rdx-10H],rax
     mov qword ptr [rdx-8H],r10
     jnz @13
     and r8,1FH
     jmp @07
@14: mov eax,32
     db 66H,66H,66H,90H,66H,66H,66H,90H
@15: prefetchnta [rcx+rdx]
     prefetchnta [rcx+rdx+40H]
     add rdx,128
     dec eax
     jnz @15
     sub rdx,4096
     mov eax,64
@16: add rdx,64
     mov r9,qword ptr [rcx+rdx-40H]
     mov r10,qword ptr [rcx+rdx-38H]
     db $4C,$0F,$C3,$4A,$C0 // movnti qword ptr [rdx-40H],r9
     db $4C,$0F,$C3,$52,$C8 // movnti qword ptr [rdx-38H],r10
     mov r9,qword ptr [rcx+rdx-30H]
     mov r10,qword ptr [rcx+rdx-28H]
     db $4C,$0F,$C3,$4A,$D0 // movnti qword ptr [rdx-30H],r9
     db $4C,$0F,$C3,$52,$D8 // movnti qword ptr [rdx-28H],r10
     dec eax
     mov r9,qword ptr [rcx+rdx-20H]
     mov r10,qword ptr [rcx+rdx-18H]
     db $4C,$0F,$C3,$4A,$E0 // movnti qword ptr [rdx-20H],r9
     db $4C,$0F,$C3,$52,$E8 // movnti qword ptr [rdx-18H],r10
     mov r9,qword ptr [rcx+rdx-10H]
     mov r10,qword ptr [rcx+rdx-8H]
     db $4C,$0F,$C3,$4A,$F0 // movnti qword ptr [rdx-10H],r9
     db $4C,$0F,$C3,$52,$F8 // movnti qword ptr [rdx-8H],r10
     jnz @16
     sub r8,4096
     cmp r8,4096
     jnc @14
     mfence
     jmp @06
@17: add rdx,r8
     cmp r8,8
     jl @23
     test dl,07H
     jz @20
     test dl,01H
     jz @18
     dec rdx
     mov al,byte ptr [rcx+rdx]
     dec r8
     mov byte ptr [rdx],al
@18: test dl,02H
     jz @19
     sub rdx,2
     mov ax,word ptr [rcx+rdx]
     sub r8,2
     mov word ptr [rdx],ax
@19: test dl,04H
     jz @20
     sub rdx,4
     mov eax,dword ptr [rcx+rdx]
     sub r8,4
     mov dword ptr [rdx],eax
@20: mov r9,r8
     shr r9,5
     jnz @26
@21: mov r9,r8
     shr r9,3
     jz @23
@22: sub rdx,8
     mov rax,qword ptr [rcx+rdx]
     dec r9
     mov qword ptr [rdx],rax
     jnz @22
     and r8,07H
@23: test r8,r8
     jle @25
     db 66H,66H,66H,90H,66H,66H,66H,90H
     db 66H,66H,66H,90H,90H
@24: dec rdx
     mov al,byte ptr [rcx+rdx]
     dec r8
     mov byte ptr [rdx],al
     jnz @24
@25: ret
@26: cmp r9,8192
     jc @27
     cmp rcx,-4096
     jc @28
@27: sub rdx,32
     mov rax,qword ptr [rcx+rdx+18H]
     mov r10,qword ptr [rcx+rdx+10H]
     mov qword ptr [rdx+18H],rax
     mov qword ptr [rdx+10H],r10
     dec r9
     mov rax,qword ptr [rcx+rdx+8H]
     mov r10,qword ptr [rcx+rdx]
     mov qword ptr [rdx+8H],rax
     mov qword ptr [rdx],r10
     jnz @27
     and r8,1FH
     jmp @21
@28: mov eax,32
     db 66H,66H,66H,90H,66H,66H,90H
@29: sub rdx,128
     prefetchnta [rcx+rdx]
     prefetchnta [rcx+rdx+40H]
     dec eax
     jnz @29
     add rdx,4096
     mov eax,64
@30: sub rdx,64
     sub r8,4096
     mov r9,qword ptr [rcx+rdx+38H]
     mov r10,qword ptr [rcx+rdx+30H]
     db $4C,$0F,$C3,$4A,$38 // movnti qword ptr [rdx+38H],r9
     db $4C,$0F,$C3,$52,$30 // movnti qword ptr [rdx+30H],r10
     mov r9,qword ptr [rcx+rdx+28H]
     mov r10,qword ptr [rcx+rdx+20H]
     db $4C,$0F,$C3,$4A,$28 // movnti qword ptr [rdx+28H],r9
     db $4C,$0F,$C3,$52,$20 // movnti qword ptr [rdx+20H],r10
     dec eax
     mov r9,qword ptr [rcx+rdx+18H]
     mov r10,qword ptr [rcx+rdx+10H]
     db $4C,$0F,$C3,$4A,$18 // movnti qword ptr [rdx+18H],r9
     db $4C,$0F,$C3,$52,$10 // movnti qword ptr [rdx+10H],r10
     mov r9,qword ptr [rcx+rdx+8H]
     mov r10,qword ptr [rcx+rdx]
     db $4C,$0F,$C3,$4A,$08 // movnti qword ptr [rdx+8H],r9
     db $4C,$0F,$C3,$12 // movnti qword ptr [rdx],r10
     jnz @30
     cmp r8,4096
     jnc @28
     mfence
     jmp @20
end;

procedure FillChar(var Dest; Count: NativeInt; Value: Byte);
asm  // rcx=Dest rdx=Count r8=Value
        .noframe
        cmp rdx,32
        mov rax,r8
        jle @small
        and r8,0FFH
        mov r9,101010101010101H
        imul r8,r9
        test cl,07H
        jz @27C5
        test cl,01H
        jz @27A4
        mov byte ptr [rcx],r8b
        add rcx,1
        sub rdx,1
@27A4:  test cl,02H
        jz @27B5
        mov word ptr [rcx],r8w
        add rcx,2
        sub rdx,2
@27B5:  test cl,04H
        jz @27C5
        mov dword ptr [rcx],r8d
        add rcx,4
        sub rdx,4
@27C5:  mov rax,rdx
        and rdx,3FH
        shr rax,6
        jnz @27FD
@27D2:  mov rax,rdx
        and rdx,07H
        shr rax,3
        jz @27EC
        db 66H,66H,90H
@27E0:  mov qword ptr [rcx],r8
        add rcx,8
        dec rax
        jnz @27E0
@27EC:  test rdx,rdx
        jle @27FC
@27F1:  mov byte ptr [rcx],r8b
        inc rcx
        dec rdx
        jnz @27F1
@27FC:  ret
@27FD:  cmp rax,8192
        jnc @2840
        db 66H,66H,66H,90H,90H,90H
@2810:  add rcx,64
        mov qword ptr [rcx-40H],r8
        mov qword ptr [rcx-38H],r8
        mov qword ptr [rcx-30H],r8
        mov qword ptr [rcx-28H],r8
        dec rax
        mov qword ptr [rcx-20H],r8
        mov qword ptr [rcx-18H],r8
        mov qword ptr [rcx-10H],r8
        mov qword ptr [rcx-8H],r8
        jnz @2810
        jmp @27D2
        db 66H,66H,66H,90H,90H
@2840:  add rcx,64
        db $4C,$0F,$C3,$41,$C0 // movnti  qword ptr [rcx-40H],r8
        db $4C,$0F,$C3,$41,$C8 // movnti  qword ptr [rcx-38H],r8
        db $4C,$0F,$C3,$41,$D0 // movnti  qword ptr [rcx-30H],r8
        db $4C,$0F,$C3,$41,$D8 // movnti  qword ptr [rcx-28H],r8
        dec rax
        db $4C,$0F,$C3,$41,$E0 // movnti  qword ptr [rcx-20H],r8
        db $4C,$0F,$C3,$41,$E8 // movnti  qword ptr [rcx-18H],r8
        db $4C,$0F,$C3,$41,$F0 // movnti  qword ptr [rcx-10H],r8
        db $4C,$0F,$C3,$41,$F8 // movnti  qword ptr [rcx-8H],r8
        jnz @2840
        mfence
        jmp @27D2
@small: // rcx=Dest rdx=Count r8=Value<=32
        test rdx,rdx
        jle @@done
        mov ah,al
        mov [rcx+rdx-1],al
        lea r8,@table
        and rdx,-2
        neg rdx
        lea rdx,[r8+rdx*2+64]
        jmp rdx
@table: mov [rcx+30],ax
        mov [rcx+28],ax
        mov [rcx+26],ax
        mov [rcx+24],ax
        mov [rcx+22],ax
        mov [rcx+20],ax
        mov [rcx+18],ax
        mov [rcx+16],ax
        mov [rcx+14],ax
        mov [rcx+12],ax
        mov [rcx+10],ax
        mov [rcx+ 8],ax
        mov [rcx+ 6],ax
        mov [rcx+ 4],ax
        mov [rcx+ 2],ax
        mov [rcx   ],ax
        ret
@@done:
end;
{$endif NOX64PATCHRTL}
{$endif CPU64}

{$endif FPC}

{$ifndef ENHANCEDRTL} { our Enhanced Runtime (or LVCL) library contain fast asm versions }

{ code below was extracted from our Enhanced Runtime (or LVCL) library
   and increases the framework performance
  - not compiled with FPC, since does call some low-level system.pas functions  }

................................................................................
  ret {do not remove - this is for alignment}
@@done:
end;
{$endif DELPHI5OROLDER}


{$ifndef ISDELPHI2007ANDUP}





/// faster implementation of Move() for Delphi versions with no FastCode inside
procedure Move(const Source; var Dest; Count: Integer);
asm // eax=source edx=dest ecx=count
         // original code by John O'Harrow - included since delphi 2007
        cmp     ecx,32
        ja      @lrg                  // count > 32 or count < 0
        sub     ecx,8
................................................................................
{$else}
begin
{$endif PUREPASCAL}
{$else}
begin
{$endif DELPHI5OROLDER}
  {$ifndef FPC}
   {$ifdef CPU64}
   {$ifndef NOX64PATCHRTL}
   RedirectCode(GetAddressFromCall(@FillCharInvoke),@FillChar);
   RedirectCode(GetAddressFromCall(@MoveInvoke),@Move);
   {$endif NOX64PATCHRTL}
   {$endif CPU64}
   {$ifndef ENHANCEDRTL}
    {$ifndef PUREPASCAL}
     {$ifndef DELPHI5OROLDER}
      {$ifndef USEPACKAGES}
       {$ifdef DOPATCHTRTL}
  RedirectCode(GetAddressFromCall(@RecordCopyInvoke),@RecordCopy);
       {$endif DOPATCHTRTL}