summary refs log tree commit diff stats
path: root/lib/core
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-06-27 08:39:41 +0200
committerAraq <rumpf_a@web.de>2013-06-27 08:39:41 +0200
commite599fdd60d3a4110a2e7f9303a66853a4fa73108 (patch)
tree1ca594d8b4f88dc823d2e793c8db10e201ec83bc /lib/core
parent8d4f5038d0e8073da33c2cf393a5b187bf9285f5 (diff)
downloadNim-e599fdd60d3a4110a2e7f9303a66853a4fa73108.tar.gz
bugfix: marshal supports unsigned numbers
Diffstat (limited to 'lib/core')
-rw-r--r--lib/core/typeinfo.nim12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/core/typeinfo.nim b/lib/core/typeinfo.nim
index 6f8081b5f..4ce65ae91 100644
--- a/lib/core/typeinfo.nim
+++ b/lib/core/typeinfo.nim
@@ -379,7 +379,7 @@ proc getBiggestInt*(x: TAny): biggestInt =
   of tyInt8: result = biggestInt(cast[ptr int8](x.value)[])
   of tyInt16: result = biggestInt(cast[ptr int16](x.value)[])
   of tyInt32: result = biggestInt(cast[ptr int32](x.value)[])
-  of tyInt64: result = biggestInt(cast[ptr int64](x.value)[])
+  of tyInt64, tyUInt64: result = biggestInt(cast[ptr int64](x.value)[])
   of tyBool: result = biggestInt(cast[ptr bool](x.value)[])
   of tyChar: result = biggestInt(cast[ptr char](x.value)[])
   of tyEnum, tySet:
@@ -389,6 +389,10 @@ proc getBiggestInt*(x: TAny): biggestInt =
     of 4: result = biggestInt(cast[ptr int32](x.value)[])
     of 8: result = biggestInt(cast[ptr int64](x.value)[])
     else: assert false
+  of tyUInt: result = biggestInt(cast[ptr uint](x.value)[])
+  of tyUInt8: result = biggestInt(cast[ptr uint8](x.value)[])
+  of tyUInt16: result = biggestInt(cast[ptr uint16](x.value)[])
+  of tyUInt32: result = biggestInt(cast[ptr uint32](x.value)[])
   else: assert false
 
 proc setBiggestInt*(x: TAny, y: biggestInt) =
@@ -400,7 +404,7 @@ proc setBiggestInt*(x: TAny, y: biggestInt) =
   of tyInt8: cast[ptr int8](x.value)[] = int8(y)
   of tyInt16: cast[ptr int16](x.value)[] = int16(y)
   of tyInt32: cast[ptr int32](x.value)[] = int32(y)
-  of tyInt64: cast[ptr int64](x.value)[] = int64(y)
+  of tyInt64, tyUInt64: cast[ptr int64](x.value)[] = int64(y)
   of tyBool: cast[ptr bool](x.value)[] = y != 0
   of tyChar: cast[ptr char](x.value)[] = chr(y.int)
   of tyEnum, tySet:
@@ -410,6 +414,10 @@ proc setBiggestInt*(x: TAny, y: biggestInt) =
     of 4: cast[ptr int32](x.value)[] = int32(y)
     of 8: cast[ptr int64](x.value)[] = y
     else: assert false
+  of tyUInt: cast[ptr uint](x.value)[] = uint(y)
+  of tyUInt8: cast[ptr uint8](x.value)[] = uint8(y)
+  of tyUInt16: cast[ptr uint16](x.value)[] = uint16(y)
+  of tyUInt32: cast[ptr uint32](x.value)[] = uint32(y)
   else: assert false
 
 proc getChar*(x: TAny): char =