@bare-ts/lib 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codec/data.d.ts +4 -4
- package/dist/codec/data.js +16 -16
- package/dist/codec/float-array.d.ts +12 -12
- package/dist/codec/float-array.js +46 -49
- package/dist/codec/i16-array.d.ts +6 -6
- package/dist/codec/i16-array.js +22 -29
- package/dist/codec/i32-array.d.ts +6 -6
- package/dist/codec/i32-array.js +22 -29
- package/dist/codec/i64-array.d.ts +6 -6
- package/dist/codec/i64-array.js +22 -29
- package/dist/codec/i8-array.d.ts +4 -4
- package/dist/codec/i8-array.js +16 -16
- package/dist/codec/primitive.d.ts +36 -36
- package/dist/codec/primitive.js +139 -132
- package/dist/codec/string.d.ts +4 -2
- package/dist/codec/string.js +81 -77
- package/dist/codec/u16-array.d.ts +6 -6
- package/dist/codec/u16-array.js +22 -29
- package/dist/codec/u32-array.d.ts +6 -6
- package/dist/codec/u32-array.js +22 -29
- package/dist/codec/u64-array.d.ts +6 -6
- package/dist/codec/u64-array.js +22 -29
- package/dist/codec/u8-array.d.ts +4 -4
- package/dist/codec/u8-array.js +18 -16
- package/dist/codec/u8-clamped-array.d.ts +4 -4
- package/dist/codec/u8-clamped-array.js +16 -16
- package/dist/core/byte-cursor.d.ts +26 -8
- package/dist/core/byte-cursor.js +18 -28
- package/dist/index.cjs +551 -571
- package/package.json +1 -1
- package/CHANGELOG.md +0 -37
package/dist/index.cjs
CHANGED
|
@@ -27,99 +27,98 @@ __export(src_exports, {
|
|
|
27
27
|
BareError: () => BareError,
|
|
28
28
|
ByteCursor: () => ByteCursor,
|
|
29
29
|
Config: () => Config,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
30
|
+
readBool: () => readBool,
|
|
31
|
+
readData: () => readData,
|
|
32
|
+
readF32: () => readF32,
|
|
33
|
+
readF32Array: () => readF32Array,
|
|
34
|
+
readF32FixedArray: () => readF32FixedArray,
|
|
35
|
+
readF64: () => readF64,
|
|
36
|
+
readF64Array: () => readF64Array,
|
|
37
|
+
readF64FixedArray: () => readF64FixedArray,
|
|
38
|
+
readFixedData: () => readFixedData,
|
|
39
|
+
readFixedString: () => readFixedString,
|
|
40
|
+
readI16: () => readI16,
|
|
41
|
+
readI16Array: () => readI16Array,
|
|
42
|
+
readI16FixedArray: () => readI16FixedArray,
|
|
43
|
+
readI32: () => readI32,
|
|
44
|
+
readI32Array: () => readI32Array,
|
|
45
|
+
readI32FixedArray: () => readI32FixedArray,
|
|
46
|
+
readI64: () => readI64,
|
|
47
|
+
readI64Array: () => readI64Array,
|
|
48
|
+
readI64FixedArray: () => readI64FixedArray,
|
|
49
|
+
readI64Safe: () => readI64Safe,
|
|
50
|
+
readI8: () => readI8,
|
|
51
|
+
readI8Array: () => readI8Array,
|
|
52
|
+
readI8FixedArray: () => readI8FixedArray,
|
|
53
|
+
readInt: () => readInt,
|
|
54
|
+
readIntSafe: () => readIntSafe,
|
|
55
|
+
readString: () => readString,
|
|
56
|
+
readU16: () => readU16,
|
|
57
|
+
readU16Array: () => readU16Array,
|
|
58
|
+
readU16FixedArray: () => readU16FixedArray,
|
|
59
|
+
readU32: () => readU32,
|
|
60
|
+
readU32Array: () => readU32Array,
|
|
61
|
+
readU32FixedArray: () => readU32FixedArray,
|
|
62
|
+
readU64: () => readU64,
|
|
63
|
+
readU64Array: () => readU64Array,
|
|
64
|
+
readU64FixedArray: () => readU64FixedArray,
|
|
65
|
+
readU64Safe: () => readU64Safe,
|
|
66
|
+
readU8: () => readU8,
|
|
67
|
+
readU8Array: () => readU8Array,
|
|
68
|
+
readU8ClampedArray: () => readU8ClampedArray,
|
|
69
|
+
readU8ClampedFixedArray: () => readU8ClampedFixedArray,
|
|
70
|
+
readU8FixedArray: () => readU8FixedArray,
|
|
71
|
+
readUint: () => readUint,
|
|
72
|
+
readUintSafe: () => readUintSafe,
|
|
73
|
+
readVoid: () => readVoid,
|
|
74
|
+
writeBool: () => writeBool,
|
|
75
|
+
writeData: () => writeData,
|
|
76
|
+
writeF32: () => writeF32,
|
|
77
|
+
writeF32Array: () => writeF32Array,
|
|
78
|
+
writeF32FixedArray: () => writeF32FixedArray,
|
|
79
|
+
writeF64: () => writeF64,
|
|
80
|
+
writeF64Array: () => writeF64Array,
|
|
81
|
+
writeF64FixedArray: () => writeF64FixedArray,
|
|
82
|
+
writeFixedData: () => writeFixedData,
|
|
83
|
+
writeFixedString: () => writeFixedString,
|
|
84
|
+
writeI16: () => writeI16,
|
|
85
|
+
writeI16Array: () => writeI16Array,
|
|
86
|
+
writeI16FixedArray: () => writeI16FixedArray,
|
|
87
|
+
writeI32: () => writeI32,
|
|
88
|
+
writeI32Array: () => writeI32Array,
|
|
89
|
+
writeI32FixedArray: () => writeI32FixedArray,
|
|
90
|
+
writeI64: () => writeI64,
|
|
91
|
+
writeI64Array: () => writeI64Array,
|
|
92
|
+
writeI64FixedArray: () => writeI64FixedArray,
|
|
93
|
+
writeI64Safe: () => writeI64Safe,
|
|
94
|
+
writeI8: () => writeI8,
|
|
95
|
+
writeI8Array: () => writeI8Array,
|
|
96
|
+
writeI8FixedArray: () => writeI8FixedArray,
|
|
97
|
+
writeInt: () => writeInt,
|
|
98
|
+
writeIntSafe: () => writeIntSafe,
|
|
99
|
+
writeString: () => writeString,
|
|
100
|
+
writeU16: () => writeU16,
|
|
101
|
+
writeU16Array: () => writeU16Array,
|
|
102
|
+
writeU16FixedArray: () => writeU16FixedArray,
|
|
103
|
+
writeU32: () => writeU32,
|
|
104
|
+
writeU32Array: () => writeU32Array,
|
|
105
|
+
writeU32FixedArray: () => writeU32FixedArray,
|
|
106
|
+
writeU64: () => writeU64,
|
|
107
|
+
writeU64Array: () => writeU64Array,
|
|
108
|
+
writeU64FixedArray: () => writeU64FixedArray,
|
|
109
|
+
writeU64Safe: () => writeU64Safe,
|
|
110
|
+
writeU8: () => writeU8,
|
|
111
|
+
writeU8Array: () => writeU8Array,
|
|
112
|
+
writeU8ClampedArray: () => writeU8ClampedArray,
|
|
113
|
+
writeU8ClampedFixedArray: () => writeU8ClampedFixedArray,
|
|
114
|
+
writeU8FixedArray: () => writeU8FixedArray,
|
|
115
|
+
writeUint: () => writeUint,
|
|
116
|
+
writeUintSafe: () => writeUintSafe,
|
|
117
|
+
writeVoid: () => writeVoid
|
|
116
118
|
});
|
|
117
119
|
|
|
118
|
-
// src/codec/u8-array.ts
|
|
119
|
-
var import_assert4 = require("assert");
|
|
120
|
-
|
|
121
120
|
// src/codec/primitive.ts
|
|
122
|
-
var
|
|
121
|
+
var import_assert2 = require("assert");
|
|
123
122
|
|
|
124
123
|
// src/core/bare-error.ts
|
|
125
124
|
var BareError = class extends Error {
|
|
@@ -186,50 +185,40 @@ function Config(part) {
|
|
|
186
185
|
}
|
|
187
186
|
|
|
188
187
|
// src/core/byte-cursor.ts
|
|
189
|
-
var import_assert2 = require("assert");
|
|
190
188
|
var TOO_LARGE_BUFFER = "too large buffer";
|
|
191
189
|
var ByteCursor = class {
|
|
192
190
|
constructor(bytes, config) {
|
|
193
|
-
|
|
194
|
-
this.offset = 0;
|
|
195
|
-
this.view = bytes instanceof Uint8Array ? new DataView(bytes.buffer, bytes.byteOffset, bytes.length) : new DataView(bytes);
|
|
196
|
-
if (this.view.byteLength > config.maxBufferLength) {
|
|
191
|
+
if (bytes.length > config.maxBufferLength) {
|
|
197
192
|
throw new BareError(0, TOO_LARGE_BUFFER);
|
|
198
193
|
}
|
|
194
|
+
this.bytes = bytes;
|
|
195
|
+
this.config = config;
|
|
196
|
+
this.offset = 0;
|
|
197
|
+
this.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
|
|
199
198
|
}
|
|
200
199
|
check(min) {
|
|
201
|
-
if (this.offset + min > this.
|
|
200
|
+
if (this.offset + min > this.bytes.length) {
|
|
202
201
|
throw new BareError(this.offset, "missing bytes");
|
|
203
202
|
}
|
|
204
203
|
}
|
|
205
204
|
reserve(min) {
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const newLen = Math.min(bytes.length + Math.max(minExtraLength, bytes.length), config.maxBufferLength);
|
|
205
|
+
const minLen = this.offset + min | 0;
|
|
206
|
+
if (minLen > this.bytes.length) {
|
|
207
|
+
if (minLen > this.config.maxBufferLength) {
|
|
208
|
+
throw new BareError(0, TOO_LARGE_BUFFER);
|
|
209
|
+
}
|
|
210
|
+
const newLen = Math.min(minLen << 1, this.config.maxBufferLength);
|
|
213
211
|
const newBytes = new Uint8Array(newLen);
|
|
214
|
-
newBytes.set(bytes);
|
|
215
|
-
this.
|
|
212
|
+
newBytes.set(this.bytes);
|
|
213
|
+
this.bytes = newBytes;
|
|
214
|
+
this.view = new DataView(newBytes.buffer);
|
|
216
215
|
}
|
|
217
216
|
}
|
|
218
217
|
read(len) {
|
|
219
218
|
this.check(len);
|
|
220
|
-
const
|
|
219
|
+
const offset = this.offset;
|
|
221
220
|
this.offset += len;
|
|
222
|
-
return
|
|
223
|
-
}
|
|
224
|
-
write(bytes) {
|
|
225
|
-
const len = bytes.length;
|
|
226
|
-
if (len !== 0) {
|
|
227
|
-
this.reserve(len);
|
|
228
|
-
const bufferOffset = this.view.byteOffset + this.offset;
|
|
229
|
-
const buffer = new Uint8Array(this.view.buffer);
|
|
230
|
-
buffer.set(bytes, bufferOffset);
|
|
231
|
-
this.offset += len;
|
|
232
|
-
}
|
|
221
|
+
return this.bytes.subarray(offset, offset + len);
|
|
233
222
|
}
|
|
234
223
|
};
|
|
235
224
|
|
|
@@ -237,18 +226,18 @@ var ByteCursor = class {
|
|
|
237
226
|
var NAN_NOT_ALLOWED = "NaN is not allowed";
|
|
238
227
|
var NON_CANONICAL_REPRESENTATION = "must be canonical";
|
|
239
228
|
var TOO_LARGE_NUMBER2 = "too large number";
|
|
240
|
-
function
|
|
241
|
-
const val =
|
|
229
|
+
function readBool(bc) {
|
|
230
|
+
const val = readU8(bc);
|
|
242
231
|
if (val > 1) {
|
|
243
232
|
bc.offset--;
|
|
244
233
|
throw new BareError(bc.offset, "a bool must be equal to 0 or 1");
|
|
245
234
|
}
|
|
246
235
|
return val !== 0;
|
|
247
236
|
}
|
|
248
|
-
function
|
|
249
|
-
|
|
237
|
+
function writeBool(bc, x) {
|
|
238
|
+
writeU8(bc, x ? 1 : 0);
|
|
250
239
|
}
|
|
251
|
-
function
|
|
240
|
+
function readF32(bc) {
|
|
252
241
|
bc.check(4);
|
|
253
242
|
const result = bc.view.getFloat32(bc.offset, true);
|
|
254
243
|
if (Number.isNaN(result)) {
|
|
@@ -257,14 +246,14 @@ function decodeF32(bc) {
|
|
|
257
246
|
bc.offset += 4;
|
|
258
247
|
return result;
|
|
259
248
|
}
|
|
260
|
-
function
|
|
261
|
-
(0,
|
|
249
|
+
function writeF32(bc, x) {
|
|
250
|
+
(0, import_assert2.ok)(!Number.isNaN(x), NAN_NOT_ALLOWED);
|
|
262
251
|
bc.reserve(4);
|
|
263
252
|
bc.view.setFloat32(bc.offset, x, true);
|
|
264
|
-
(0,
|
|
253
|
+
(0, import_assert2.ok)(Math.abs(bc.view.getFloat32(bc.offset, true) - x) <= Number.EPSILON, TOO_LARGE_NUMBER2);
|
|
265
254
|
bc.offset += 4;
|
|
266
255
|
}
|
|
267
|
-
function
|
|
256
|
+
function readF64(bc) {
|
|
268
257
|
bc.check(8);
|
|
269
258
|
const result = bc.view.getFloat64(bc.offset, true);
|
|
270
259
|
if (Number.isNaN(result)) {
|
|
@@ -273,69 +262,69 @@ function decodeF64(bc) {
|
|
|
273
262
|
bc.offset += 8;
|
|
274
263
|
return result;
|
|
275
264
|
}
|
|
276
|
-
function
|
|
277
|
-
(0,
|
|
265
|
+
function writeF64(bc, x) {
|
|
266
|
+
(0, import_assert2.ok)(!Number.isNaN(x), NAN_NOT_ALLOWED);
|
|
278
267
|
bc.reserve(8);
|
|
279
268
|
bc.view.setFloat64(bc.offset, x, true);
|
|
280
269
|
bc.offset += 8;
|
|
281
270
|
}
|
|
282
|
-
function
|
|
271
|
+
function readI8(bc) {
|
|
283
272
|
bc.check(1);
|
|
284
273
|
return bc.view.getInt8(bc.offset++);
|
|
285
274
|
}
|
|
286
|
-
function
|
|
287
|
-
(0,
|
|
275
|
+
function writeI8(bc, x) {
|
|
276
|
+
(0, import_assert2.ok)(isI8(x), TOO_LARGE_NUMBER2);
|
|
288
277
|
bc.reserve(1);
|
|
289
278
|
bc.view.setInt8(bc.offset++, x);
|
|
290
279
|
}
|
|
291
|
-
function
|
|
280
|
+
function readI16(bc) {
|
|
292
281
|
bc.check(2);
|
|
293
282
|
const result = bc.view.getInt16(bc.offset, true);
|
|
294
283
|
bc.offset += 2;
|
|
295
284
|
return result;
|
|
296
285
|
}
|
|
297
|
-
function
|
|
298
|
-
(0,
|
|
286
|
+
function writeI16(bc, x) {
|
|
287
|
+
(0, import_assert2.ok)(isI16(x), TOO_LARGE_NUMBER2);
|
|
299
288
|
bc.reserve(2);
|
|
300
289
|
bc.view.setInt16(bc.offset, x, true);
|
|
301
290
|
bc.offset += 2;
|
|
302
291
|
}
|
|
303
|
-
function
|
|
292
|
+
function readI32(bc) {
|
|
304
293
|
bc.check(4);
|
|
305
294
|
const result = bc.view.getInt32(bc.offset, true);
|
|
306
295
|
bc.offset += 4;
|
|
307
296
|
return result;
|
|
308
297
|
}
|
|
309
|
-
function
|
|
310
|
-
(0,
|
|
298
|
+
function writeI32(bc, x) {
|
|
299
|
+
(0, import_assert2.ok)(isI32(x), TOO_LARGE_NUMBER2);
|
|
311
300
|
bc.reserve(4);
|
|
312
301
|
bc.view.setInt32(bc.offset, x, true);
|
|
313
302
|
bc.offset += 4;
|
|
314
303
|
}
|
|
315
|
-
function
|
|
304
|
+
function readI64(bc) {
|
|
316
305
|
bc.check(8);
|
|
317
306
|
const result = bc.view.getBigInt64(bc.offset, true);
|
|
318
307
|
bc.offset += 8;
|
|
319
308
|
return result;
|
|
320
309
|
}
|
|
321
|
-
function
|
|
322
|
-
(0,
|
|
310
|
+
function writeI64(bc, x) {
|
|
311
|
+
(0, import_assert2.ok)(isI64(x), TOO_LARGE_NUMBER2);
|
|
323
312
|
bc.reserve(8);
|
|
324
313
|
bc.view.setBigInt64(bc.offset, x, true);
|
|
325
314
|
bc.offset += 8;
|
|
326
315
|
}
|
|
327
|
-
function
|
|
328
|
-
const result =
|
|
316
|
+
function readI64Safe(bc) {
|
|
317
|
+
const result = readU32(bc) + readI32(bc) * 4294967296;
|
|
329
318
|
if (!Number.isSafeInteger(result)) {
|
|
330
319
|
bc.offset -= 8;
|
|
331
320
|
throw new BareError(bc.offset, TOO_LARGE_NUMBER2);
|
|
332
321
|
}
|
|
333
322
|
return result;
|
|
334
323
|
}
|
|
335
|
-
function
|
|
336
|
-
(0,
|
|
324
|
+
function writeI64Safe(bc, x) {
|
|
325
|
+
(0, import_assert2.ok)(Number.isSafeInteger(x), TOO_LARGE_NUMBER2);
|
|
337
326
|
const lowest32 = x >>> 0;
|
|
338
|
-
|
|
327
|
+
writeU32(bc, lowest32);
|
|
339
328
|
let highest32 = x / 4294967296 | 0;
|
|
340
329
|
if (x < 0) {
|
|
341
330
|
highest32 = ~Math.abs(highest32) >>> 0;
|
|
@@ -343,27 +332,27 @@ function encodeI64Safe(bc, x) {
|
|
|
343
332
|
highest32++;
|
|
344
333
|
}
|
|
345
334
|
}
|
|
346
|
-
|
|
335
|
+
writeU32(bc, highest32);
|
|
347
336
|
}
|
|
348
|
-
function
|
|
349
|
-
const zigZag =
|
|
337
|
+
function readInt(bc) {
|
|
338
|
+
const zigZag = readUint(bc);
|
|
350
339
|
return zigZag >> BigInt(1) ^ -(zigZag & BigInt(1));
|
|
351
340
|
}
|
|
352
|
-
function
|
|
353
|
-
(0,
|
|
341
|
+
function writeInt(bc, x) {
|
|
342
|
+
(0, import_assert2.ok)(isI64(x), TOO_LARGE_NUMBER2);
|
|
354
343
|
const zigZag = x >> BigInt(63) ^ x << BigInt(1);
|
|
355
|
-
|
|
344
|
+
writeUint(bc, zigZag);
|
|
356
345
|
}
|
|
357
346
|
var INT_SAFE_MAX_BYTE_COUNT = 8;
|
|
358
|
-
function
|
|
359
|
-
const firstByte =
|
|
347
|
+
function readIntSafe(bc) {
|
|
348
|
+
const firstByte = readU8(bc);
|
|
360
349
|
let result = (firstByte & 127) >> 1;
|
|
361
350
|
if (firstByte >= 128) {
|
|
362
351
|
let shiftMul = 64;
|
|
363
352
|
let byteCount = 1;
|
|
364
353
|
let byte;
|
|
365
354
|
do {
|
|
366
|
-
byte =
|
|
355
|
+
byte = readU8(bc);
|
|
367
356
|
result += (byte & 127) * shiftMul;
|
|
368
357
|
shiftMul *= 128;
|
|
369
358
|
byteCount++;
|
|
@@ -383,8 +372,8 @@ function decodeIntSafe(bc) {
|
|
|
383
372
|
}
|
|
384
373
|
return result;
|
|
385
374
|
}
|
|
386
|
-
function
|
|
387
|
-
(0,
|
|
375
|
+
function writeIntSafe(bc, x) {
|
|
376
|
+
(0, import_assert2.ok)(Number.isSafeInteger(x), TOO_LARGE_NUMBER2);
|
|
388
377
|
const sign = x < 0 ? 1 : 0;
|
|
389
378
|
if (x < 0) {
|
|
390
379
|
x = -(x + 1);
|
|
@@ -392,103 +381,107 @@ function encodeIntSafe(bc, x) {
|
|
|
392
381
|
const firstByte = (x & 63) << 1 | sign;
|
|
393
382
|
x = Math.floor(x / 64);
|
|
394
383
|
if (x > 0) {
|
|
395
|
-
|
|
396
|
-
|
|
384
|
+
writeU8(bc, 128 | firstByte);
|
|
385
|
+
writeUintSafe(bc, x);
|
|
397
386
|
} else {
|
|
398
|
-
|
|
387
|
+
writeU8(bc, firstByte);
|
|
399
388
|
}
|
|
400
389
|
}
|
|
401
|
-
function
|
|
390
|
+
function readU8(bc) {
|
|
402
391
|
bc.check(1);
|
|
403
|
-
return bc.
|
|
392
|
+
return bc.bytes[bc.offset++];
|
|
404
393
|
}
|
|
405
|
-
function
|
|
406
|
-
(0,
|
|
394
|
+
function writeU8(bc, x) {
|
|
395
|
+
(0, import_assert2.ok)(isU8(x), TOO_LARGE_NUMBER2);
|
|
407
396
|
bc.reserve(1);
|
|
408
|
-
bc.
|
|
397
|
+
bc.bytes[bc.offset++] = x;
|
|
409
398
|
}
|
|
410
|
-
function
|
|
399
|
+
function readU16(bc) {
|
|
411
400
|
bc.check(2);
|
|
412
401
|
const result = bc.view.getUint16(bc.offset, true);
|
|
413
402
|
bc.offset += 2;
|
|
414
403
|
return result;
|
|
415
404
|
}
|
|
416
|
-
function
|
|
417
|
-
(0,
|
|
405
|
+
function writeU16(bc, x) {
|
|
406
|
+
(0, import_assert2.ok)(isU16(x), TOO_LARGE_NUMBER2);
|
|
418
407
|
bc.reserve(2);
|
|
419
408
|
bc.view.setUint16(bc.offset, x, true);
|
|
420
409
|
bc.offset += 2;
|
|
421
410
|
}
|
|
422
|
-
function
|
|
411
|
+
function readU32(bc) {
|
|
423
412
|
bc.check(4);
|
|
424
413
|
const result = bc.view.getUint32(bc.offset, true);
|
|
425
414
|
bc.offset += 4;
|
|
426
415
|
return result;
|
|
427
416
|
}
|
|
428
|
-
function
|
|
429
|
-
(0,
|
|
417
|
+
function writeU32(bc, x) {
|
|
418
|
+
(0, import_assert2.ok)(isU32(x), TOO_LARGE_NUMBER2);
|
|
430
419
|
bc.reserve(4);
|
|
431
420
|
bc.view.setUint32(bc.offset, x, true);
|
|
432
421
|
bc.offset += 4;
|
|
433
422
|
}
|
|
434
|
-
function
|
|
423
|
+
function readU64(bc) {
|
|
435
424
|
bc.check(8);
|
|
436
425
|
const result = bc.view.getBigUint64(bc.offset, true);
|
|
437
426
|
bc.offset += 8;
|
|
438
427
|
return result;
|
|
439
428
|
}
|
|
440
|
-
function
|
|
441
|
-
(0,
|
|
429
|
+
function writeU64(bc, x) {
|
|
430
|
+
(0, import_assert2.ok)(isU64(x), TOO_LARGE_NUMBER2);
|
|
442
431
|
bc.reserve(8);
|
|
443
432
|
bc.view.setBigUint64(bc.offset, x, true);
|
|
444
433
|
bc.offset += 8;
|
|
445
434
|
}
|
|
446
|
-
function
|
|
447
|
-
const result =
|
|
435
|
+
function readU64Safe(bc) {
|
|
436
|
+
const result = readU32(bc) + readU32(bc) * 4294967296;
|
|
448
437
|
if (!isSafeU64(result)) {
|
|
449
438
|
bc.offset -= 8;
|
|
450
439
|
throw new BareError(bc.offset, TOO_LARGE_NUMBER2);
|
|
451
440
|
}
|
|
452
441
|
return result;
|
|
453
442
|
}
|
|
454
|
-
function
|
|
455
|
-
(0,
|
|
456
|
-
|
|
457
|
-
|
|
443
|
+
function writeU64Safe(bc, x) {
|
|
444
|
+
(0, import_assert2.ok)(isSafeU64(x), TOO_LARGE_NUMBER2);
|
|
445
|
+
writeU32(bc, x >>> 0);
|
|
446
|
+
writeU32(bc, x / 4294967296 >>> 0);
|
|
458
447
|
}
|
|
459
448
|
var UINT_MAX_BYTE_COUNT = 10;
|
|
460
|
-
function
|
|
461
|
-
let
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
byte
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
449
|
+
function readUint(bc) {
|
|
450
|
+
let low = readU8(bc);
|
|
451
|
+
if (low >= 128) {
|
|
452
|
+
low &= 127;
|
|
453
|
+
let shiftMul = 128;
|
|
454
|
+
let byteCount = 1;
|
|
455
|
+
let byte;
|
|
456
|
+
do {
|
|
457
|
+
byte = readU8(bc);
|
|
458
|
+
low += (byte & 127) * shiftMul;
|
|
459
|
+
shiftMul *= 128;
|
|
460
|
+
byteCount++;
|
|
461
|
+
} while (byte >= 128 && byteCount < 7);
|
|
462
|
+
let height = 0;
|
|
463
|
+
shiftMul = 1;
|
|
464
|
+
while (byte >= 128 && byteCount < UINT_MAX_BYTE_COUNT) {
|
|
465
|
+
byte = readU8(bc);
|
|
466
|
+
height += (byte & 127) * shiftMul;
|
|
467
|
+
shiftMul *= 128;
|
|
468
|
+
byteCount++;
|
|
469
|
+
}
|
|
470
|
+
if (byte === 0 || byteCount === UINT_MAX_BYTE_COUNT && byte > 1) {
|
|
471
|
+
bc.offset -= byteCount;
|
|
472
|
+
throw new BareError(bc.offset, NON_CANONICAL_REPRESENTATION);
|
|
473
|
+
}
|
|
474
|
+
return BigInt(low) + (BigInt(height) << BigInt(7 * 7));
|
|
482
475
|
}
|
|
483
|
-
return BigInt(low)
|
|
476
|
+
return BigInt(low);
|
|
484
477
|
}
|
|
485
|
-
function
|
|
486
|
-
(0,
|
|
478
|
+
function writeUint(bc, x) {
|
|
479
|
+
(0, import_assert2.ok)(isU64(x), TOO_LARGE_NUMBER2);
|
|
487
480
|
let tmp = Number(BigInt.asUintN(7 * 7, x));
|
|
488
481
|
let rest = Number(x >> BigInt(7 * 7));
|
|
489
482
|
let byteCount = 0;
|
|
490
483
|
while (tmp >= 128 || rest !== 0) {
|
|
491
|
-
|
|
484
|
+
writeU8(bc, 128 | tmp & 127);
|
|
492
485
|
tmp = Math.floor(tmp / 128);
|
|
493
486
|
byteCount++;
|
|
494
487
|
if (byteCount === 7) {
|
|
@@ -496,387 +489,381 @@ function encodeUint(bc, x) {
|
|
|
496
489
|
rest = 0;
|
|
497
490
|
}
|
|
498
491
|
}
|
|
499
|
-
|
|
492
|
+
writeU8(bc, tmp);
|
|
500
493
|
}
|
|
501
494
|
var UINT_SAFE_MAX_BYTE_COUNT = 8;
|
|
502
|
-
function
|
|
503
|
-
let result =
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
byte
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
495
|
+
function readUintSafe(bc) {
|
|
496
|
+
let result = readU8(bc);
|
|
497
|
+
if (result >= 128) {
|
|
498
|
+
result &= 127;
|
|
499
|
+
let shiftMul = 128;
|
|
500
|
+
let byteCount = 1;
|
|
501
|
+
let byte;
|
|
502
|
+
do {
|
|
503
|
+
byte = readU8(bc);
|
|
504
|
+
result += (byte & 127) * shiftMul;
|
|
505
|
+
shiftMul *= 128;
|
|
506
|
+
byteCount++;
|
|
507
|
+
} while (byte >= 128 && byteCount < UINT_SAFE_MAX_BYTE_COUNT);
|
|
508
|
+
if (byte === 0) {
|
|
509
|
+
bc.offset -= byteCount - 1;
|
|
510
|
+
throw new BareError(bc.offset - byteCount + 1, NON_CANONICAL_REPRESENTATION);
|
|
511
|
+
}
|
|
512
|
+
if (byteCount === UINT_SAFE_MAX_BYTE_COUNT && byte > 15) {
|
|
513
|
+
bc.offset -= byteCount - 1;
|
|
514
|
+
throw new BareError(bc.offset, TOO_LARGE_NUMBER2);
|
|
515
|
+
}
|
|
520
516
|
}
|
|
521
517
|
return result;
|
|
522
518
|
}
|
|
523
|
-
function
|
|
524
|
-
(0,
|
|
519
|
+
function writeUintSafe(bc, x) {
|
|
520
|
+
(0, import_assert2.ok)(isSafeU64(x), TOO_LARGE_NUMBER2);
|
|
525
521
|
while (x >= 128) {
|
|
526
|
-
|
|
522
|
+
writeU8(bc, 128 | x & 127);
|
|
527
523
|
x = Math.floor(x / 128);
|
|
528
524
|
}
|
|
529
|
-
|
|
525
|
+
writeU8(bc, x);
|
|
530
526
|
}
|
|
531
|
-
function
|
|
527
|
+
function readVoid(_dc) {
|
|
532
528
|
return void 0;
|
|
533
529
|
}
|
|
534
|
-
function
|
|
530
|
+
function writeVoid(_dc, _x) {
|
|
535
531
|
}
|
|
536
532
|
|
|
537
533
|
// src/codec/u8-array.ts
|
|
538
|
-
function
|
|
539
|
-
|
|
540
|
-
return bc.read(len).slice();
|
|
534
|
+
function readU8Array(bc) {
|
|
535
|
+
return readU8FixedArray(bc, readUintSafe(bc));
|
|
541
536
|
}
|
|
542
|
-
function
|
|
543
|
-
|
|
544
|
-
bc
|
|
537
|
+
function writeU8Array(bc, x) {
|
|
538
|
+
writeUintSafe(bc, x.length);
|
|
539
|
+
writeU8FixedArray(bc, x);
|
|
545
540
|
}
|
|
546
|
-
function
|
|
541
|
+
function readU8FixedArray(bc, len) {
|
|
547
542
|
return bc.read(len).slice();
|
|
548
543
|
}
|
|
549
|
-
function
|
|
550
|
-
|
|
551
|
-
|
|
544
|
+
function writeU8FixedArray(bc, x) {
|
|
545
|
+
const len = x.length;
|
|
546
|
+
if (len !== 0) {
|
|
547
|
+
bc.reserve(len);
|
|
548
|
+
bc.bytes.set(x, bc.offset);
|
|
549
|
+
bc.offset += len;
|
|
550
|
+
}
|
|
552
551
|
}
|
|
553
552
|
|
|
554
553
|
// src/codec/data.ts
|
|
555
|
-
function
|
|
556
|
-
return
|
|
554
|
+
function readData(bc) {
|
|
555
|
+
return readU8Array(bc).buffer;
|
|
557
556
|
}
|
|
558
|
-
function
|
|
559
|
-
|
|
557
|
+
function writeData(bc, x) {
|
|
558
|
+
writeU8Array(bc, new Uint8Array(x));
|
|
560
559
|
}
|
|
561
|
-
function
|
|
562
|
-
return
|
|
560
|
+
function readFixedData(bc, len) {
|
|
561
|
+
return readU8FixedArray(bc, len).buffer;
|
|
563
562
|
}
|
|
564
|
-
function
|
|
565
|
-
|
|
563
|
+
function writeFixedData(bc, x) {
|
|
564
|
+
writeU8FixedArray(bc, new Uint8Array(x));
|
|
566
565
|
}
|
|
567
566
|
|
|
568
567
|
// src/codec/float-array.ts
|
|
569
|
-
var
|
|
568
|
+
var import_assert3 = require("assert");
|
|
570
569
|
|
|
571
570
|
// src/util/util.ts
|
|
572
571
|
var IS_LITTLE_ENDIAN_PLATFORM = new DataView(Uint16Array.of(1).buffer).getUint8(0) === 1;
|
|
573
572
|
|
|
574
573
|
// src/codec/float-array.ts
|
|
575
574
|
var NAN_NOT_ALLOWED2 = "NaN is not allowed";
|
|
576
|
-
var
|
|
577
|
-
function
|
|
575
|
+
var readF32FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? readF32FixedArrayLE : readF32FixedArrayBE;
|
|
576
|
+
function readF32FixedArrayLE(bc, len) {
|
|
578
577
|
const byteLen = len * 4;
|
|
579
|
-
const result = new Float32Array(
|
|
578
|
+
const result = new Float32Array(readFixedData(bc, byteLen));
|
|
580
579
|
if (result.some(Number.isNaN)) {
|
|
581
580
|
throw new BareError(bc.offset, NAN_NOT_ALLOWED2);
|
|
582
581
|
}
|
|
583
582
|
return result;
|
|
584
583
|
}
|
|
585
|
-
function
|
|
584
|
+
function readF32FixedArrayBE(bc, len) {
|
|
586
585
|
bc.check(len * 4);
|
|
587
586
|
const result = new Float32Array(len);
|
|
588
587
|
for (let i = 0; i < len; i++)
|
|
589
|
-
result[i] =
|
|
588
|
+
result[i] = readF32(bc);
|
|
590
589
|
return result;
|
|
591
590
|
}
|
|
592
|
-
var
|
|
593
|
-
function
|
|
594
|
-
(0,
|
|
595
|
-
(
|
|
596
|
-
bc.write(new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
591
|
+
var writeF32FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? writeF32FixedArrayLE : writeF32FixedArrayBE;
|
|
592
|
+
function writeF32FixedArrayLE(bc, x) {
|
|
593
|
+
(0, import_assert3.ok)(!x.every(Number.isNaN), NAN_NOT_ALLOWED2);
|
|
594
|
+
writeU8FixedArray(bc, new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
597
595
|
}
|
|
598
|
-
function
|
|
599
|
-
(0, import_assert5.ok)(val.length === len);
|
|
596
|
+
function writeF32FixedArrayBE(bc, val) {
|
|
600
597
|
bc.reserve(val.length * 4);
|
|
601
598
|
for (let i = 0; i < val.length; i++)
|
|
602
|
-
|
|
599
|
+
writeF32(bc, val[i]);
|
|
603
600
|
}
|
|
604
|
-
function
|
|
605
|
-
return
|
|
601
|
+
function readF32Array(bc) {
|
|
602
|
+
return readF32FixedArray(bc, readUintSafe(bc));
|
|
606
603
|
}
|
|
607
|
-
function
|
|
608
|
-
|
|
604
|
+
function writeF32Array(bc, x) {
|
|
605
|
+
writeUintSafe(bc, x.length);
|
|
609
606
|
if (x.length !== 0) {
|
|
610
|
-
|
|
607
|
+
writeF32FixedArray(bc, x);
|
|
611
608
|
}
|
|
612
609
|
}
|
|
613
|
-
var
|
|
614
|
-
function
|
|
610
|
+
var readF64FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? readF64FixedArrayLE : readF64FixedArrayBE;
|
|
611
|
+
function readF64FixedArrayLE(bc, len) {
|
|
615
612
|
const byteLen = len * 8;
|
|
616
|
-
const result = new Float64Array(
|
|
613
|
+
const result = new Float64Array(readFixedData(bc, byteLen));
|
|
617
614
|
if (result.some(Number.isNaN)) {
|
|
618
615
|
throw new BareError(bc.offset, NAN_NOT_ALLOWED2);
|
|
619
616
|
}
|
|
620
617
|
return result;
|
|
621
618
|
}
|
|
622
|
-
function
|
|
619
|
+
function readF64FixedArrayBE(bc, len) {
|
|
623
620
|
bc.check(len * 8);
|
|
624
621
|
const result = new Float64Array(len);
|
|
625
622
|
for (let i = 0; i < len; i++)
|
|
626
|
-
result[i] =
|
|
623
|
+
result[i] = readF64(bc);
|
|
627
624
|
return result;
|
|
628
625
|
}
|
|
629
|
-
var
|
|
630
|
-
function
|
|
631
|
-
(0,
|
|
632
|
-
(
|
|
633
|
-
bc.write(new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
626
|
+
var writeF64FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? writeF64FixedArrayLE : writeF64FixedArrayBE;
|
|
627
|
+
function writeF64FixedArrayLE(bc, x) {
|
|
628
|
+
(0, import_assert3.ok)(!x.every(Number.isNaN), NAN_NOT_ALLOWED2);
|
|
629
|
+
writeU8FixedArray(bc, new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
634
630
|
}
|
|
635
|
-
function
|
|
636
|
-
(0, import_assert5.ok)(x.length === len);
|
|
631
|
+
function writeF64FixedArrayBE(bc, x) {
|
|
637
632
|
bc.reserve(x.length * 8);
|
|
638
633
|
for (let i = 0; i < x.length; i++)
|
|
639
|
-
|
|
634
|
+
writeF64(bc, x[i]);
|
|
640
635
|
}
|
|
641
|
-
function
|
|
642
|
-
return
|
|
636
|
+
function readF64Array(bc) {
|
|
637
|
+
return readF64FixedArray(bc, readUintSafe(bc));
|
|
643
638
|
}
|
|
644
|
-
function
|
|
645
|
-
|
|
639
|
+
function writeF64Array(bc, x) {
|
|
640
|
+
writeUintSafe(bc, x.length);
|
|
646
641
|
if (x.length !== 0) {
|
|
647
|
-
|
|
642
|
+
writeF64FixedArray(bc, x);
|
|
648
643
|
}
|
|
649
644
|
}
|
|
650
645
|
|
|
651
646
|
// src/codec/i16-array.ts
|
|
652
|
-
var import_assert6 = require("assert");
|
|
653
647
|
var I16_BYTE_COUNT = 2;
|
|
654
|
-
var
|
|
655
|
-
function
|
|
656
|
-
return
|
|
648
|
+
var readI16FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? readI16FixedArrayLE : readI16FixedArrayBE;
|
|
649
|
+
function readI16Array(bc) {
|
|
650
|
+
return readI16FixedArray(bc, readUintSafe(bc));
|
|
657
651
|
}
|
|
658
|
-
function
|
|
652
|
+
function readI16FixedArrayLE(bc, len) {
|
|
659
653
|
const byteCount = len * I16_BYTE_COUNT;
|
|
660
|
-
return new Int16Array(
|
|
654
|
+
return new Int16Array(readFixedData(bc, byteCount));
|
|
661
655
|
}
|
|
662
|
-
function
|
|
656
|
+
function readI16FixedArrayBE(bc, len) {
|
|
663
657
|
bc.check(len * I16_BYTE_COUNT);
|
|
664
658
|
const result = new Int16Array(len);
|
|
665
659
|
for (let i = 0; i < len; i++)
|
|
666
|
-
result[i] =
|
|
660
|
+
result[i] = readI16(bc);
|
|
667
661
|
return result;
|
|
668
662
|
}
|
|
669
|
-
var
|
|
670
|
-
function
|
|
671
|
-
|
|
663
|
+
var writeI16FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? writeI16FixedArrayLE : writeI16FixedArrayBE;
|
|
664
|
+
function writeI16Array(bc, x) {
|
|
665
|
+
writeUintSafe(bc, x.length);
|
|
672
666
|
if (x.length !== 0) {
|
|
673
|
-
|
|
667
|
+
writeI16FixedArray(bc, x);
|
|
674
668
|
}
|
|
675
669
|
}
|
|
676
|
-
function
|
|
677
|
-
(
|
|
678
|
-
bc.write(new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
670
|
+
function writeI16FixedArrayLE(bc, x) {
|
|
671
|
+
writeU8FixedArray(bc, new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
679
672
|
}
|
|
680
|
-
function
|
|
681
|
-
(0, import_assert6.ok)(x.length === len);
|
|
673
|
+
function writeI16FixedArrayBE(bc, x) {
|
|
682
674
|
bc.reserve(x.length * I16_BYTE_COUNT);
|
|
683
675
|
for (let i = 0; i < x.length; i++)
|
|
684
|
-
|
|
676
|
+
writeI16(bc, x[i]);
|
|
685
677
|
}
|
|
686
678
|
|
|
687
679
|
// src/codec/i32-array.ts
|
|
688
|
-
var import_assert7 = require("assert");
|
|
689
680
|
var I32_BYTE_COUNT = 4;
|
|
690
|
-
var
|
|
691
|
-
function
|
|
692
|
-
return
|
|
681
|
+
var readI32FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? readI32FixedArrayLE : readI32FixedArrayBE;
|
|
682
|
+
function readI32Array(bc) {
|
|
683
|
+
return readI32FixedArray(bc, readUintSafe(bc));
|
|
693
684
|
}
|
|
694
|
-
function
|
|
685
|
+
function readI32FixedArrayLE(bc, len) {
|
|
695
686
|
const byteCount = len * I32_BYTE_COUNT;
|
|
696
|
-
return new Int32Array(
|
|
687
|
+
return new Int32Array(readFixedData(bc, byteCount));
|
|
697
688
|
}
|
|
698
|
-
function
|
|
689
|
+
function readI32FixedArrayBE(bc, len) {
|
|
699
690
|
bc.check(len * I32_BYTE_COUNT);
|
|
700
691
|
const result = new Int32Array(len);
|
|
701
692
|
for (let i = 0; i < len; i++)
|
|
702
|
-
result[i] =
|
|
693
|
+
result[i] = readI32(bc);
|
|
703
694
|
return result;
|
|
704
695
|
}
|
|
705
|
-
var
|
|
706
|
-
function
|
|
707
|
-
|
|
696
|
+
var writeI32FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? writeI32FixedArrayLE : writeI32FixedArrayBE;
|
|
697
|
+
function writeI32Array(bc, x) {
|
|
698
|
+
writeUintSafe(bc, x.length);
|
|
708
699
|
if (x.length !== 0) {
|
|
709
|
-
|
|
700
|
+
writeI32FixedArray(bc, x);
|
|
710
701
|
}
|
|
711
702
|
}
|
|
712
|
-
function
|
|
713
|
-
(
|
|
714
|
-
bc.write(new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
703
|
+
function writeI32FixedArrayLE(bc, x) {
|
|
704
|
+
writeU8FixedArray(bc, new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
715
705
|
}
|
|
716
|
-
function
|
|
717
|
-
(0, import_assert7.ok)(x.length === len);
|
|
706
|
+
function writeI32FixedArrayBE(bc, x) {
|
|
718
707
|
bc.reserve(x.length * I32_BYTE_COUNT);
|
|
719
708
|
for (let i = 0; i < x.length; i++)
|
|
720
|
-
|
|
709
|
+
writeI32(bc, x[i]);
|
|
721
710
|
}
|
|
722
711
|
|
|
723
712
|
// src/codec/i64-array.ts
|
|
724
|
-
var import_assert8 = require("assert");
|
|
725
713
|
var I64_BYTE_COUNT = 8;
|
|
726
|
-
var
|
|
727
|
-
function
|
|
728
|
-
return
|
|
714
|
+
var readI64FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? readI64FixedArrayLE : readI64FixedArrayBE;
|
|
715
|
+
function readI64Array(bc) {
|
|
716
|
+
return readI64FixedArray(bc, readUintSafe(bc));
|
|
729
717
|
}
|
|
730
|
-
function
|
|
718
|
+
function readI64FixedArrayLE(bc, len) {
|
|
731
719
|
const byteCount = len * I64_BYTE_COUNT;
|
|
732
|
-
return new BigInt64Array(
|
|
720
|
+
return new BigInt64Array(readFixedData(bc, byteCount));
|
|
733
721
|
}
|
|
734
|
-
function
|
|
722
|
+
function readI64FixedArrayBE(bc, len) {
|
|
735
723
|
bc.check(len * I64_BYTE_COUNT);
|
|
736
724
|
const result = new BigInt64Array(len);
|
|
737
725
|
for (let i = 0; i < len; i++)
|
|
738
|
-
result[i] =
|
|
726
|
+
result[i] = readI64(bc);
|
|
739
727
|
return result;
|
|
740
728
|
}
|
|
741
|
-
var
|
|
742
|
-
function
|
|
743
|
-
|
|
729
|
+
var writeI64FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? writeI64FixedArrayLE : writeI64FixedArrayBE;
|
|
730
|
+
function writeI64Array(bc, x) {
|
|
731
|
+
writeUintSafe(bc, x.length);
|
|
744
732
|
if (x.length !== 0) {
|
|
745
|
-
|
|
733
|
+
writeI64FixedArray(bc, x);
|
|
746
734
|
}
|
|
747
735
|
}
|
|
748
|
-
function
|
|
749
|
-
(
|
|
750
|
-
bc.write(new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
736
|
+
function writeI64FixedArrayLE(bc, x) {
|
|
737
|
+
writeU8FixedArray(bc, new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
751
738
|
}
|
|
752
|
-
function
|
|
753
|
-
(0, import_assert8.ok)(x.length === len);
|
|
739
|
+
function writeI64FixedArrayBE(bc, x) {
|
|
754
740
|
bc.reserve(x.length * I64_BYTE_COUNT);
|
|
755
741
|
for (let i = 0; i < x.length; i++)
|
|
756
|
-
|
|
742
|
+
writeI64(bc, x[i]);
|
|
757
743
|
}
|
|
758
744
|
|
|
759
745
|
// src/codec/i8-array.ts
|
|
760
|
-
function
|
|
761
|
-
return
|
|
746
|
+
function readI8Array(bc) {
|
|
747
|
+
return readI8FixedArray(bc, readUintSafe(bc));
|
|
762
748
|
}
|
|
763
|
-
function
|
|
764
|
-
|
|
765
|
-
|
|
749
|
+
function writeI8Array(bc, x) {
|
|
750
|
+
writeUintSafe(bc, x.length);
|
|
751
|
+
writeI8FixedArray(bc, x);
|
|
766
752
|
}
|
|
767
|
-
function
|
|
768
|
-
return new Int8Array(
|
|
753
|
+
function readI8FixedArray(bc, len) {
|
|
754
|
+
return new Int8Array(readFixedData(bc, len));
|
|
769
755
|
}
|
|
770
|
-
function
|
|
771
|
-
|
|
756
|
+
function writeI8FixedArray(bc, x) {
|
|
757
|
+
writeU8FixedArray(bc, new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
772
758
|
}
|
|
773
759
|
|
|
774
760
|
// src/codec/string.ts
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
761
|
+
var INVALID_UTF8_STRING = "invalid UTF-8 string";
|
|
762
|
+
function readString(bc) {
|
|
763
|
+
return readFixedString(bc, readUintSafe(bc));
|
|
764
|
+
}
|
|
765
|
+
function writeString(bc, x) {
|
|
766
|
+
if (x.length < bc.config.textEncoderThreshold) {
|
|
767
|
+
const byteLen = utf8ByteLength(x);
|
|
768
|
+
writeUintSafe(bc, byteLen);
|
|
769
|
+
bc.reserve(byteLen);
|
|
770
|
+
writeUtf8Js(bc, x);
|
|
771
|
+
} else {
|
|
772
|
+
const strBytes = UTF8_ENCODER.encode(x);
|
|
773
|
+
writeUintSafe(bc, strBytes.length);
|
|
774
|
+
writeU8FixedArray(bc, strBytes);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
function readFixedString(bc, byteLen) {
|
|
778
|
+
if (byteLen < bc.config.textDecoderThreshold) {
|
|
779
|
+
return readUtf8Js(bc, byteLen);
|
|
780
|
+
}
|
|
778
781
|
try {
|
|
779
|
-
return
|
|
782
|
+
return UTF8_DECODER.decode(bc.read(byteLen));
|
|
780
783
|
} catch (cause) {
|
|
781
|
-
throw new BareError(bc.offset
|
|
782
|
-
cause
|
|
783
|
-
});
|
|
784
|
+
throw new BareError(bc.offset, INVALID_UTF8_STRING);
|
|
784
785
|
}
|
|
785
786
|
}
|
|
786
|
-
function
|
|
787
|
+
function writeFixedString(bc, x) {
|
|
787
788
|
if (x.length < bc.config.textEncoderThreshold) {
|
|
788
789
|
const byteLen = utf8ByteLength(x);
|
|
789
|
-
encodeUintSafe(bc, byteLen);
|
|
790
790
|
bc.reserve(byteLen);
|
|
791
|
-
|
|
791
|
+
writeUtf8Js(bc, x);
|
|
792
792
|
} else {
|
|
793
|
-
|
|
794
|
-
encodeUintSafe(bc, strBytes.length);
|
|
795
|
-
bc.write(strBytes);
|
|
793
|
+
writeU8FixedArray(bc, UTF8_ENCODER.encode(x));
|
|
796
794
|
}
|
|
797
795
|
}
|
|
798
|
-
function
|
|
799
|
-
|
|
796
|
+
function readUtf8Js(bc, byteLen) {
|
|
797
|
+
bc.check(byteLen);
|
|
800
798
|
let result = "";
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
i += 2;
|
|
825
|
-
break;
|
|
799
|
+
const bytes = bc.bytes;
|
|
800
|
+
let offset = bc.offset;
|
|
801
|
+
const upperOffset = offset + byteLen;
|
|
802
|
+
while (offset < upperOffset) {
|
|
803
|
+
let codePoint = bytes[offset++];
|
|
804
|
+
if (codePoint > 127) {
|
|
805
|
+
let malformed = true;
|
|
806
|
+
const byte1 = codePoint;
|
|
807
|
+
if (offset < upperOffset && codePoint < 224) {
|
|
808
|
+
const byte2 = bytes[offset++];
|
|
809
|
+
codePoint = (byte1 & 31) << 6 | byte2 & 63;
|
|
810
|
+
malformed = codePoint >> 7 === 0 || byte1 >> 5 !== 6 || byte2 >> 6 !== 2;
|
|
811
|
+
} else if (offset + 1 < upperOffset && codePoint < 240) {
|
|
812
|
+
const byte2 = bytes[offset++];
|
|
813
|
+
const byte3 = bytes[offset++];
|
|
814
|
+
codePoint = (byte1 & 15) << 12 | (byte2 & 63) << 6 | byte3 & 63;
|
|
815
|
+
malformed = codePoint >> 11 === 0 || codePoint >> 11 === 27 || byte1 >> 4 !== 14 || byte2 >> 6 !== 2 || byte3 >> 6 !== 2;
|
|
816
|
+
} else if (offset + 2 < upperOffset) {
|
|
817
|
+
const byte2 = bytes[offset++];
|
|
818
|
+
const byte3 = bytes[offset++];
|
|
819
|
+
const byte4 = bytes[offset++];
|
|
820
|
+
codePoint = (byte1 & 7) << 18 | (byte2 & 63) << 12 | (byte3 & 63) << 6 | byte4 & 63;
|
|
821
|
+
malformed = codePoint >> 16 === 0 || codePoint > 1114111 || byte1 >> 3 !== 30 || byte2 >> 6 !== 2 || byte3 >> 6 !== 2 || byte4 >> 6 !== 2;
|
|
826
822
|
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
codePoint = (codePoint & 7) << 18 | (bytes[i] & 63) << 12 | (bytes[i + 1] & 63) << 6 | bytes[i + 2] & 63;
|
|
830
|
-
}
|
|
831
|
-
if (codePoint >> 16 === 0 || codePoint > 1114111 || bytes[i] >> 6 !== 2 || bytes[i + 1] >> 6 !== 2 || bytes[i + 2] >> 6 !== 2) {
|
|
832
|
-
throw TypeError("Decoding failed");
|
|
833
|
-
}
|
|
834
|
-
i += 3;
|
|
835
|
-
break;
|
|
823
|
+
if (malformed) {
|
|
824
|
+
throw new BareError(bc.offset, INVALID_UTF8_STRING);
|
|
836
825
|
}
|
|
837
|
-
default:
|
|
838
|
-
throw TypeError("Decoding failed");
|
|
839
826
|
}
|
|
840
827
|
result += String.fromCodePoint(codePoint);
|
|
841
828
|
}
|
|
829
|
+
bc.offset = offset;
|
|
842
830
|
return result;
|
|
843
831
|
}
|
|
844
|
-
function
|
|
845
|
-
const
|
|
832
|
+
function writeUtf8Js(bc, s) {
|
|
833
|
+
const bytes = bc.bytes;
|
|
846
834
|
let offset = bc.offset;
|
|
847
|
-
const view = bc.view;
|
|
848
835
|
let i = 0;
|
|
849
|
-
while (i <
|
|
836
|
+
while (i < s.length) {
|
|
850
837
|
const codePoint = s.codePointAt(i++);
|
|
851
838
|
if (codePoint < 128) {
|
|
852
|
-
|
|
853
|
-
} else if (codePoint < 2048) {
|
|
854
|
-
view.setUint8(offset++, 192 | codePoint >> 6);
|
|
855
|
-
view.setUint8(offset++, 128 | codePoint & 63);
|
|
856
|
-
} else if (codePoint < 65536) {
|
|
857
|
-
view.setUint8(offset++, 224 | codePoint >> 12);
|
|
858
|
-
view.setUint8(offset++, 128 | codePoint >> 6 & 63);
|
|
859
|
-
view.setUint8(offset++, 128 | codePoint & 63);
|
|
839
|
+
bytes[offset++] = codePoint;
|
|
860
840
|
} else {
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
841
|
+
if (codePoint < 2048) {
|
|
842
|
+
bytes[offset++] = 192 | codePoint >> 6;
|
|
843
|
+
} else {
|
|
844
|
+
if (codePoint < 65536) {
|
|
845
|
+
bytes[offset++] = 224 | codePoint >> 12;
|
|
846
|
+
} else {
|
|
847
|
+
bytes[offset++] = 240 | codePoint >> 18;
|
|
848
|
+
bytes[offset++] = 128 | codePoint >> 12 & 63;
|
|
849
|
+
i++;
|
|
850
|
+
}
|
|
851
|
+
bytes[offset++] = 128 | codePoint >> 6 & 63;
|
|
852
|
+
}
|
|
853
|
+
bytes[offset++] = 128 | codePoint & 63;
|
|
866
854
|
}
|
|
867
855
|
}
|
|
868
856
|
bc.offset = offset;
|
|
869
857
|
}
|
|
870
858
|
function utf8ByteLength(s) {
|
|
871
|
-
|
|
872
|
-
let
|
|
873
|
-
for (let i = 0; i < sLen; i++) {
|
|
859
|
+
let result = s.length;
|
|
860
|
+
for (let i = 0; i < s.length; i++) {
|
|
874
861
|
const codePoint = s.codePointAt(i);
|
|
875
|
-
if (codePoint
|
|
862
|
+
if (codePoint > 127) {
|
|
876
863
|
result++;
|
|
877
|
-
if (codePoint
|
|
864
|
+
if (codePoint > 2047) {
|
|
878
865
|
result++;
|
|
879
|
-
if (codePoint
|
|
866
|
+
if (codePoint > 65535) {
|
|
880
867
|
i++;
|
|
881
868
|
}
|
|
882
869
|
}
|
|
@@ -888,126 +875,117 @@ var UTF8_DECODER = new TextDecoder("utf-8", { fatal: true });
|
|
|
888
875
|
var UTF8_ENCODER = new TextEncoder();
|
|
889
876
|
|
|
890
877
|
// src/codec/u16-array.ts
|
|
891
|
-
var import_assert9 = require("assert");
|
|
892
878
|
var U16_BYTE_COUNT = 2;
|
|
893
|
-
var
|
|
894
|
-
function
|
|
895
|
-
return
|
|
879
|
+
var readU16FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? readU16FixedArrayLE : readU16FixedArrayBE;
|
|
880
|
+
function readU16Array(bc) {
|
|
881
|
+
return readU16FixedArray(bc, readUintSafe(bc));
|
|
896
882
|
}
|
|
897
|
-
function
|
|
883
|
+
function readU16FixedArrayLE(bc, len) {
|
|
898
884
|
const byteCount = len * U16_BYTE_COUNT;
|
|
899
|
-
return new Uint16Array(
|
|
885
|
+
return new Uint16Array(readFixedData(bc, byteCount));
|
|
900
886
|
}
|
|
901
|
-
function
|
|
887
|
+
function readU16FixedArrayBE(bc, len) {
|
|
902
888
|
bc.check(len * U16_BYTE_COUNT);
|
|
903
889
|
const result = new Uint16Array(len);
|
|
904
890
|
for (let i = 0; i < len; i++)
|
|
905
|
-
result[i] =
|
|
891
|
+
result[i] = readU16(bc);
|
|
906
892
|
return result;
|
|
907
893
|
}
|
|
908
|
-
var
|
|
909
|
-
function
|
|
910
|
-
|
|
894
|
+
var writeU16FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? writeU16FixedArrayLE : writeU16FixedArrayBE;
|
|
895
|
+
function writeU16Array(bc, x) {
|
|
896
|
+
writeUintSafe(bc, x.length);
|
|
911
897
|
if (x.length !== 0) {
|
|
912
|
-
|
|
898
|
+
writeU16FixedArray(bc, x);
|
|
913
899
|
}
|
|
914
900
|
}
|
|
915
|
-
function
|
|
916
|
-
(
|
|
917
|
-
bc.write(new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
901
|
+
function writeU16FixedArrayLE(bc, x) {
|
|
902
|
+
writeU8FixedArray(bc, new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
918
903
|
}
|
|
919
|
-
function
|
|
920
|
-
(0, import_assert9.ok)(x.length === len);
|
|
904
|
+
function writeU16FixedArrayBE(bc, x) {
|
|
921
905
|
bc.reserve(x.length * U16_BYTE_COUNT);
|
|
922
906
|
for (let i = 0; i < x.length; i++)
|
|
923
|
-
|
|
907
|
+
writeU16(bc, x[i]);
|
|
924
908
|
}
|
|
925
909
|
|
|
926
910
|
// src/codec/u32-array.ts
|
|
927
|
-
var import_assert10 = require("assert");
|
|
928
911
|
var U32_BYTE_COUNT = 4;
|
|
929
|
-
var
|
|
930
|
-
function
|
|
931
|
-
return
|
|
912
|
+
var readU32FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? readU32FixedArrayLE : readU32FixedArrayBE;
|
|
913
|
+
function readU32Array(bc) {
|
|
914
|
+
return readU32FixedArray(bc, readUintSafe(bc));
|
|
932
915
|
}
|
|
933
|
-
function
|
|
916
|
+
function readU32FixedArrayLE(bc, len) {
|
|
934
917
|
const byteCount = len * U32_BYTE_COUNT;
|
|
935
|
-
return new Uint32Array(
|
|
918
|
+
return new Uint32Array(readFixedData(bc, byteCount));
|
|
936
919
|
}
|
|
937
|
-
function
|
|
920
|
+
function readU32FixedArrayBE(bc, len) {
|
|
938
921
|
bc.check(len * U32_BYTE_COUNT);
|
|
939
922
|
const result = new Uint32Array(len);
|
|
940
923
|
for (let i = 0; i < len; i++)
|
|
941
|
-
result[i] =
|
|
924
|
+
result[i] = readU32(bc);
|
|
942
925
|
return result;
|
|
943
926
|
}
|
|
944
|
-
var
|
|
945
|
-
function
|
|
946
|
-
|
|
927
|
+
var writeU32FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? writeU32FixedArrayLE : writeU32FixedArrayBE;
|
|
928
|
+
function writeU32Array(bc, x) {
|
|
929
|
+
writeUintSafe(bc, x.length);
|
|
947
930
|
if (x.length !== 0) {
|
|
948
|
-
|
|
931
|
+
writeU32FixedArray(bc, x);
|
|
949
932
|
}
|
|
950
933
|
}
|
|
951
|
-
function
|
|
952
|
-
(
|
|
953
|
-
bc.write(new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
934
|
+
function writeU32FixedArrayLE(bc, x) {
|
|
935
|
+
writeU8FixedArray(bc, new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
954
936
|
}
|
|
955
|
-
function
|
|
956
|
-
(0, import_assert10.ok)(x.length === len);
|
|
937
|
+
function writeU32FixedArrayBE(bc, x) {
|
|
957
938
|
bc.reserve(x.length * U32_BYTE_COUNT);
|
|
958
939
|
for (let i = 0; i < x.length; i++)
|
|
959
|
-
|
|
940
|
+
writeU32(bc, x[i]);
|
|
960
941
|
}
|
|
961
942
|
|
|
962
943
|
// src/codec/u64-array.ts
|
|
963
|
-
var import_assert11 = require("assert");
|
|
964
944
|
var U64_BYTE_COUNT = 8;
|
|
965
|
-
var
|
|
966
|
-
function
|
|
967
|
-
return
|
|
945
|
+
var readU64FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? readU64FixedArrayLE : readU64FixedArrayBE;
|
|
946
|
+
function readU64Array(bc) {
|
|
947
|
+
return readU64FixedArray(bc, readUintSafe(bc));
|
|
968
948
|
}
|
|
969
|
-
function
|
|
949
|
+
function readU64FixedArrayLE(bc, len) {
|
|
970
950
|
const byteCount = len * U64_BYTE_COUNT;
|
|
971
|
-
return new BigUint64Array(
|
|
951
|
+
return new BigUint64Array(readFixedData(bc, byteCount));
|
|
972
952
|
}
|
|
973
|
-
function
|
|
953
|
+
function readU64FixedArrayBE(bc, len) {
|
|
974
954
|
bc.check(len * U64_BYTE_COUNT);
|
|
975
955
|
const result = new BigUint64Array(len);
|
|
976
956
|
for (let i = 0; i < len; i++)
|
|
977
|
-
result[i] =
|
|
957
|
+
result[i] = readU64(bc);
|
|
978
958
|
return result;
|
|
979
959
|
}
|
|
980
|
-
var
|
|
981
|
-
function
|
|
982
|
-
|
|
960
|
+
var writeU64FixedArray = IS_LITTLE_ENDIAN_PLATFORM ? writeU64FixedArrayLE : writeU64FixedArrayBE;
|
|
961
|
+
function writeU64Array(bc, x) {
|
|
962
|
+
writeUintSafe(bc, x.length);
|
|
983
963
|
if (x.length !== 0) {
|
|
984
|
-
|
|
964
|
+
writeU64FixedArray(bc, x);
|
|
985
965
|
}
|
|
986
966
|
}
|
|
987
|
-
function
|
|
988
|
-
(
|
|
989
|
-
bc.write(new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
967
|
+
function writeU64FixedArrayLE(bc, x) {
|
|
968
|
+
writeU8FixedArray(bc, new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
990
969
|
}
|
|
991
|
-
function
|
|
992
|
-
(0, import_assert11.ok)(x.length === len);
|
|
970
|
+
function writeU64FixedArrayBE(bc, x) {
|
|
993
971
|
bc.reserve(x.length * U64_BYTE_COUNT);
|
|
994
972
|
for (let i = 0; i < x.length; i++)
|
|
995
|
-
|
|
973
|
+
writeU64(bc, x[i]);
|
|
996
974
|
}
|
|
997
975
|
|
|
998
976
|
// src/codec/u8-clamped-array.ts
|
|
999
|
-
function
|
|
1000
|
-
return
|
|
977
|
+
function readU8ClampedArray(bc) {
|
|
978
|
+
return readU8ClampedFixedArray(bc, readUintSafe(bc));
|
|
1001
979
|
}
|
|
1002
|
-
function
|
|
1003
|
-
|
|
1004
|
-
|
|
980
|
+
function writeU8ClampedArray(bc, x) {
|
|
981
|
+
writeUintSafe(bc, x.length);
|
|
982
|
+
writeU8ClampedFixedArray(bc, x);
|
|
1005
983
|
}
|
|
1006
|
-
function
|
|
1007
|
-
return new Uint8ClampedArray(
|
|
984
|
+
function readU8ClampedFixedArray(bc, len) {
|
|
985
|
+
return new Uint8ClampedArray(readFixedData(bc, len));
|
|
1008
986
|
}
|
|
1009
|
-
function
|
|
1010
|
-
|
|
987
|
+
function writeU8ClampedFixedArray(bc, x) {
|
|
988
|
+
writeU8FixedArray(bc, new Uint8Array(x.buffer, x.byteOffset, x.byteLength));
|
|
1011
989
|
}
|
|
1012
990
|
module.exports = __toCommonJS(src_exports);
|
|
1013
991
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1015,90 +993,92 @@ module.exports = __toCommonJS(src_exports);
|
|
|
1015
993
|
BareError,
|
|
1016
994
|
ByteCursor,
|
|
1017
995
|
Config,
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
996
|
+
readBool,
|
|
997
|
+
readData,
|
|
998
|
+
readF32,
|
|
999
|
+
readF32Array,
|
|
1000
|
+
readF32FixedArray,
|
|
1001
|
+
readF64,
|
|
1002
|
+
readF64Array,
|
|
1003
|
+
readF64FixedArray,
|
|
1004
|
+
readFixedData,
|
|
1005
|
+
readFixedString,
|
|
1006
|
+
readI16,
|
|
1007
|
+
readI16Array,
|
|
1008
|
+
readI16FixedArray,
|
|
1009
|
+
readI32,
|
|
1010
|
+
readI32Array,
|
|
1011
|
+
readI32FixedArray,
|
|
1012
|
+
readI64,
|
|
1013
|
+
readI64Array,
|
|
1014
|
+
readI64FixedArray,
|
|
1015
|
+
readI64Safe,
|
|
1016
|
+
readI8,
|
|
1017
|
+
readI8Array,
|
|
1018
|
+
readI8FixedArray,
|
|
1019
|
+
readInt,
|
|
1020
|
+
readIntSafe,
|
|
1021
|
+
readString,
|
|
1022
|
+
readU16,
|
|
1023
|
+
readU16Array,
|
|
1024
|
+
readU16FixedArray,
|
|
1025
|
+
readU32,
|
|
1026
|
+
readU32Array,
|
|
1027
|
+
readU32FixedArray,
|
|
1028
|
+
readU64,
|
|
1029
|
+
readU64Array,
|
|
1030
|
+
readU64FixedArray,
|
|
1031
|
+
readU64Safe,
|
|
1032
|
+
readU8,
|
|
1033
|
+
readU8Array,
|
|
1034
|
+
readU8ClampedArray,
|
|
1035
|
+
readU8ClampedFixedArray,
|
|
1036
|
+
readU8FixedArray,
|
|
1037
|
+
readUint,
|
|
1038
|
+
readUintSafe,
|
|
1039
|
+
readVoid,
|
|
1040
|
+
writeBool,
|
|
1041
|
+
writeData,
|
|
1042
|
+
writeF32,
|
|
1043
|
+
writeF32Array,
|
|
1044
|
+
writeF32FixedArray,
|
|
1045
|
+
writeF64,
|
|
1046
|
+
writeF64Array,
|
|
1047
|
+
writeF64FixedArray,
|
|
1048
|
+
writeFixedData,
|
|
1049
|
+
writeFixedString,
|
|
1050
|
+
writeI16,
|
|
1051
|
+
writeI16Array,
|
|
1052
|
+
writeI16FixedArray,
|
|
1053
|
+
writeI32,
|
|
1054
|
+
writeI32Array,
|
|
1055
|
+
writeI32FixedArray,
|
|
1056
|
+
writeI64,
|
|
1057
|
+
writeI64Array,
|
|
1058
|
+
writeI64FixedArray,
|
|
1059
|
+
writeI64Safe,
|
|
1060
|
+
writeI8,
|
|
1061
|
+
writeI8Array,
|
|
1062
|
+
writeI8FixedArray,
|
|
1063
|
+
writeInt,
|
|
1064
|
+
writeIntSafe,
|
|
1065
|
+
writeString,
|
|
1066
|
+
writeU16,
|
|
1067
|
+
writeU16Array,
|
|
1068
|
+
writeU16FixedArray,
|
|
1069
|
+
writeU32,
|
|
1070
|
+
writeU32Array,
|
|
1071
|
+
writeU32FixedArray,
|
|
1072
|
+
writeU64,
|
|
1073
|
+
writeU64Array,
|
|
1074
|
+
writeU64FixedArray,
|
|
1075
|
+
writeU64Safe,
|
|
1076
|
+
writeU8,
|
|
1077
|
+
writeU8Array,
|
|
1078
|
+
writeU8ClampedArray,
|
|
1079
|
+
writeU8ClampedFixedArray,
|
|
1080
|
+
writeU8FixedArray,
|
|
1081
|
+
writeUint,
|
|
1082
|
+
writeUintSafe,
|
|
1083
|
+
writeVoid
|
|
1104
1084
|
});
|