varint assert.
This commit is contained in:
parent
f0cc2f8c6c
commit
e354dea283
@ -336,7 +336,11 @@ BufferWriter.prototype.writeDoubleBE = function writeDoubleBE(value) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
BufferWriter.prototype.writeVarint = function writeVarint(value) {
|
BufferWriter.prototype.writeVarint = function writeVarint(value) {
|
||||||
assert(value >= 0);
|
if (typeof value === 'number')
|
||||||
|
assert(value >= 0);
|
||||||
|
else
|
||||||
|
assert(!value.isNeg());
|
||||||
|
|
||||||
this.written += utils.sizeVarint(value);
|
this.written += utils.sizeVarint(value);
|
||||||
this.data.push([VARINT, value]);
|
this.data.push([VARINT, value]);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user