remove a temporary variable in int128.nim (#16935)
This commit is contained in:
parent
2b2836fc9d
commit
bb85bc7ebc
1 changed files with 34 additions and 35 deletions
|
|
@ -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:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue