diff --git a/lib/encoder.js b/lib/encoder.js index f013536..33510c6 100644 --- a/lib/encoder.js +++ b/lib/encoder.js @@ -93,7 +93,7 @@ module.exports = function buildEncode(encodingTypes, forceFloat64) { buf = new Buffer(3) buf[0] = 0xcd buf.writeUInt16BE(obj, 1) - } else if (obj < 0xffffffff) { + } else if (obj <= 0xffffffff) { buf = new Buffer(5) buf[0] = 0xce buf.writeUInt32BE(obj, 1) diff --git a/test/32-bits-unsigned-integers.js b/test/32-bits-unsigned-integers.js index eaa8fa3..62606c2 100644 --- a/test/32-bits-unsigned-integers.js +++ b/test/32-bits-unsigned-integers.js @@ -13,6 +13,7 @@ test('encoding/decoding 32-bits big-endian unsigned integers', function(t) { } allNum.push(0xfffffffe) + allNum.push(0xffffffff) allNum.forEach(function(num) { t.test('encoding ' + num, function(t) { diff --git a/test/64-bits-unsigned-integers.js b/test/64-bits-unsigned-integers.js index 4fef71f..0b30566 100644 --- a/test/64-bits-unsigned-integers.js +++ b/test/64-bits-unsigned-integers.js @@ -7,7 +7,7 @@ test('encoding/decoding 64-bits big-endian unsigned integers', function(t) { var encoder = msgpack() , allNum = [] - allNum.push(0xffffffff) + allNum.push(0x0000000100000000) allNum.push(0xffffffffeeeee)