compact-encoding
Advanced tools
Comparing version 2.1.0 to 2.2.0
16
index.js
@@ -54,2 +54,18 @@ const LE = (new Uint8Array(new Uint16Array([255]).buffer))[0] === 0xff | ||
exports.uint32 = { | ||
preencode (state, n) { | ||
state.end += 4 | ||
}, | ||
encode (state, n) { | ||
state.buffer[state.start++] = n | ||
state.buffer[state.start++] = n >>> 8 | ||
state.buffer[state.start++] = n >>> 16 | ||
state.buffer[state.start++] = n >>> 24 | ||
}, | ||
decode (state) { | ||
if (state.end - state.start < 4) throw new Error('Out of bounds') | ||
return state.buffer[state.start++] + state.buffer[state.start++] * 256 + state.buffer[state.start++] * 65536 + state.buffer[state.start++] * 16777216 | ||
} | ||
} | ||
exports.buffer = { | ||
@@ -56,0 +72,0 @@ preencode (state, b) { |
{ | ||
"name": "compact-encoding", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "A series of compact encoding schemes for building small and fast parsers and serializers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
23306
541