From a27e4b519306f7bb883a1d32fbb39564c4bfee65 Mon Sep 17 00:00:00 2001 From: cheatfate Date: Thu, 18 Feb 2016 15:38:08 +0200 Subject: [PATCH] bug fix: repr() of sized enums presentation Issue #3864 --- lib/system/repr.nim | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/system/repr.nim b/lib/system/repr.nim index 986994203c..7f18ed31c9 100644 --- a/lib/system/repr.nim +++ b/lib/system/repr.nim @@ -76,6 +76,7 @@ proc reprEnum(e: int, typ: PNimType): string {.compilerRtl.} = # we read an 'int' but this may have been too large, so mask the other bits: let e = if typ.size == 1: e and 0xff elif typ.size == 2: e and 0xffff + elif typ.size == 4: e and 0xffffffff else: e # XXX we need a proper narrowing based on signedness here #e and ((1 shl (typ.size*8)) - 1)