throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
'size: 0x' + kMaxLength.toString(16) + ' bytes')
}
- return length >>> 0
+ return length | 0
}
function SlowBuffer (subject, encoding) {
Buffer.prototype.toString = function toString (encoding, start, end) {
var loweredCase = false
- start = start >>> 0
- end = end === undefined || end === Infinity ? this.length : end >>> 0
+ start = start | 0
+ end = end === undefined || end === Infinity ? this.length : end | 0
if (!encoding) encoding = 'utf8'
if (start < 0) start = 0
offset = 0
// Buffer#write(string, offset[, length][, encoding])
} else if (isFinite(offset)) {
- offset = offset >>> 0
+ offset = offset | 0
if (isFinite(length)) {
- length = length >>> 0
+ length = length | 0
if (encoding === undefined) encoding = 'utf8'
} else {
encoding = length
} else {
var swap = encoding
encoding = offset
- offset = length >>> 0
+ offset = length | 0
length = swap
}
}
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
- offset = offset >>> 0
- byteLength = byteLength >>> 0
+ offset = offset | 0
+ byteLength = byteLength | 0
if (!noAssert) checkOffset(offset, byteLength, this.length)
var val = this[offset]
}
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
- offset = offset >>> 0
- byteLength = byteLength >>> 0
+ offset = offset | 0
+ byteLength = byteLength | 0
if (!noAssert) {
checkOffset(offset, byteLength, this.length)
}
}
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
- offset = offset >>> 0
- byteLength = byteLength >>> 0
+ offset = offset | 0
+ byteLength = byteLength | 0
if (!noAssert) checkOffset(offset, byteLength, this.length)
var val = this[offset]
}
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
- offset = offset >>> 0
- byteLength = byteLength >>> 0
+ offset = offset | 0
+ byteLength = byteLength | 0
if (!noAssert) checkOffset(offset, byteLength, this.length)
var i = byteLength
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
value = +value
- offset = offset >>> 0
- byteLength = byteLength >>> 0
+ offset = offset | 0
+ byteLength = byteLength | 0
if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
var mul = 1
var i = 0
this[offset] = value & 0xFF
while (++i < byteLength && (mul *= 0x100)) {
- this[offset + i] = (value / mul) >>> 0 & 0xFF
+ this[offset + i] = (value / mul) & 0xFF
}
return offset + byteLength
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
value = +value
- offset = offset >>> 0
- byteLength = byteLength >>> 0
+ offset = offset | 0
+ byteLength = byteLength | 0
if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
var i = byteLength - 1
var mul = 1
this[offset + i] = value & 0xFF
while (--i >= 0 && (mul *= 0x100)) {
- this[offset + i] = (value / mul) >>> 0 & 0xFF
+ this[offset + i] = (value / mul) & 0xFF
}
return offset + byteLength
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
value = +value
- offset = offset >>> 0
+ offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
this[offset] = value
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
value = +value
- offset = offset >>> 0
+ offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = value
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
value = +value
- offset = offset >>> 0
+ offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 8)
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
value = +value
- offset = offset >>> 0
+ offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset + 3] = (value >>> 24)
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
value = +value
- offset = offset >>> 0
+ offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 24)
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
value = +value
- offset = offset >>> 0
+ offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
if (value < 0) value = 0xff + value + 1
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
value = +value
- offset = offset >>> 0
+ offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = value
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
value = +value
- offset = offset >>> 0
+ offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = (value >>> 8)
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
value = +value
- offset = offset >>> 0
+ offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
if (Buffer.TYPED_ARRAY_SUPPORT) {
this[offset] = value
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
value = +value
- offset = offset >>> 0
+ offset = offset | 0
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
if (value < 0) value = 0xffffffff + value + 1
if (Buffer.TYPED_ARRAY_SUPPORT) {