tessel / t1-runtime

[UNMAINTAINED] Tessel 1 JavaScript runtime.
Other
117 stars 33 forks source link

Buffer UInt writes 0 for negative value (on hardware) #644

Open natevw opened 10 years ago

natevw commented 10 years ago
var b = Buffer(1),
    n = -2147483648;
b.writeUInt32BE(n, 0, true);
console.log("0x%s should be 0x80", b[0].toString(16));

node.js:

0x80 should be 0x80

colony:

0x80 should be 0x80

Tessel (hardware):

0x0 should be 0x80

One workaround would be to >>> 0 all potentially-negative writes.