diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2021-08-14 13:51:17 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2021-08-14 13:51:17 +0200 |
| commit | 0db86a0638d417583a042ea7b3c2e5304d653a17 (patch) | |
| tree | 6354102978265ae09c7b93ab91c350cd8e19c620 /core/math/big/common.odin | |
| parent | dc02566a84f0ad98aaa4f88f0a4e4abdd3aa1f1a (diff) | |
big: Add workaround for DLL globals bug.
Diffstat (limited to 'core/math/big/common.odin')
| -rw-r--r-- | core/math/big/common.odin | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/core/math/big/common.odin b/core/math/big/common.odin index 5e2fe4d8c..57fa32c9d 100644 --- a/core/math/big/common.odin +++ b/core/math/big/common.odin @@ -27,10 +27,22 @@ import "core:intrinsics" `initialize_constants` also replaces the other `_DEFAULT_*` cutoffs with custom compile-time values if so `#config`ured. */ -MUL_KARATSUBA_CUTOFF := initialize_constants(); -SQR_KARATSUBA_CUTOFF := _DEFAULT_SQR_KARATSUBA_CUTOFF; -MUL_TOOM_CUTOFF := _DEFAULT_MUL_TOOM_CUTOFF; -SQR_TOOM_CUTOFF := _DEFAULT_SQR_TOOM_CUTOFF; + +/* + There is a bug with DLL globals. They don't get set. + To allow tests to run we add `-define:MATH_BIG_EXE=false` to hardcode the cutoffs for now. +*/ +when #config(MATH_BIG_EXE, true) { + MUL_KARATSUBA_CUTOFF := initialize_constants(); + SQR_KARATSUBA_CUTOFF := _DEFAULT_SQR_KARATSUBA_CUTOFF; + MUL_TOOM_CUTOFF := _DEFAULT_MUL_TOOM_CUTOFF; + SQR_TOOM_CUTOFF := _DEFAULT_SQR_TOOM_CUTOFF; +} else { + MUL_KARATSUBA_CUTOFF := _DEFAULT_MUL_KARATSUBA_CUTOFF; + SQR_KARATSUBA_CUTOFF := _DEFAULT_SQR_KARATSUBA_CUTOFF; + MUL_TOOM_CUTOFF := _DEFAULT_MUL_TOOM_CUTOFF; + SQR_TOOM_CUTOFF := _DEFAULT_SQR_TOOM_CUTOFF; +} /* These defaults were tuned on an AMD A8-6600K (64-bit) using libTomMath's `make tune`. |