This commit is contained in:
mratsim 2018-05-08 15:47:36 +02:00
commit 37c969b11e
1 changed files with 6 additions and 6 deletions

View File

@ -16,16 +16,16 @@ import macros,
# ################### Multiplication ################### #
func lo[T:SomeUnsignedInt](x: T): T {.inline.} =
func lo(x: uint64): uint64 {.inline.} =
const
p = T.sizeof * 8 div 2
base = 1 shl p
mask = base - 1
p: uint64 = 32
base: uint64 = 1 shl p
mask: uint64 = base - 1
result = x and mask
func hi[T:SomeUnsignedInt](x: T): T {.inline.} =
func hi(x: uint64): uint64 {.inline.} =
const
p = T.sizeof * 8 div 2
p = 32
result = x shr p
# No generic, somehow Nim is given ambiguous call with the T: UintImpl overload