jangko / msgpack4nim

MessagePack serializer/deserializer implementation for Nim / msgpack.org[Nim]
http://msgpack.org/
119 stars 21 forks source link

Packed tuples get corrupted when one of their fields is an int of 10 digits or more #13

Closed dawkot closed 6 years ago

dawkot commented 6 years ago
import msgpack4nim

proc unpack[T](s: string, typ: typedesc[T]): T =
    s.unpack result

echo((-557853050, 0).pack.unpack((int, int)))
echo((-5578530500, 0).pack.unpack((int, int)))

echo((0, -557853050, 0).pack.unpack((int, int, int)))
echo((0, -5578530500, 0).pack.unpack((int, int, int)))

echo((0, -5578530500, 0, 0).pack.unpack((int, int, int, int)))

(Field0: -557853050, Field1: 0) (Field0: -5578530500, Field1: -1283563204) (Field0: 0, Field1: -557853050, Field2: 0) (Field0: 0, Field1: -5578530500, Field2: -1283563204) (Field0: 0, Field1: -5578530500, Field2: -1283563204, Field3: 0)