Files
onenote-tools/src/onenote/onepkg/quantum/tables.ts

30 lines
1.0 KiB
TypeScript

/*
* SPDX-License-Identifier: MIT
*
* Direct TypeScript translation of compcol `src/quantum/tables.rs` at commit
* 04a6db2aa7bd487a89c559631d79d1b384139f50.
* Copyright (c) 2026 Karpeles Lab Inc., MIT License.
*/
export const POSITION_BASE = Uint32Array.from([
0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
1_024, 1_536, 2_048, 3_072, 4_096, 6_144, 8_192, 12_288, 16_384, 24_576,
32_768, 49_152, 65_536, 98_304, 131_072, 196_608, 262_144, 393_216, 524_288,
786_432, 1_048_576, 1_572_864,
]);
export const EXTRA_BITS = Uint8Array.from([
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11,
11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19,
]);
export const LENGTH_BASE = Uint8Array.from([
0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 14, 18, 22, 26, 30, 38, 46, 54, 62, 78, 94,
110, 126, 158, 190, 222, 254,
]);
export const LENGTH_EXTRA = Uint8Array.from([
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5,
0,
]);