Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
932 bytes
|
Line | |
---|
1 | import 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 |
|
---|
7 | export 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 |
|
---|
13 | export var MAX_NUMBER_OF_BYTE_U64 = 10;
|
---|
14 | export function decodeInt64(encodedBuffer, index) {
|
---|
15 | return leb.decodeInt64(encodedBuffer, index);
|
---|
16 | }
|
---|
17 | export function decodeUInt64(encodedBuffer, index) {
|
---|
18 | return leb.decodeUInt64(encodedBuffer, index);
|
---|
19 | }
|
---|
20 | export function decodeInt32(encodedBuffer, index) {
|
---|
21 | return leb.decodeInt32(encodedBuffer, index);
|
---|
22 | }
|
---|
23 | export function decodeUInt32(encodedBuffer, index) {
|
---|
24 | return leb.decodeUInt32(encodedBuffer, index);
|
---|
25 | }
|
---|
26 | export function encodeU32(v) {
|
---|
27 | return leb.encodeUInt32(v);
|
---|
28 | }
|
---|
29 | export function encodeI32(v) {
|
---|
30 | return leb.encodeInt32(v);
|
---|
31 | }
|
---|
32 | export function encodeI64(v) {
|
---|
33 | return leb.encodeInt64(v);
|
---|
34 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.