diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ee1567..53629ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -168,6 +168,6 @@ jobs: env TEST_LANG="c" nimble test # run test against intx env TEST_LANG="cpp" nimble test - # test conditional compilation for arm654 arch + # test conditional compilation for arm64 arch # without running the binary nim c -c --cpu:arm64 --os:linux tests/all_tests diff --git a/.gitignore b/.gitignore index a68fbaa..eee2a2b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ nimcache/ build/ +nimble.paths diff --git a/config.nims b/config.nims new file mode 100644 index 0000000..7c9db32 --- /dev/null +++ b/config.nims @@ -0,0 +1,4 @@ +# begin Nimble config (version 1) +when fileExists("nimble.paths"): + include "nimble.paths" +# end Nimble config diff --git a/stint/private/primitives/addcarry_subborrow.nim b/stint/private/primitives/addcarry_subborrow.nim index b5e264c..7ed2680 100644 --- a/stint/private/primitives/addcarry_subborrow.nim +++ b/stint/private/primitives/addcarry_subborrow.nim @@ -88,6 +88,10 @@ const useIntrinsics = X86 and not stintNoIntrinsics useInt128 = GCC_Compatible and sizeof(int) == 8 and not stintNoIntrinsics +const + newerNim = (NimMajor, NimMinor) > (1, 6) + noExplicitPtrDeref = defined(cpp) or newerNim + when useIntrinsics: when defined(windows): {.pragma: intrinsics, header:"", nodecl.} @@ -152,7 +156,7 @@ func addC*(cOut: var Carry, sum: var uint64, a, b: uint64, cIn: Carry) {.inline. {.emit:[dblPrec, " = (unsigned __int128)", a," + (unsigned __int128)", b, " + (unsigned __int128)",cIn,";"].} # Don't forget to dereference the var param in C mode - when defined(cpp): + when noExplicitPtrDeref: {.emit:[cOut, " = (NU64)(", dblPrec," >> ", 64'u64, ");"].} {.emit:[sum, " = (NU64)", dblPrec,";"].} else: @@ -175,7 +179,7 @@ func subB*(bOut: var Borrow, diff: var uint64, a, b: uint64, bIn: Borrow) {.inli # Don't forget to dereference the var param in C mode # On borrow the high word will be 0b1111...1111 and needs to be masked - when defined(cpp): + when noExplicitPtrDeref: {.emit:[bOut, " = (NU64)(", dblPrec," >> ", 64'u64, ") & 1;"].} {.emit:[diff, " = (NU64)", dblPrec,";"].} else: