mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-15 07:43:26 +00:00
fixes #2865
This commit is contained in:
@@ -653,7 +653,14 @@ proc lengthOrd(t: PType): BiggestInt =
|
||||
case t.kind
|
||||
of tyInt64, tyInt32, tyInt: result = lastOrd(t)
|
||||
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 -----------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user