File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -3,15 +3,14 @@ project(mpt-crypto C CXX)
33
44# --- Global Architecture Detection ---
55include (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)
1312else ()
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)
1615endif ()
1716
@@ -36,6 +35,7 @@ add_library(mpt-crypto
3635target_include_directories (mpt-crypto PUBLIC include )
3736
3837# --- Set Compile Definitions ---
38+ # Pass the architecture flags (MPT_ARCH_DEFS) to the compiler
3939target_compile_definitions (mpt-crypto PRIVATE ECMULT_WINDOW_SIZE=15 ECMULT_GEN_PREC_BITS=4 PUBLIC ${MPT_ARCH_DEFS} )
4040
4141# --- Link Dependencies ---
You can’t perform that action at this time.
0 commit comments