summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorslangmgh <37659406+slangmgh@users.noreply.github.com>2021-06-07 17:42:32 +0800
committerGitHub <noreply@github.com>2021-06-07 11:42:32 +0200
commite7aa41ff3f6820d8ada3fd650d523c7f7d584fda (patch)
tree5481e769e0e61a8f79ea83c82e914601b14c8be0
parente7816a3e77ab0f821d66667dfc448f1898199f59 (diff)
downloadNim-e7aa41ff3f6820d8ada3fd650d523c7f7d584fda.tar.gz
fix 18186 with adding importc _umul128 (#18200)
-rw-r--r--lib/system/dragonbox.nim3
-rw-r--r--lib/system/schubfach.nim1
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/system/dragonbox.nim b/lib/system/dragonbox.nim
index db608c630..eec8749da 100644
--- a/lib/system/dragonbox.nim
+++ b/lib/system/dragonbox.nim
@@ -867,10 +867,11 @@ when defined(sizeof_Int128):
     return (hi, lo)
 
 elif defined(vcc) and defined(cpu64):
+  proc umul128(x, y: uint64, z: ptr uint64): uint64 {.importc: "_umul128", header: "<intrin.h>".}
   proc mul128*(x: uint64; y: uint64): uint64x2 {.inline.} =
     var hi: uint64 = 0
     var lo: uint64 = umul128(x, y, addr(hi))
-    return (hi, lo)
+    return uint64x2(hi: hi, lo: lo)
 
 else:
   proc lo32*(x: uint64): uint32 {.inline.} =
diff --git a/lib/system/schubfach.nim b/lib/system/schubfach.nim
index c344b7425..94d3d3c25 100644
--- a/lib/system/schubfach.nim
+++ b/lib/system/schubfach.nim
@@ -147,6 +147,7 @@ when defined(sizeof_Int128):
     return y1 or uint32(y0 > 1)
 
 elif defined(vcc) and defined(cpu64):
+  proc umul128(x, y: uint64, z: ptr uint64): uint64 {.importc: "_umul128", header: "<intrin.h>".}
   proc roundToOdd(g: uint64; cpHi: uint32): uint32 {.inline.} =
     var p1: uint64 = 0
     var p0: uint64 = umul128(g, cpHi, addr(p1))