Skip to content

Commit 4e5ff1e

Browse files
committed
improve CPU defines guard
1 parent e775c16 commit 4e5ff1e

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

HashLib/src/Include/HashLib.inc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,19 @@
5252
{$DEFINE HASHLIB_REQUIRES_PROPER_ALIGNMENT}
5353
{$ENDIF}
5454

55-
{$IFDEF CPUX86}
55+
// CPUX86 was introduced in XE2; older Delphi versions (2010, XE) only
56+
// have CPU386. On XE2+, CPUX86 alone is sufficient. The CPU386 fallback
57+
// covers 2010/XE - those versions had no 64-bit compiler, so the
58+
// CPU64BITS guard is harmless there (CPU64BITS itself was introduced
59+
// in XE8). The guard's real purpose is DCCOSX64 (64-bit Intel macOS,
60+
// available since 10.3 Rio Release 2), where Embarcadero's docs
61+
// indicate CPU386 is defined alongside CPU64BITS on a 64-bit target.
62+
{$IF DEFINED(CPUX86) OR (DEFINED(CPU386) AND NOT DEFINED(CPU64BITS))}
5663
{$DEFINE HASHLIB_I386}
5764
{$IFDEF MSWINDOWS}
5865
{$DEFINE HASHLIB_I386_ASM}
5966
{$ENDIF}
60-
{$ENDIF}
67+
{$IFEND}
6168

6269
{$IFDEF CPUX64}
6370
{$DEFINE HASHLIB_X86_64}

0 commit comments

Comments
 (0)