convert runtime signed int mul to vm friendly

This commit is contained in:
andri lim 2019-10-22 20:54:36 +07:00 committed by zah
parent 5cf0fb08fb
commit 0ee6dc5c6a
1 changed files with 2 additions and 2 deletions

View File

@ -7,11 +7,11 @@
#
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import ./datatypes, ./uint_mul
import ./datatypes, ./uint_mul, ./compiletime_helpers
func `*`*[T, T2](x, y: IntImpl[T, T2]): IntImpl[T, T2] {.inline.}=
## Multiplication for multi-precision signed integers
# For 2-complement representation this is the exact same
# as unsigned multiplication. We don't need to deal with the sign
# TODO: overflow detection.
cast[type result](cast[UIntImpl[T2]](x) * cast[UIntImpl[T2]](y))
convert[type result](convert[UIntImpl[T2]](x) * convert[UIntImpl[T2]](y))