Browse files

Using a bit op can give a signed integer, which Buffer#writeUInt32BE …

…balks at.

There's no need to mask these anyway, as the various writeUInt.. routines do so.
  • Loading branch information...
1 parent dfc22bd commit ade802bdaff9389960bdca8befcb5529b6720f12 @squaremo committed Jun 18, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/constructor.js
View
10 lib/constructor.js
@@ -63,17 +63,17 @@ function writeInteger(segment, buf, offset, bindings) {
var size = segment.size * segment.unit;
switch (size) {
case 8:
- buf.writeUInt8(value & 0xff, offset);
+ buf.writeUInt8(value, offset);
break;
case 16:
(segment.bigendian) ?
- buf.writeUInt16BE(value & 0xffff, offset) :
- buf.writeUInt16LE(value & 0xffff, offset);
+ buf.writeUInt16BE(value, offset) :
+ buf.writeUInt16LE(value, offset);
break;
case 32:
(segment.bigendian) ?
- buf.writeUInt32BE(value & 0xffffffff, offset) :
- buf.writeUInt32LE(value & 0xffffffff, offset);
+ buf.writeUInt32BE(value, offset) :
+ buf.writeUInt32LE(value, offset);
break;
default:
throw "integer size * unit must be 8, 16, or 32";

0 comments on commit ade802b

Please sign in to comment.