[6a3a178] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.decodeInt64 = decodeInt64;
|
---|
| 7 | exports.decodeUInt64 = decodeUInt64;
|
---|
| 8 | exports.decodeInt32 = decodeInt32;
|
---|
| 9 | exports.decodeUInt32 = decodeUInt32;
|
---|
| 10 | exports.encodeU32 = encodeU32;
|
---|
| 11 | exports.encodeI32 = encodeI32;
|
---|
| 12 | exports.encodeI64 = encodeI64;
|
---|
| 13 | exports.MAX_NUMBER_OF_BYTE_U64 = exports.MAX_NUMBER_OF_BYTE_U32 = void 0;
|
---|
| 14 |
|
---|
| 15 | var _leb = _interopRequireDefault(require("./leb"));
|
---|
| 16 |
|
---|
| 17 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
---|
| 18 |
|
---|
| 19 | /**
|
---|
| 20 | * According to https://webassembly.github.io/spec/core/binary/values.html#binary-int
|
---|
| 21 | * max = ceil(32/7)
|
---|
| 22 | */
|
---|
| 23 | var MAX_NUMBER_OF_BYTE_U32 = 5;
|
---|
| 24 | /**
|
---|
| 25 | * According to https://webassembly.github.io/spec/core/binary/values.html#binary-int
|
---|
| 26 | * max = ceil(64/7)
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | exports.MAX_NUMBER_OF_BYTE_U32 = MAX_NUMBER_OF_BYTE_U32;
|
---|
| 30 | var MAX_NUMBER_OF_BYTE_U64 = 10;
|
---|
| 31 | exports.MAX_NUMBER_OF_BYTE_U64 = MAX_NUMBER_OF_BYTE_U64;
|
---|
| 32 |
|
---|
| 33 | function decodeInt64(encodedBuffer, index) {
|
---|
| 34 | return _leb.default.decodeInt64(encodedBuffer, index);
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | function decodeUInt64(encodedBuffer, index) {
|
---|
| 38 | return _leb.default.decodeUInt64(encodedBuffer, index);
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | function decodeInt32(encodedBuffer, index) {
|
---|
| 42 | return _leb.default.decodeInt32(encodedBuffer, index);
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | function decodeUInt32(encodedBuffer, index) {
|
---|
| 46 | return _leb.default.decodeUInt32(encodedBuffer, index);
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | function encodeU32(v) {
|
---|
| 50 | return _leb.default.encodeUInt32(v);
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | function encodeI32(v) {
|
---|
| 54 | return _leb.default.encodeInt32(v);
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | function encodeI64(v) {
|
---|
| 58 | return _leb.default.encodeInt64(v);
|
---|
| 59 | } |
---|