@peerbit/riblt 1.1.0-e209d2e → 1.2.0-10dfe9b
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.
|
Binary file
|
package/dist/rateless_iblt.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export class EncoderWrapper {
|
|
|
15
15
|
free(): void;
|
|
16
16
|
add_symbol(symbol: bigint): void;
|
|
17
17
|
to_decoder(): DecoderWrapper;
|
|
18
|
+
add_symbols(symbols: BigUint64Array): void;
|
|
18
19
|
produce_next_coded_symbol(): any;
|
|
19
20
|
constructor();
|
|
20
21
|
clone(): EncoderWrapper;
|
|
@@ -36,6 +37,7 @@ export interface InitOutput {
|
|
|
36
37
|
readonly decoderwrapper_reset: (a: number) => void;
|
|
37
38
|
readonly decoderwrapper_try_decode: (a: number) => [number, number];
|
|
38
39
|
readonly encoderwrapper_add_symbol: (a: number, b: bigint) => void;
|
|
40
|
+
readonly encoderwrapper_add_symbols: (a: number, b: number, c: number) => void;
|
|
39
41
|
readonly encoderwrapper_clone: (a: number) => number;
|
|
40
42
|
readonly encoderwrapper_new: () => number;
|
|
41
43
|
readonly encoderwrapper_produce_next_coded_symbol: (a: number) => any;
|
package/dist/rateless_iblt.js
CHANGED
|
@@ -185,6 +185,22 @@ function takeFromExternrefTable0(idx) {
|
|
|
185
185
|
return value;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
+
let cachedBigUint64ArrayMemory0 = null;
|
|
189
|
+
|
|
190
|
+
function getBigUint64ArrayMemory0() {
|
|
191
|
+
if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
|
|
192
|
+
cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
|
|
193
|
+
}
|
|
194
|
+
return cachedBigUint64ArrayMemory0;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function passArray64ToWasm0(arg, malloc) {
|
|
198
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
199
|
+
getBigUint64ArrayMemory0().set(arg, ptr / 8);
|
|
200
|
+
WASM_VECTOR_LEN = arg.length;
|
|
201
|
+
return ptr;
|
|
202
|
+
}
|
|
203
|
+
|
|
188
204
|
const DecoderWrapperFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
189
205
|
? { register: () => {}, unregister: () => {} }
|
|
190
206
|
: new FinalizationRegistry(ptr => wasm.__wbg_decoderwrapper_free(ptr >>> 0, 1));
|
|
@@ -298,6 +314,14 @@ export class EncoderWrapper {
|
|
|
298
314
|
const ret = wasm.encoderwrapper_to_decoder(this.__wbg_ptr);
|
|
299
315
|
return DecoderWrapper.__wrap(ret);
|
|
300
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* @param {BigUint64Array} symbols
|
|
319
|
+
*/
|
|
320
|
+
add_symbols(symbols) {
|
|
321
|
+
const ptr0 = passArray64ToWasm0(symbols, wasm.__wbindgen_malloc);
|
|
322
|
+
const len0 = WASM_VECTOR_LEN;
|
|
323
|
+
wasm.encoderwrapper_add_symbols(this.__wbg_ptr, ptr0, len0);
|
|
324
|
+
}
|
|
301
325
|
/**
|
|
302
326
|
* @returns {any}
|
|
303
327
|
*/
|
|
@@ -437,6 +461,7 @@ function __wbg_init_memory(imports, memory) {
|
|
|
437
461
|
function __wbg_finalize_init(instance, module) {
|
|
438
462
|
wasm = instance.exports;
|
|
439
463
|
__wbg_init.__wbindgen_wasm_module = module;
|
|
464
|
+
cachedBigUint64ArrayMemory0 = null;
|
|
440
465
|
cachedDataViewMemory0 = null;
|
|
441
466
|
cachedUint8ArrayMemory0 = null;
|
|
442
467
|
|
|
Binary file
|
|
@@ -12,6 +12,7 @@ export const decoderwrapper_new: () => number;
|
|
|
12
12
|
export const decoderwrapper_reset: (a: number) => void;
|
|
13
13
|
export const decoderwrapper_try_decode: (a: number) => [number, number];
|
|
14
14
|
export const encoderwrapper_add_symbol: (a: number, b: bigint) => void;
|
|
15
|
+
export const encoderwrapper_add_symbols: (a: number, b: number, c: number) => void;
|
|
15
16
|
export const encoderwrapper_clone: (a: number) => number;
|
|
16
17
|
export const encoderwrapper_new: () => number;
|
|
17
18
|
export const encoderwrapper_produce_next_coded_symbol: (a: number) => any;
|
package/package.json
CHANGED
package/src/wasm.rs
CHANGED
|
@@ -55,6 +55,12 @@ impl EncoderWrapper {
|
|
|
55
55
|
self.encoder.add_symbol(&my_symbol);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
pub fn add_symbols(&mut self, symbols: Vec<u64>) {
|
|
59
|
+
for symbol in symbols.iter() {
|
|
60
|
+
self.encoder.add_symbol(symbol);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
58
64
|
pub fn produce_next_coded_symbol(&mut self) -> JsValue {
|
|
59
65
|
let coded_symbol = self.encoder.produce_next_coded_symbol();
|
|
60
66
|
let symbol_u64 = coded_symbol.symbol;
|