Fix #45 - shl/shr "halfSize" should have the same type as the input

This commit is contained in:
mratsim 2018-05-08 16:38:11 +02:00
parent 37c969b11e
commit 0ad3239907
1 changed files with 2 additions and 2 deletions

View File

@ -39,7 +39,7 @@ func `shl`*(x: UintImpl, y: SomeInteger): UintImpl {.inline.}=
# TODO: would it be better to reimplement this using an array of bytes/uint64
# That opens up to endianness issues.
const halfSize = getSize(x) div 2
const halfSize: type(y) = getSize(x) div 2
if y == 0:
return x
@ -53,7 +53,7 @@ func `shl`*(x: UintImpl, y: SomeInteger): UintImpl {.inline.}=
func `shr`*(x: UintImpl, y: SomeInteger): UintImpl {.inline.}=
## Compute the `shift right` operation of x and y
const halfSize = getSize(x) div 2
const halfSize: type(y) = getSize(x) div 2
if y == 0:
return x