summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJuan Carlos <juancarlospaco@gmail.com>2022-10-27 09:19:55 -0300
committerGitHub <noreply@github.com>2022-10-27 14:19:55 +0200
commit82b7423ceab7ac2ceacbca921d47e17c894965cb (patch)
tree4246724efb69356941fea0734920012792ecd89c
parent0b1989d7369d8616f623aafb0658a2b6d8cb5f73 (diff)
downloadNim-82b7423ceab7ac2ceacbca921d47e17c894965cb.tar.gz
int128.nim fix warnings (#20666)
* Silence warning false positive for int128.nim: Warning: target type is larger than source type

* Silence warning false positive for int128.nim: Warning: target type is larger than source type

* https://github.com/nim-lang/Nim/pull/20666#discussion_r1006162835
-rw-r--r--compiler/int128.nim9
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/int128.nim b/compiler/int128.nim
index d85f96084..4791954a2 100644
--- a/compiler/int128.nim
+++ b/compiler/int128.nim
@@ -345,11 +345,10 @@ proc low64(a: Int128): uint64 =
   bitconcat(a.udata[1], a.udata[0])
 
 proc `*`*(lhs, rhs: Int128): Int128 =
-  let a32 = cast[uint64](lhs.udata[1])
-  let a00 = cast[uint64](lhs.udata[0])
-  let b32 = cast[uint64](rhs.udata[1])
-  let b00 = cast[uint64](rhs.udata[0])
-
+  let a32 = uint64(lhs.udata[1])
+  let a00 = uint64(lhs.udata[0])
+  let b32 = uint64(rhs.udata[1])
+  let b00 = uint64(rhs.udata[0])
   result = makeInt128(high64(lhs) * low64(rhs) + low64(lhs) * high64(rhs) + a32 * b32, a00 * b00)
   result += toInt128(a32 * b00) shl 32
   result += toInt128(a00 * b32) shl 32