int128 on firstOrd, lastOrd and lengthOrd (#11701)

* fixes #11847
This commit is contained in:
Arne Döring 2019-08-07 15:53:16 +02:00 • committed by Andreas Rumpf
commit afbcd1b330
34 changed files with 530 additions and 314 deletions

View file

@ -596,12 +596,12 @@ proc genField(c: PCtx; n: PNode): TRegister =
proc genIndex(c: PCtx; n: PNode; arr: PType): TRegister =
if arr.skipTypes(abstractInst).kind == tyArray and (let x = firstOrd(c.config, arr);
x != 0):
x != Zero):
let tmp = c.genx(n)
# freeing the temporary here means we can produce: regA = regA - Imm
c.freeTemp(tmp)
result = c.getTemp(n.typ)
c.gABI(n, opcSubImmInt, result, tmp, x.int)
c.gABI(n, opcSubImmInt, result, tmp, toInt(x))
else:
result = c.genx(n)
@ -1767,7 +1767,7 @@ proc getNullValue(typ: PType, info: TLineInfo; conf: ConfigRef): PNode =
getNullValueAux(t, t.n, result, conf, currPosition)
of tyArray:
result = newNodeIT(nkBracket, info, t)
for i in 0 ..< int(lengthOrd(conf, t)):
for i in 0 ..< toInt(lengthOrd(conf, t)):
addSon(result, getNullValue(elemType(t), info, conf))
of tyTuple:
result = newNodeIT(nkTupleConstr, info, t)