makes more tests green

This commit is contained in:
Andreas Rumpf 2019-09-02 22:03:06 +02:00
commit d70e292571
4 changed files with 11 additions and 19 deletions

View file

@ -16,13 +16,6 @@ template sdata(arg: Int128, idx: int): int32 =
# encoding least significant int first (like LittleEndian)
type
InvalidArgument = object of Exception
template require(cond: bool) =
if unlikely(not cond):
raise newException(InvalidArgument, "")
const
Zero* = Int128(udata: [0'u32,0,0,0])
One* = Int128(udata: [1'u32,0,0,0])
@ -378,7 +371,6 @@ proc `*`*(lhs,rhs: Int128): Int128 =
result = result + toInt128(a00 * b32) shl 32
if isNegative != isNegative(result):
echo result
assert(false, "overflow")
proc `*=`*(a: var Int128, b: Int128) =

View file

@ -396,13 +396,13 @@ proc leValueConv*(a, b: PNode): bool =
case a.kind
of nkCharLit..nkUInt64Lit:
case b.kind
of nkCharLit..nkUInt64Lit: result = a.intVal <= b.intVal
of nkCharLit..nkUInt64Lit: result = a.getInt <= b.getInt
of nkFloatLit..nkFloat128Lit: result = a.intVal <= round(b.floatVal).int
else: result = false #internalError(a.info, "leValueConv")
of nkFloatLit..nkFloat128Lit:
case b.kind
of nkFloatLit..nkFloat128Lit: result = a.floatVal <= b.floatVal
of nkCharLit..nkUInt64Lit: result = a.floatVal <= toFloat(int(b.intVal))
of nkCharLit..nkUInt64Lit: result = a.floatVal <= toFloat64(b.getInt)
else: result = false # internalError(a.info, "leValueConv")
else: result = false # internalError(a.info, "leValueConv")