zeck 0.2.0 → 1.0.7
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/README.md +9 -5
- package/package.json +2 -2
- package/zeck.d.ts +52 -32
- package/zeck_bg.js +56 -36
- package/zeck_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@ A Rust library for compressing and decompressing data using the Zeckendorf repre
|
|
|
6
6
|
|
|
7
7
|
The Zeckendorf algorithm represents numbers as a sum of non-consecutive Fibonacci numbers. This library interprets input data as a big integer (either big-endian or little-endian), converts it to its Zeckendorf representation, and sometimes achieves compression. However, compression is not guaranteed; the algorithm may result in a larger representation depending on the input data. The library can automatically try both endian interpretations and select the one that produces the best compression.
|
|
8
8
|
|
|
9
|
+
**⚠️ Warning:** Compressing or decompressing files larger than 10KB (10,000 bytes) is unstable due to time and memory pressure. The library may experience performance issues, excessive memory usage, or failures when processing files exceeding this size.
|
|
10
|
+
|
|
9
11
|
**Command-line tools** (`zeck-compress` and `zeck-decompress`) are available and can be installed via `cargo install zeck`. See the [Binaries](#binaries) section for usage details.
|
|
10
12
|
|
|
11
13
|
## Features
|
|
@@ -192,6 +194,8 @@ After installation, you can use `zeck-compress` and `zeck-decompress` directly f
|
|
|
192
194
|
|
|
193
195
|
### Compression/Decompression Tools
|
|
194
196
|
|
|
197
|
+
**⚠️ Warning:** Compressing or decompressing files larger than 10KB (10,000 bytes) is unstable due to time and memory pressure. The library may experience performance issues, excessive memory usage, or failures when processing files exceeding this size.
|
|
198
|
+
|
|
195
199
|
#### zeck-compress
|
|
196
200
|
|
|
197
201
|
Compresses data using the Zeckendorf representation algorithm. Automatically adds `.zbe` extension for big-endian compression and `.zle` extension for little-endian compression.
|
|
@@ -301,20 +305,20 @@ A playground/scratchpad for testing library functions.
|
|
|
301
305
|
### Generate Test Data
|
|
302
306
|
|
|
303
307
|
```bash
|
|
304
|
-
cargo run --release --bin
|
|
308
|
+
cargo run --release --bin zeck-generate-data --features development_tools -- <size_in_bytes> [filename]
|
|
305
309
|
```
|
|
306
310
|
|
|
307
311
|
Generates random test data files in the `generated_data/` directory.
|
|
308
312
|
|
|
309
313
|
Example:
|
|
310
314
|
```bash
|
|
311
|
-
cargo run --release --bin
|
|
315
|
+
cargo run --release --bin zeck-generate-data --features development_tools -- 1024 my_file.bin
|
|
312
316
|
```
|
|
313
317
|
|
|
314
318
|
### Generate Statistics
|
|
315
319
|
|
|
316
320
|
```bash
|
|
317
|
-
cargo run --release --bin
|
|
321
|
+
cargo run --release --bin zeck-generate-statistics --features plotting,development_tools
|
|
318
322
|
```
|
|
319
323
|
|
|
320
324
|
Generates comprehensive compression statistics and plots:
|
|
@@ -327,7 +331,7 @@ Generates comprehensive compression statistics and plots:
|
|
|
327
331
|
### Plot Compression Ratios
|
|
328
332
|
|
|
329
333
|
```bash
|
|
330
|
-
cargo run --release --bin plot --features plotting
|
|
334
|
+
cargo run --release --bin zeck-plot --features plotting,development_tools
|
|
331
335
|
```
|
|
332
336
|
|
|
333
337
|
Generates visualization plots of:
|
|
@@ -402,7 +406,7 @@ This avoids redundant Fibonacci numbers (F(0)=0 and F(1)=F(2)=1).
|
|
|
402
406
|
- Compression is not guaranteed—some inputs may result in larger output
|
|
403
407
|
- Compression effectiveness decreases as input size increases
|
|
404
408
|
- The library supports both big-endian and little-endian interpretations, but other byte orderings or word boundaries are not currently explored
|
|
405
|
-
-
|
|
409
|
+
- **⚠️ Warning:** Compressing or decompressing files larger than 10KB (10,000 bytes) is unstable due to time and memory pressure. The library may experience performance issues, excessive memory usage, or failures when processing files exceeding this size.
|
|
406
410
|
|
|
407
411
|
## License
|
|
408
412
|
|
package/package.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"Peter Ryszkiewicz"
|
|
6
6
|
],
|
|
7
7
|
"description": "A Rust library for compressing and decompressing data using the Zeckendorf representation algorithm",
|
|
8
|
-
"version": "0.
|
|
8
|
+
"version": "1.0.7",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/pRizz/zeckendorf"
|
|
12
|
+
"url": "https://github.com/pRizz/zeckendorf.git"
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"zeck_bg.wasm",
|
package/zeck.d.ts
CHANGED
|
@@ -255,76 +255,96 @@ export function unpack_bytes_to_ezba_bits(bytes: Uint8Array): Uint8Array;
|
|
|
255
255
|
*
|
|
256
256
|
* Assumes the input data is interpreted as a big endian integer. The output data is in little endian order, so the first bit and byte is the least significant bit and byte and the last bit and byte is the most significant bit and byte.
|
|
257
257
|
*
|
|
258
|
+
* # ⚠️ Warning
|
|
259
|
+
*
|
|
260
|
+
* **Compressing or decompressing data larger than 10KB (10,000 bytes) is unstable due to time and memory pressure.**
|
|
261
|
+
* The library may experience performance issues, excessive memory usage, or failures when processing data exceeding this size.
|
|
262
|
+
*
|
|
258
263
|
* TODO: Technically, the way the input data is interpreted is arbitrary; we could interpret it as little endian which could result in a more compact representation. We could go even further and interpret the data at different byte or word boundaries to see if it results in a more compact representation, and signify to the caller which interpretation was used. We probably need a better understanding of random distributions of data to determine what is the optimal interpretation. More investigation is needed here.
|
|
259
264
|
*
|
|
260
265
|
* # Examples
|
|
261
266
|
*
|
|
262
267
|
* ```
|
|
263
|
-
* # use zeck::
|
|
264
|
-
* assert_eq!(
|
|
265
|
-
* assert_eq!(
|
|
266
|
-
* assert_eq!(
|
|
267
|
-
* assert_eq!(
|
|
268
|
-
* assert_eq!(
|
|
269
|
-
* assert_eq!(
|
|
270
|
-
* assert_eq!(
|
|
268
|
+
* # use zeck::zeckendorf_compress_be_broken_do_not_use;
|
|
269
|
+
* assert_eq!(zeckendorf_compress_be_broken_do_not_use(&[0]), vec![0]);
|
|
270
|
+
* assert_eq!(zeckendorf_compress_be_broken_do_not_use(&[1]), vec![1]);
|
|
271
|
+
* assert_eq!(zeckendorf_compress_be_broken_do_not_use(&[12]), vec![0b111]);
|
|
272
|
+
* assert_eq!(zeckendorf_compress_be_broken_do_not_use(&[54]), vec![30]);
|
|
273
|
+
* assert_eq!(zeckendorf_compress_be_broken_do_not_use(&[55]), vec![0, 1]); // 55 is the 10 indexed Fibonacci number, which is the 8 indexed effective Fibonacci number, and therefore is the first number needing two bytes to contain these 8 bits, because there is 1 "use bit" and 7 "skip bits" in the effective zeckendorf bits ascending.
|
|
274
|
+
* assert_eq!(zeckendorf_compress_be_broken_do_not_use(&[255]), vec![33, 2]);
|
|
275
|
+
* assert_eq!(zeckendorf_compress_be_broken_do_not_use(&[1, 0]), vec![34, 2]);
|
|
271
276
|
* ```
|
|
272
277
|
*/
|
|
273
|
-
export function
|
|
278
|
+
export function zeckendorf_compress_be_broken_do_not_use(data: Uint8Array): Uint8Array;
|
|
274
279
|
|
|
275
280
|
/**
|
|
276
281
|
* Compresses a slice of bytes using the Zeckendorf algorithm.
|
|
277
282
|
*
|
|
278
283
|
* Assumes the input data is interpreted as a little endian integer. The output data is in little endian order, so the first bit and byte is the least significant bit and byte and the last bit and byte is the most significant bit and byte.
|
|
279
284
|
*
|
|
285
|
+
* # ⚠️ Warning
|
|
286
|
+
*
|
|
287
|
+
* **Compressing or decompressing data larger than 10KB (10,000 bytes) is unstable due to time and memory pressure.**
|
|
288
|
+
* The library may experience performance issues, excessive memory usage, or failures when processing data exceeding this size.
|
|
289
|
+
*
|
|
280
290
|
* # Examples
|
|
281
291
|
*
|
|
282
292
|
* ```
|
|
283
|
-
* # use zeck::
|
|
284
|
-
* assert_eq!(
|
|
285
|
-
* assert_eq!(
|
|
286
|
-
* assert_eq!(
|
|
287
|
-
* assert_eq!(
|
|
288
|
-
* assert_eq!(
|
|
289
|
-
* assert_eq!(
|
|
290
|
-
* assert_eq!(
|
|
293
|
+
* # use zeck::zeckendorf_compress_le_broken_do_not_use;
|
|
294
|
+
* assert_eq!(zeckendorf_compress_le_broken_do_not_use(&[0]), vec![0]);
|
|
295
|
+
* assert_eq!(zeckendorf_compress_le_broken_do_not_use(&[1]), vec![1]);
|
|
296
|
+
* assert_eq!(zeckendorf_compress_le_broken_do_not_use(&[12]), vec![0b111]);
|
|
297
|
+
* assert_eq!(zeckendorf_compress_le_broken_do_not_use(&[54]), vec![30]);
|
|
298
|
+
* assert_eq!(zeckendorf_compress_le_broken_do_not_use(&[55]), vec![0, 1]); // 55 is the 10 indexed Fibonacci number, which is the 8 indexed effective Fibonacci number, and therefore is the first number needing two bytes to contain these 8 bits, because there is 1 "use bit" and 7 "skip bits" in the effective zeckendorf bits ascending.
|
|
299
|
+
* assert_eq!(zeckendorf_compress_le_broken_do_not_use(&[255]), vec![33, 2]);
|
|
300
|
+
* assert_eq!(zeckendorf_compress_le_broken_do_not_use(&[0, 1]), vec![34, 2]);
|
|
291
301
|
* ```
|
|
292
302
|
*/
|
|
293
|
-
export function
|
|
303
|
+
export function zeckendorf_compress_le_broken_do_not_use(data: Uint8Array): Uint8Array;
|
|
294
304
|
|
|
295
305
|
/**
|
|
296
306
|
* Decompresses a slice of bytes compressed using the Zeckendorf algorithm, assuming the original data was compressed using the big endian bytes interpretation.
|
|
297
307
|
*
|
|
298
308
|
* Assume the original input data was interpreted as a big endian integer, for now. See the TODO in the [`zeckendorf_compress_be`] function for more information.
|
|
299
309
|
*
|
|
310
|
+
* # ⚠️ Warning
|
|
311
|
+
*
|
|
312
|
+
* **Compressing or decompressing data larger than 10KB (10,000 bytes) is unstable due to time and memory pressure.**
|
|
313
|
+
* The library may experience performance issues, excessive memory usage, or failures when processing data exceeding this size.
|
|
314
|
+
*
|
|
300
315
|
* # Examples
|
|
301
316
|
*
|
|
302
317
|
* ```
|
|
303
|
-
* # use zeck::
|
|
304
|
-
* assert_eq!(
|
|
305
|
-
* assert_eq!(
|
|
306
|
-
* assert_eq!(
|
|
307
|
-
* assert_eq!(
|
|
308
|
-
* assert_eq!(
|
|
318
|
+
* # use zeck::zeckendorf_decompress_be_broken_do_not_use;
|
|
319
|
+
* assert_eq!(zeckendorf_decompress_be_broken_do_not_use(&[0]), vec![0]);
|
|
320
|
+
* assert_eq!(zeckendorf_decompress_be_broken_do_not_use(&[1]), vec![1]);
|
|
321
|
+
* assert_eq!(zeckendorf_decompress_be_broken_do_not_use(&[0b111]), vec![12]);
|
|
322
|
+
* assert_eq!(zeckendorf_decompress_be_broken_do_not_use(&[33, 2]), vec![255]);
|
|
323
|
+
* assert_eq!(zeckendorf_decompress_be_broken_do_not_use(&[34, 2]), vec![1, 0]);
|
|
309
324
|
* ```
|
|
310
325
|
*/
|
|
311
|
-
export function
|
|
326
|
+
export function zeckendorf_decompress_be_broken_do_not_use(compressed_data: Uint8Array): Uint8Array;
|
|
312
327
|
|
|
313
328
|
/**
|
|
314
329
|
* Decompresses a slice of bytes compressed using the Zeckendorf algorithm, assuming the original data was compressed using the little endian bytes interpretation.
|
|
315
330
|
*
|
|
331
|
+
* # ⚠️ Warning
|
|
332
|
+
*
|
|
333
|
+
* **Compressing or decompressing data larger than 10KB (10,000 bytes) is unstable due to time and memory pressure.**
|
|
334
|
+
* The library may experience performance issues, excessive memory usage, or failures when processing data exceeding this size.
|
|
335
|
+
*
|
|
316
336
|
* # Examples
|
|
317
337
|
*
|
|
318
338
|
* ```
|
|
319
|
-
* # use zeck::
|
|
320
|
-
* assert_eq!(
|
|
321
|
-
* assert_eq!(
|
|
322
|
-
* assert_eq!(
|
|
323
|
-
* assert_eq!(
|
|
324
|
-
* assert_eq!(
|
|
339
|
+
* # use zeck::zeckendorf_decompress_le_broken_do_not_use;
|
|
340
|
+
* assert_eq!(zeckendorf_decompress_le_broken_do_not_use(&[0]), vec![0]);
|
|
341
|
+
* assert_eq!(zeckendorf_decompress_le_broken_do_not_use(&[1]), vec![1]);
|
|
342
|
+
* assert_eq!(zeckendorf_decompress_le_broken_do_not_use(&[0b111]), vec![12]);
|
|
343
|
+
* assert_eq!(zeckendorf_decompress_le_broken_do_not_use(&[33, 2]), vec![255]);
|
|
344
|
+
* assert_eq!(zeckendorf_decompress_le_broken_do_not_use(&[34, 2]), vec![0, 1]);
|
|
325
345
|
* ```
|
|
326
346
|
*/
|
|
327
|
-
export function
|
|
347
|
+
export function zeckendorf_decompress_le_broken_do_not_use(compressed_data: Uint8Array): Uint8Array;
|
|
328
348
|
|
|
329
349
|
/**
|
|
330
350
|
* An Effective Zeckendorf List (EZL) has a lowest EFI of 0, which is an FI of 2.
|
package/zeck_bg.js
CHANGED
|
@@ -381,27 +381,32 @@ export function unpack_bytes_to_ezba_bits(bytes) {
|
|
|
381
381
|
*
|
|
382
382
|
* Assumes the input data is interpreted as a big endian integer. The output data is in little endian order, so the first bit and byte is the least significant bit and byte and the last bit and byte is the most significant bit and byte.
|
|
383
383
|
*
|
|
384
|
+
* # ⚠️ Warning
|
|
385
|
+
*
|
|
386
|
+
* **Compressing or decompressing data larger than 10KB (10,000 bytes) is unstable due to time and memory pressure.**
|
|
387
|
+
* The library may experience performance issues, excessive memory usage, or failures when processing data exceeding this size.
|
|
388
|
+
*
|
|
384
389
|
* TODO: Technically, the way the input data is interpreted is arbitrary; we could interpret it as little endian which could result in a more compact representation. We could go even further and interpret the data at different byte or word boundaries to see if it results in a more compact representation, and signify to the caller which interpretation was used. We probably need a better understanding of random distributions of data to determine what is the optimal interpretation. More investigation is needed here.
|
|
385
390
|
*
|
|
386
391
|
* # Examples
|
|
387
392
|
*
|
|
388
393
|
* ```
|
|
389
|
-
* # use zeck::
|
|
390
|
-
* assert_eq!(
|
|
391
|
-
* assert_eq!(
|
|
392
|
-
* assert_eq!(
|
|
393
|
-
* assert_eq!(
|
|
394
|
-
* assert_eq!(
|
|
395
|
-
* assert_eq!(
|
|
396
|
-
* assert_eq!(
|
|
394
|
+
* # use zeck::zeckendorf_compress_be_broken_do_not_use;
|
|
395
|
+
* assert_eq!(zeckendorf_compress_be_broken_do_not_use(&[0]), vec![0]);
|
|
396
|
+
* assert_eq!(zeckendorf_compress_be_broken_do_not_use(&[1]), vec![1]);
|
|
397
|
+
* assert_eq!(zeckendorf_compress_be_broken_do_not_use(&[12]), vec![0b111]);
|
|
398
|
+
* assert_eq!(zeckendorf_compress_be_broken_do_not_use(&[54]), vec![30]);
|
|
399
|
+
* assert_eq!(zeckendorf_compress_be_broken_do_not_use(&[55]), vec![0, 1]); // 55 is the 10 indexed Fibonacci number, which is the 8 indexed effective Fibonacci number, and therefore is the first number needing two bytes to contain these 8 bits, because there is 1 "use bit" and 7 "skip bits" in the effective zeckendorf bits ascending.
|
|
400
|
+
* assert_eq!(zeckendorf_compress_be_broken_do_not_use(&[255]), vec![33, 2]);
|
|
401
|
+
* assert_eq!(zeckendorf_compress_be_broken_do_not_use(&[1, 0]), vec![34, 2]);
|
|
397
402
|
* ```
|
|
398
403
|
* @param {Uint8Array} data
|
|
399
404
|
* @returns {Uint8Array}
|
|
400
405
|
*/
|
|
401
|
-
export function
|
|
406
|
+
export function zeckendorf_compress_be_broken_do_not_use(data) {
|
|
402
407
|
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
403
408
|
const len0 = WASM_VECTOR_LEN;
|
|
404
|
-
const ret = wasm.
|
|
409
|
+
const ret = wasm.zeckendorf_compress_be_broken_do_not_use(ptr0, len0);
|
|
405
410
|
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
406
411
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
407
412
|
return v2;
|
|
@@ -412,25 +417,30 @@ export function zeckendorf_compress_be(data) {
|
|
|
412
417
|
*
|
|
413
418
|
* Assumes the input data is interpreted as a little endian integer. The output data is in little endian order, so the first bit and byte is the least significant bit and byte and the last bit and byte is the most significant bit and byte.
|
|
414
419
|
*
|
|
420
|
+
* # ⚠️ Warning
|
|
421
|
+
*
|
|
422
|
+
* **Compressing or decompressing data larger than 10KB (10,000 bytes) is unstable due to time and memory pressure.**
|
|
423
|
+
* The library may experience performance issues, excessive memory usage, or failures when processing data exceeding this size.
|
|
424
|
+
*
|
|
415
425
|
* # Examples
|
|
416
426
|
*
|
|
417
427
|
* ```
|
|
418
|
-
* # use zeck::
|
|
419
|
-
* assert_eq!(
|
|
420
|
-
* assert_eq!(
|
|
421
|
-
* assert_eq!(
|
|
422
|
-
* assert_eq!(
|
|
423
|
-
* assert_eq!(
|
|
424
|
-
* assert_eq!(
|
|
425
|
-
* assert_eq!(
|
|
428
|
+
* # use zeck::zeckendorf_compress_le_broken_do_not_use;
|
|
429
|
+
* assert_eq!(zeckendorf_compress_le_broken_do_not_use(&[0]), vec![0]);
|
|
430
|
+
* assert_eq!(zeckendorf_compress_le_broken_do_not_use(&[1]), vec![1]);
|
|
431
|
+
* assert_eq!(zeckendorf_compress_le_broken_do_not_use(&[12]), vec![0b111]);
|
|
432
|
+
* assert_eq!(zeckendorf_compress_le_broken_do_not_use(&[54]), vec![30]);
|
|
433
|
+
* assert_eq!(zeckendorf_compress_le_broken_do_not_use(&[55]), vec![0, 1]); // 55 is the 10 indexed Fibonacci number, which is the 8 indexed effective Fibonacci number, and therefore is the first number needing two bytes to contain these 8 bits, because there is 1 "use bit" and 7 "skip bits" in the effective zeckendorf bits ascending.
|
|
434
|
+
* assert_eq!(zeckendorf_compress_le_broken_do_not_use(&[255]), vec![33, 2]);
|
|
435
|
+
* assert_eq!(zeckendorf_compress_le_broken_do_not_use(&[0, 1]), vec![34, 2]);
|
|
426
436
|
* ```
|
|
427
437
|
* @param {Uint8Array} data
|
|
428
438
|
* @returns {Uint8Array}
|
|
429
439
|
*/
|
|
430
|
-
export function
|
|
440
|
+
export function zeckendorf_compress_le_broken_do_not_use(data) {
|
|
431
441
|
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
432
442
|
const len0 = WASM_VECTOR_LEN;
|
|
433
|
-
const ret = wasm.
|
|
443
|
+
const ret = wasm.zeckendorf_compress_le_broken_do_not_use(ptr0, len0);
|
|
434
444
|
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
435
445
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
436
446
|
return v2;
|
|
@@ -441,23 +451,28 @@ export function zeckendorf_compress_le(data) {
|
|
|
441
451
|
*
|
|
442
452
|
* Assume the original input data was interpreted as a big endian integer, for now. See the TODO in the [`zeckendorf_compress_be`] function for more information.
|
|
443
453
|
*
|
|
454
|
+
* # ⚠️ Warning
|
|
455
|
+
*
|
|
456
|
+
* **Compressing or decompressing data larger than 10KB (10,000 bytes) is unstable due to time and memory pressure.**
|
|
457
|
+
* The library may experience performance issues, excessive memory usage, or failures when processing data exceeding this size.
|
|
458
|
+
*
|
|
444
459
|
* # Examples
|
|
445
460
|
*
|
|
446
461
|
* ```
|
|
447
|
-
* # use zeck::
|
|
448
|
-
* assert_eq!(
|
|
449
|
-
* assert_eq!(
|
|
450
|
-
* assert_eq!(
|
|
451
|
-
* assert_eq!(
|
|
452
|
-
* assert_eq!(
|
|
462
|
+
* # use zeck::zeckendorf_decompress_be_broken_do_not_use;
|
|
463
|
+
* assert_eq!(zeckendorf_decompress_be_broken_do_not_use(&[0]), vec![0]);
|
|
464
|
+
* assert_eq!(zeckendorf_decompress_be_broken_do_not_use(&[1]), vec![1]);
|
|
465
|
+
* assert_eq!(zeckendorf_decompress_be_broken_do_not_use(&[0b111]), vec![12]);
|
|
466
|
+
* assert_eq!(zeckendorf_decompress_be_broken_do_not_use(&[33, 2]), vec![255]);
|
|
467
|
+
* assert_eq!(zeckendorf_decompress_be_broken_do_not_use(&[34, 2]), vec![1, 0]);
|
|
453
468
|
* ```
|
|
454
469
|
* @param {Uint8Array} compressed_data
|
|
455
470
|
* @returns {Uint8Array}
|
|
456
471
|
*/
|
|
457
|
-
export function
|
|
472
|
+
export function zeckendorf_decompress_be_broken_do_not_use(compressed_data) {
|
|
458
473
|
const ptr0 = passArray8ToWasm0(compressed_data, wasm.__wbindgen_malloc);
|
|
459
474
|
const len0 = WASM_VECTOR_LEN;
|
|
460
|
-
const ret = wasm.
|
|
475
|
+
const ret = wasm.zeckendorf_decompress_be_broken_do_not_use(ptr0, len0);
|
|
461
476
|
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
462
477
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
463
478
|
return v2;
|
|
@@ -466,23 +481,28 @@ export function zeckendorf_decompress_be(compressed_data) {
|
|
|
466
481
|
/**
|
|
467
482
|
* Decompresses a slice of bytes compressed using the Zeckendorf algorithm, assuming the original data was compressed using the little endian bytes interpretation.
|
|
468
483
|
*
|
|
484
|
+
* # ⚠️ Warning
|
|
485
|
+
*
|
|
486
|
+
* **Compressing or decompressing data larger than 10KB (10,000 bytes) is unstable due to time and memory pressure.**
|
|
487
|
+
* The library may experience performance issues, excessive memory usage, or failures when processing data exceeding this size.
|
|
488
|
+
*
|
|
469
489
|
* # Examples
|
|
470
490
|
*
|
|
471
491
|
* ```
|
|
472
|
-
* # use zeck::
|
|
473
|
-
* assert_eq!(
|
|
474
|
-
* assert_eq!(
|
|
475
|
-
* assert_eq!(
|
|
476
|
-
* assert_eq!(
|
|
477
|
-
* assert_eq!(
|
|
492
|
+
* # use zeck::zeckendorf_decompress_le_broken_do_not_use;
|
|
493
|
+
* assert_eq!(zeckendorf_decompress_le_broken_do_not_use(&[0]), vec![0]);
|
|
494
|
+
* assert_eq!(zeckendorf_decompress_le_broken_do_not_use(&[1]), vec![1]);
|
|
495
|
+
* assert_eq!(zeckendorf_decompress_le_broken_do_not_use(&[0b111]), vec![12]);
|
|
496
|
+
* assert_eq!(zeckendorf_decompress_le_broken_do_not_use(&[33, 2]), vec![255]);
|
|
497
|
+
* assert_eq!(zeckendorf_decompress_le_broken_do_not_use(&[34, 2]), vec![0, 1]);
|
|
478
498
|
* ```
|
|
479
499
|
* @param {Uint8Array} compressed_data
|
|
480
500
|
* @returns {Uint8Array}
|
|
481
501
|
*/
|
|
482
|
-
export function
|
|
502
|
+
export function zeckendorf_decompress_le_broken_do_not_use(compressed_data) {
|
|
483
503
|
const ptr0 = passArray8ToWasm0(compressed_data, wasm.__wbindgen_malloc);
|
|
484
504
|
const len0 = WASM_VECTOR_LEN;
|
|
485
|
-
const ret = wasm.
|
|
505
|
+
const ret = wasm.zeckendorf_decompress_le_broken_do_not_use(ptr0, len0);
|
|
486
506
|
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
487
507
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
488
508
|
return v2;
|
package/zeck_bg.wasm
CHANGED
|
Binary file
|