uint8-varint
Advanced tools
Comparing version 1.0.1 to 1.0.2
import accessor from 'byte-access'; | ||
import { LongBits } from 'longbits'; | ||
import { allocUnsafe } from './alloc.js'; | ||
const LIMIT = 0x7fn; | ||
@@ -15,3 +16,3 @@ // https://github.com/joeltg/big-varint/blob/main/src/unsigned.ts | ||
if (buf == null) { | ||
buf = new Uint8Array(unsigned.encodingLength(value)); | ||
buf = allocUnsafe(unsigned.encodingLength(value)); | ||
} | ||
@@ -39,3 +40,3 @@ const access = accessor(buf); | ||
if (buf == null) { | ||
buf = new Uint8Array(signed.encodingLength(value)); | ||
buf = allocUnsafe(signed.encodingLength(value)); | ||
} | ||
@@ -58,3 +59,3 @@ if (value < 0n) { | ||
if (buf == null) { | ||
buf = new Uint8Array(zigzag.encodingLength(value)); | ||
buf = allocUnsafe(zigzag.encodingLength(value)); | ||
} | ||
@@ -61,0 +62,0 @@ LongBits.fromBigInt(value).zzEncode().toBytes(buf, offset); |
import { LongBits } from 'longbits'; | ||
import { allocUnsafe } from './alloc.js'; | ||
const N1 = Math.pow(2, 7); | ||
@@ -47,3 +48,3 @@ const N2 = Math.pow(2, 14); | ||
if (buf == null) { | ||
buf = new Uint8Array(unsigned.encodingLength(value)); | ||
buf = allocUnsafe(unsigned.encodingLength(value)); | ||
} | ||
@@ -66,3 +67,3 @@ LongBits.fromNumber(value).toBytes(buf, offset); | ||
if (buf == null) { | ||
buf = new Uint8Array(signed.encodingLength(value)); | ||
buf = allocUnsafe(signed.encodingLength(value)); | ||
} | ||
@@ -69,0 +70,0 @@ if (value < 0) { |
{ | ||
"name": "uint8-varint", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Read/write varints from Uint8Arrays and Uint8ArrayLists", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0 OR MIT", |
import type { Uint8ArrayList } from 'uint8arraylist' | ||
import accessor from 'byte-access' | ||
import { LongBits } from 'longbits' | ||
import { allocUnsafe } from './alloc.js' | ||
@@ -19,3 +20,3 @@ const LIMIT = 0x7fn | ||
if (buf == null) { | ||
buf = new Uint8Array(unsigned.encodingLength(value)) | ||
buf = allocUnsafe(unsigned.encodingLength(value)) | ||
} | ||
@@ -51,3 +52,3 @@ | ||
if (buf == null) { | ||
buf = new Uint8Array(signed.encodingLength(value)) | ||
buf = allocUnsafe(signed.encodingLength(value)) | ||
} | ||
@@ -76,3 +77,3 @@ | ||
if (buf == null) { | ||
buf = new Uint8Array(zigzag.encodingLength(value)) | ||
buf = allocUnsafe(zigzag.encodingLength(value)) | ||
} | ||
@@ -79,0 +80,0 @@ |
import type { Uint8ArrayList } from 'uint8arraylist' | ||
import { LongBits } from 'longbits' | ||
import { allocUnsafe } from './alloc.js' | ||
@@ -61,3 +62,3 @@ const N1 = Math.pow(2, 7) | ||
if (buf == null) { | ||
buf = new Uint8Array(unsigned.encodingLength(value)) | ||
buf = allocUnsafe(unsigned.encodingLength(value)) | ||
} | ||
@@ -86,3 +87,3 @@ | ||
if (buf == null) { | ||
buf = new Uint8Array(signed.encodingLength(value)) | ||
buf = allocUnsafe(signed.encodingLength(value)) | ||
} | ||
@@ -89,0 +90,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24759
18
365