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
This commit is contained in:
Juan Carlos 2022-10-27 09:19:55 -03:00 • committed by GitHub
commit 82b7423cea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -345,11 +345,10 @@ proc low64(a: Int128): uint64 =
bitconcat(a.udata[1], a.udata[0]) bitconcat(a.udata[1], a.udata[0])
proc `*`*(lhs, rhs: Int128): Int128 = proc `*`*(lhs, rhs: Int128): Int128 =
let a32 = cast[uint64](lhs.udata[1]) let a32 = uint64(lhs.udata[1])
let a00 = cast[uint64](lhs.udata[0]) let a00 = uint64(lhs.udata[0])
let b32 = cast[uint64](rhs.udata[1]) let b32 = uint64(rhs.udata[1])
let b00 = cast[uint64](rhs.udata[0]) let b00 = uint64(rhs.udata[0])
result = makeInt128(high64(lhs) * low64(rhs) + low64(lhs) * high64(rhs) + a32 * b32, a00 * b00) result = makeInt128(high64(lhs) * low64(rhs) + low64(lhs) * high64(rhs) + a32 * b32, a00 * b00)
result += toInt128(a32 * b00) shl 32 result += toInt128(a32 * b00) shl 32
result += toInt128(a00 * b32) shl 32 result += toInt128(a00 * b32) shl 32