Skip to content

Commit 740a58a

Browse files
committed
Replaced with to match the macro checked in .
1 parent a079363 commit 740a58a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ project(mpt-crypto C CXX)
33

44
# --- Global Architecture Detection ---
55
include(CheckTypeSize)
6-
check_type_size("unsigned __int128" HAVE_INT128_T)
6+
# Check if the compiler supports __int128 (required for the optimized 64-bit code)
7+
check_type_size("__int128" HAVE___INT128)
78

8-
# Store definitions in a variable
9-
if (HAVE_INT128_T OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm64"
10-
OR CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
11-
message(STATUS "Build: Detected 64-bit system. Enforcing 64-bit arithmetic.")
12-
set(MPT_ARCH_DEFS USE_SCALAR_4X64 USE_FIELD_5X52 HAVE___INT128)
9+
if (HAVE___INT128)
10+
message(STATUS "Build: Detected 128-bit integer support. Enabling 64-bit optimizations.")
11+
set(MPT_ARCH_DEFS SECP256K1_WIDEMUL_INT128 USE_FIELD_5X52 HAVE___INT128)
1312
else ()
14-
message(STATUS "Build: Detected 32-bit system. Enforcing generic arithmetic.")
13+
message(STATUS "Build: No 128-bit support detected. Using generic 32-bit arithmetic.")
1514
set(MPT_ARCH_DEFS USE_SCALAR_8X32 USE_FIELD_10X26)
1615
endif ()
1716

@@ -36,6 +35,7 @@ add_library(mpt-crypto
3635
target_include_directories(mpt-crypto PUBLIC include)
3736

3837
# --- Set Compile Definitions ---
38+
# Pass the architecture flags (MPT_ARCH_DEFS) to the compiler
3939
target_compile_definitions(mpt-crypto PRIVATE ECMULT_WINDOW_SIZE=15 ECMULT_GEN_PREC_BITS=4 PUBLIC ${MPT_ARCH_DEFS})
4040

4141
# --- Link Dependencies ---

0 commit comments

Comments
 (0)