fixes #2865
This commit is contained in:
parent
969981c1da
commit
4d4a993e7f
1 changed files with 8 additions and 1 deletions
|
|
@ -653,7 +653,14 @@ proc lengthOrd(t: PType): BiggestInt =
|
||||||
case t.kind
|
case t.kind
|
||||||
of tyInt64, tyInt32, tyInt: result = lastOrd(t)
|
of tyInt64, tyInt32, tyInt: result = lastOrd(t)
|
||||||
of tyDistinct, tyConst, tyMutable: result = lengthOrd(t.sons[0])
|
of tyDistinct, tyConst, tyMutable: result = lengthOrd(t.sons[0])
|
||||||
else: result = lastOrd(t) - firstOrd(t) + 1
|
else:
|
||||||
|
let last = lastOrd t
|
||||||
|
let first = firstOrd t
|
||||||
|
# XXX use a better overflow check here:
|
||||||
|
if last == high(BiggestInt) and first <= 0:
|
||||||
|
result = last
|
||||||
|
else:
|
||||||
|
result = lastOrd(t) - firstOrd(t) + 1
|
||||||
|
|
||||||
# -------------- type equality -----------------------------------------------
|
# -------------- type equality -----------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue