remove a temporary variable in int128.nim (#16935)

This commit is contained in:
flywind 2021-02-04 10:41:23 -06:00 • committed by GitHub
commit bb85bc7ebc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,9 +1,9 @@
## This module is for compiler internal use only. For reliable error ## This module is for compiler internal use only. For reliable error
## messages and range checks, the compiler needs a data type that can ## messages and range checks, the compiler needs a data type that can
## hold all from ``low(BiggestInt)`` to ``high(BiggestUInt)``, This ## hold all from `low(BiggestInt)` to `high(BiggestUInt)`, This
## type is for that purpose. ## type is for that purpose.
from math import trunc from std/math import trunc
type type
Int128* = object Int128* = object
@ -176,7 +176,6 @@ proc toHex*(arg: Int128): string =
result.addToHex(arg) result.addToHex(arg)
proc inc*(a: var Int128, y: uint32 = 1) = proc inc*(a: var Int128, y: uint32 = 1) =
let input = a
a.udata[0] += y a.udata[0] += y
if unlikely(a.udata[0] < y): if unlikely(a.udata[0] < y):
a.udata[1].inc a.udata[1].inc
@ -379,7 +378,7 @@ proc `*`*(lhs,rhs: Int128): Int128 =
proc `*=`*(a: var Int128, b: Int128) = proc `*=`*(a: var Int128, b: Int128) =
a = a * b a = a * b
import bitops import std/bitops
proc fastLog2*(a: Int128): int = proc fastLog2*(a: Int128): int =
if a.udata[3] != 0: if a.udata[3] != 0: