UNPKG

932 BJavaScriptView Raw
1import leb from "./leb";
2/**
3 * According to https://webassembly.github.io/spec/core/binary/values.html#binary-int
4 * max = ceil(32/7)
5 */
6
7export var MAX_NUMBER_OF_BYTE_U32 = 5;
8/**
9 * According to https://webassembly.github.io/spec/core/binary/values.html#binary-int
10 * max = ceil(64/7)
11 */
12
13export var MAX_NUMBER_OF_BYTE_U64 = 10;
14export function decodeInt64(encodedBuffer, index) {
15 return leb.decodeInt64(encodedBuffer, index);
16}
17export function decodeUInt64(encodedBuffer, index) {
18 return leb.decodeUInt64(encodedBuffer, index);
19}
20export function decodeInt32(encodedBuffer, index) {
21 return leb.decodeInt32(encodedBuffer, index);
22}
23export function decodeUInt32(encodedBuffer, index) {
24 return leb.decodeUInt32(encodedBuffer, index);
25}
26export function encodeU32(v) {
27 return leb.encodeUInt32(v);
28}
29export function encodeI32(v) {
30 return leb.encodeInt32(v);
31}
32export function encodeI64(v) {
33 return leb.encodeInt64(v);
34}
\No newline at end of file