mORMot and Open Source friends
Check-in [e6f603369f]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:{3209} let SynCommons compile with PUREPASCAL on Delphi 7
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e6f603369f8d7afc2d80692931db63bcd883cb84
User & Date: ab 2016-12-01 21:50:52
Context
2016-12-02
14:49
{3210} enhanced TSQLTable.GetRowValues method for better performance and optional header/trailer check-in: cbf055cda7 user: ab tags: trunk
2016-12-01
21:50
{3209} let SynCommons compile with PUREPASCAL on Delphi 7 check-in: e6f603369f user: ab tags: trunk
21:21
{3208} defined public TSynUniqueIdentifierGenerator.Safe property check-in: f98c4b9309 user: ab tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SynCommons.pas.

31116
31117
31118
31119
31120
31121
31122
31123
31124
31125
31126
31127
31128
31129
31130
.....
31239
31240
31241
31242
31243
31244
31245




31246
31247
31248
31249
31250
31251
31252
.....
31266
31267
31268
31269
31270
31271
31272

31273
31274
31275
31276
31277
31278
31279
.....
31540
31541
31542
31543
31544
31545
31546
31547
31548
31549
31550
31551
31552
31553
31554
31555
31556
31557
.....
31578
31579
31580
31581
31582
31583
31584

31585
31586
31587
31588
31589
31590
31591
.....
31643
31644
31645
31646
31647
31648
31649

31650
31651
31652
31653
31654
31655
31656
  PEnd := P + len;
  if len >= 16 then
    begin
      PLimit := PEnd - 16;
      c3 := crc;
      c2 := c3 + PRIME32_2;
      c1 := c2 + PRIME32_1;
      c4 := c3 + cardinal(0-PRIME32_1);
      repeat
        c1 := PRIME32_1 * Rol13(c1 + PRIME32_2 * PCardinal(P)^);
        c2 := PRIME32_1 * Rol13(c2 + PRIME32_2 * PCardinal(P+4)^);
        c3 := PRIME32_1 * Rol13(c3 + PRIME32_2 * PCardinal(P+8)^);
        c4 := PRIME32_1 * Rol13(c4 + PRIME32_2 * PCardinal(P+12)^);
        inc(P, 16);
      until not (P <= PLimit);
................................................................................
@0:     not     eax
end;
{$endif CPU64}
{$endif CPUINTEL}

procedure crcblocks(crc128, data128: PBlock128; count: integer);
begin




  {$ifdef CPUX86}
  if (cfSSE42 in CpuFeatures) and (count>0) then
  asm
        mov     ecx, crc128
        mov     edx, data128
@s:     mov     eax, dword ptr[ecx]
        db      $F2, $0F, $38, $F1, $02
................................................................................
  end else
  while count>0 do begin
    crcblockpas(crc128,data128);
  {$else}
  while count>0 do begin
    crcblock(crc128,data128);
  {$endif CPUX86}

    inc(data128);
    dec(count);
  end;
end;

{$ifdef CPUINTEL}
procedure crcblockpas(crc128, data128: PBlock128);
................................................................................
        xor     eax, dword ptr[ebx * 4 + crc32ctab]
        inc     ecx
        jnz     @tail
        pop     ebx
        not     eax
end;




{$endif PUREPASCAL}
{$ifdef CPU386}
procedure GetCPUID(Param: Cardinal; var Registers: TRegisters);
asm
        push    esi
        push    edi
        mov     esi, edx
        mov     edi, eax
................................................................................
        mov     TRegisters(esi).&ecx, ecx
        mov     TRegisters(esi).&edx, edx
        pop     ebx
@nocpuid:
        pop     edi
        pop     esi
end;

function crc32csse42(crc: cardinal; buf: PAnsiChar; len: cardinal): cardinal;
asm // eax=crc, edx=buf, ecx=len
        not     eax
        test    ecx, ecx
        jz      @0
        test    edx, edx
        jz      @0
................................................................................
        dec     ecx
        jz      @0
        db      $F2, $0F, $38, $F0, $42, $02
        {$endif}
@0:     not     eax
end;
{$endif CPU386}


function crc32cUTF8ToHex(const str: RawUTF8): RawUTF8;
begin
  result := CardinalToHex(crc32c(0,pointer(str),length(str)));
end;

function crc64c(buf: PAnsiChar; len: cardinal): Int64;






|







 







>
>
>
>







 







>







 







<
<
<
<







 







>







 







>







31116
31117
31118
31119
31120
31121
31122
31123
31124
31125
31126
31127
31128
31129
31130
.....
31239
31240
31241
31242
31243
31244
31245
31246
31247
31248
31249
31250
31251
31252
31253
31254
31255
31256
.....
31270
31271
31272
31273
31274
31275
31276
31277
31278
31279
31280
31281
31282
31283
31284
.....
31545
31546
31547
31548
31549
31550
31551




31552
31553
31554
31555
31556
31557
31558
.....
31579
31580
31581
31582
31583
31584
31585
31586
31587
31588
31589
31590
31591
31592
31593
.....
31645
31646
31647
31648
31649
31650
31651
31652
31653
31654
31655
31656
31657
31658
31659
  PEnd := P + len;
  if len >= 16 then
    begin
      PLimit := PEnd - 16;
      c3 := crc;
      c2 := c3 + PRIME32_2;
      c1 := c2 + PRIME32_1;
      c4 := c3 - PRIME32_1;
      repeat
        c1 := PRIME32_1 * Rol13(c1 + PRIME32_2 * PCardinal(P)^);
        c2 := PRIME32_1 * Rol13(c2 + PRIME32_2 * PCardinal(P+4)^);
        c3 := PRIME32_1 * Rol13(c3 + PRIME32_2 * PCardinal(P+8)^);
        c4 := PRIME32_1 * Rol13(c4 + PRIME32_2 * PCardinal(P+12)^);
        inc(P, 16);
      until not (P <= PLimit);
................................................................................
@0:     not     eax
end;
{$endif CPU64}
{$endif CPUINTEL}

procedure crcblocks(crc128, data128: PBlock128; count: integer);
begin
  {$ifdef PUREPASCAL}
  while count>0 do begin
    crcblock(crc128,data128);
  {$else}
  {$ifdef CPUX86}
  if (cfSSE42 in CpuFeatures) and (count>0) then
  asm
        mov     ecx, crc128
        mov     edx, data128
@s:     mov     eax, dword ptr[ecx]
        db      $F2, $0F, $38, $F1, $02
................................................................................
  end else
  while count>0 do begin
    crcblockpas(crc128,data128);
  {$else}
  while count>0 do begin
    crcblock(crc128,data128);
  {$endif CPUX86}
  {$endif PUREPASCAL}
    inc(data128);
    dec(count);
  end;
end;

{$ifdef CPUINTEL}
procedure crcblockpas(crc128, data128: PBlock128);
................................................................................
        xor     eax, dword ptr[ebx * 4 + crc32ctab]
        inc     ecx
        jnz     @tail
        pop     ebx
        not     eax
end;





{$ifdef CPU386}
procedure GetCPUID(Param: Cardinal; var Registers: TRegisters);
asm
        push    esi
        push    edi
        mov     esi, edx
        mov     edi, eax
................................................................................
        mov     TRegisters(esi).&ecx, ecx
        mov     TRegisters(esi).&edx, edx
        pop     ebx
@nocpuid:
        pop     edi
        pop     esi
end;

function crc32csse42(crc: cardinal; buf: PAnsiChar; len: cardinal): cardinal;
asm // eax=crc, edx=buf, ecx=len
        not     eax
        test    ecx, ecx
        jz      @0
        test    edx, edx
        jz      @0
................................................................................
        dec     ecx
        jz      @0
        db      $F2, $0F, $38, $F0, $42, $02
        {$endif}
@0:     not     eax
end;
{$endif CPU386}
{$endif PUREPASCAL}

function crc32cUTF8ToHex(const str: RawUTF8): RawUTF8;
begin
  result := CardinalToHex(crc32c(0,pointer(str),length(str)));
end;

function crc64c(buf: PAnsiChar; len: cardinal): Int64;

Changes to SynCrypto.pas.

8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
    entropy: array[0..3] of TSHA256Digest; // 128 bytes
    paranoid: cardinal;
    p: PByteArray;
    i: integer;
  procedure hmacInit;
  var timenow: Int64;
      g: TGUID;
      i, val: cardinal;
  begin
    hmac.Init(@entropy,sizeof(entropy)); // bytes on CPU stack
    hmac.Update(@time,sizeof(time));
    QueryPerformanceCounter(timenow);
    hmac.Update(@timenow,sizeof(timenow)); // include GetEntropy() execution time
    for i := 0 to timenow and 3 do begin
      CreateGUID(g); // not random, but genuine






|







8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
    entropy: array[0..3] of TSHA256Digest; // 128 bytes
    paranoid: cardinal;
    p: PByteArray;
    i: integer;
  procedure hmacInit;
  var timenow: Int64;
      g: TGUID;
      i {$ifdef CPUINTEL}, val{$endif}: cardinal;
  begin
    hmac.Init(@entropy,sizeof(entropy)); // bytes on CPU stack
    hmac.Update(@time,sizeof(time));
    QueryPerformanceCounter(timenow);
    hmac.Update(@timenow,sizeof(timenow)); // include GetEntropy() execution time
    for i := 0 to timenow and 3 do begin
      CreateGUID(g); // not random, but genuine

Changes to Synopse.inc.

315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
  {$ifdef FPC_HAS_MANAGEMENT_OPERATORS}
    {$define ISDELPHI2006ANDUP}
  {$endif FPC_HAS_MANAGEMENT_OPERATORS}

{$else FPC}

  {$ifndef PUREPASCAL} // if PUREPASCAL is forced, ignore any x86/x64 asm
    {$define CPUINTEL} // no NextGen support yet
  {$endif}
  {$ifdef CPUX64}
    {$define CPU64} // Delphi compiler for 64 bit CPU
    {$define CPU64DELPHI}
    {$undef CPU32}
    {$define PUREPASCAL}   // no x86 32 bit asm to be used
  {$else CPUX64}






|
|







315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
  {$ifdef FPC_HAS_MANAGEMENT_OPERATORS}
    {$define ISDELPHI2006ANDUP}
  {$endif FPC_HAS_MANAGEMENT_OPERATORS}

{$else FPC}

  {$ifndef PUREPASCAL}
    {$define CPUINTEL} // Delphi only for Intel by now
  {$endif}
  {$ifdef CPUX64}
    {$define CPU64} // Delphi compiler for 64 bit CPU
    {$define CPU64DELPHI}
    {$undef CPU32}
    {$define PUREPASCAL}   // no x86 32 bit asm to be used
  {$else CPUX64}

Changes to SynopseCommit.inc.

1
'1.18.3208'
|
1
'1.18.3209'