summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-02-02 02:40:21 +0100
committerAraq <rumpf_a@web.de>2012-02-02 02:40:21 +0100
commit3af91064e56aab8a067f38b42c51665fb567383e (patch)
treeab3fdd8116a99fd71d9343cbe5a2b5b57282f461 /lib
parent7efe817ca3ad2323a8200b2f73539da4b9bfad24 (diff)
downloadNim-3af91064e56aab8a067f38b42c51665fb567383e.tar.gz
bugfix: reprEnum
Diffstat (limited to 'lib')
-rwxr-xr-xlib/system/repr.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/system/repr.nim b/lib/system/repr.nim
index 51498b3f5..2dec8136c 100755
--- a/lib/system/repr.nim
+++ b/lib/system/repr.nim
@@ -50,6 +50,8 @@ proc reprChar(x: char): string {.compilerRtl.} =
   add result, "\'"
 
 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 = e and (1 shl (typ.size*8)-1)
   if ntfEnumHole notin typ.flags:
     if e <% typ.node.len:
       return $typ.node.sons[e].name