warpo 3.2.0 → 3.2.2

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.
Files changed (93) hide show
  1. package/assemblyscript/std/README.md +5 -0
  2. package/assemblyscript/std/assembly/array.ts +542 -0
  3. package/assemblyscript/std/assembly/arraybuffer.ts +72 -0
  4. package/assemblyscript/std/assembly/builtins.ts +2312 -0
  5. package/assemblyscript/std/assembly/compat.ts +2 -0
  6. package/assemblyscript/std/assembly/dataview.ts +144 -0
  7. package/assemblyscript/std/assembly/date.ts +383 -0
  8. package/assemblyscript/std/assembly/diagnostics.ts +11 -0
  9. package/assemblyscript/std/assembly/error.ts +39 -0
  10. package/assemblyscript/std/assembly/function.ts +44 -0
  11. package/assemblyscript/std/assembly/iterator.ts +24 -0
  12. package/assemblyscript/std/assembly/map.ts +304 -0
  13. package/assemblyscript/std/assembly/math.ts +3401 -0
  14. package/assemblyscript/std/assembly/memory.ts +110 -0
  15. package/assemblyscript/std/assembly/number.ts +388 -0
  16. package/assemblyscript/std/assembly/object.ts +30 -0
  17. package/assemblyscript/std/assembly/polyfills.ts +24 -0
  18. package/assemblyscript/std/assembly/process.ts +7 -0
  19. package/assemblyscript/std/assembly/promise.ts +172 -0
  20. package/assemblyscript/std/assembly/reference.ts +48 -0
  21. package/assemblyscript/std/assembly/regexp.ts +16 -0
  22. package/assemblyscript/std/assembly/rt/common.ts +79 -0
  23. package/assemblyscript/std/assembly/rt/index-incremental.ts +4 -0
  24. package/assemblyscript/std/assembly/rt/index-radical.ts +4 -0
  25. package/assemblyscript/std/assembly/rt/index.d.ts +37 -0
  26. package/assemblyscript/std/assembly/rt/itcms.ts +415 -0
  27. package/assemblyscript/std/assembly/rt/tcms.ts +276 -0
  28. package/assemblyscript/std/assembly/rt/tlsf.ts +564 -0
  29. package/assemblyscript/std/assembly/rt.ts +71 -0
  30. package/assemblyscript/std/assembly/set.ts +261 -0
  31. package/assemblyscript/std/assembly/shared/feature.ts +69 -0
  32. package/assemblyscript/std/assembly/shared/host.ts +12 -0
  33. package/assemblyscript/std/assembly/shared/runtime.ts +9 -0
  34. package/assemblyscript/std/assembly/shared/target.ts +9 -0
  35. package/assemblyscript/std/assembly/shared/tsconfig.json +9 -0
  36. package/assemblyscript/std/assembly/shared/typeinfo.ts +72 -0
  37. package/assemblyscript/std/assembly/staticarray.ts +446 -0
  38. package/assemblyscript/std/assembly/string.ts +892 -0
  39. package/assemblyscript/std/assembly/symbol.ts +61 -0
  40. package/assemblyscript/std/assembly/table.ts +15 -0
  41. package/assemblyscript/std/assembly/tsconfig.json +4 -0
  42. package/assemblyscript/std/assembly/tuple.ts +36 -0
  43. package/assemblyscript/std/assembly/typedarray.ts +2000 -0
  44. package/assemblyscript/std/assembly/uri.ts +17 -0
  45. package/assemblyscript/std/assembly/util/bytes.ts +90 -0
  46. package/assemblyscript/std/assembly/util/casemap.ts +264 -0
  47. package/assemblyscript/std/assembly/util/error.ts +54 -0
  48. package/assemblyscript/std/assembly/util/hash.ts +117 -0
  49. package/assemblyscript/std/assembly/util/math.ts +1922 -0
  50. package/assemblyscript/std/assembly/util/memory.ts +309 -0
  51. package/assemblyscript/std/assembly/util/number.ts +884 -0
  52. package/assemblyscript/std/assembly/util/sort.ts +282 -0
  53. package/assemblyscript/std/assembly/util/string.ts +1075 -0
  54. package/assemblyscript/std/assembly/util/uri.ts +251 -0
  55. package/assemblyscript/std/assembly/vector.ts +3 -0
  56. package/dist/debug_server/debugSession.d.ts +1 -0
  57. package/dist/debug_server/debugSession.js +15 -6
  58. package/dist/debug_server/debugSession.js.map +1 -1
  59. package/dist/debug_server/debuggerWasmModule.d.ts +3 -0
  60. package/dist/debug_server/debuggerWasmModule.js +47 -2
  61. package/dist/debug_server/debuggerWasmModule.js.map +1 -1
  62. package/dist/debug_server/tests/debugSession.test.js +96 -0
  63. package/dist/debug_server/tests/debugSession.test.js.map +1 -1
  64. package/dist/debug_server/tests/testModule/debugger_closure_stepping.d.ts +1 -0
  65. package/dist/debug_server/tests/testModule/debugger_closure_stepping.js +12 -0
  66. package/dist/debug_server/tests/testModule/debugger_closure_stepping.js.map +1 -0
  67. package/dist/debug_server/tests/testModule/debugger_std_array.d.ts +1 -0
  68. package/dist/debug_server/tests/testModule/debugger_std_array.js +6 -0
  69. package/dist/debug_server/tests/testModule/debugger_std_array.js.map +1 -0
  70. package/dist/debug_server/tests/testModule/debugger_string_stepping.d.ts +1 -0
  71. package/dist/debug_server/tests/testModule/debugger_string_stepping.js +9 -0
  72. package/dist/debug_server/tests/testModule/debugger_string_stepping.js.map +1 -0
  73. package/package.json +7 -7
  74. package/warpo_extension/std/tsconfig.json +4 -0
  75. package/warpo_extension/std/warpo/ffi.ts +16 -0
  76. package/warpo_extension/std/warpo/test/comparison.ts +122 -0
  77. package/warpo_extension/std/warpo/test/env.ts +33 -0
  78. package/warpo_extension/std/warpo/test/expect.ts +101 -0
  79. package/warpo_extension/std/warpo/test/formatPrint.ts +99 -0
  80. package/warpo_extension/std/warpo/test/implement.ts +41 -0
  81. package/warpo_extension/std/warpo/test/index.d.ts +0 -0
  82. package/warpo_extension/std/warpo/test/index.ts +39 -0
  83. package/warpo_extension/std/warpo/test/mockInstrument.ts +26 -0
  84. package/warpo_extension/std/warpo/utf8/const_str.ts +17 -0
  85. package/warpo_extension/std/wasi_snapshot_preview1/LICENSE +202 -0
  86. package/warpo_extension/std/wasi_snapshot_preview1/README.md +1 -0
  87. package/warpo_extension/std/wasi_snapshot_preview1/bindings/wasi_snapshot_preview1.ts +1731 -0
  88. package/warpo_extension/std/wasi_snapshot_preview1/wasi_console.ts +96 -0
  89. package/warpo_extension/std/wasi_snapshot_preview1/wasi_crypto.ts +8 -0
  90. package/warpo_extension/std/wasi_snapshot_preview1/wasi_date.ts +13 -0
  91. package/warpo_extension/std/wasi_snapshot_preview1/wasi_internal.ts +119 -0
  92. package/warpo_extension/std/wasi_snapshot_preview1/wasi_performance.ts +11 -0
  93. package/warpo_extension/std/wasi_snapshot_preview1/wasi_process.ts +191 -0
@@ -0,0 +1,17 @@
1
+ import { encode, decode, URI_UNSAFE, URL_UNSAFE } from "./util/uri";
2
+
3
+ export function encodeURI(str: string): string {
4
+ return changetype<string>(encode(changetype<usize>(str), str.length, URI_UNSAFE));
5
+ }
6
+
7
+ export function decodeURI(str: string): string {
8
+ return changetype<string>(decode(changetype<usize>(str), str.length, false));
9
+ }
10
+
11
+ export function encodeURIComponent(str: string): string {
12
+ return changetype<string>(encode(changetype<usize>(str), str.length, URL_UNSAFE));
13
+ }
14
+
15
+ export function decodeURIComponent(str: string): string {
16
+ return changetype<string>(decode(changetype<usize>(str), str.length, true));
17
+ }
@@ -0,0 +1,90 @@
1
+ export function REVERSE<T>(ptr: usize, len: usize): void {
2
+ if (len > 1) {
3
+ let i: usize = 0,
4
+ tail: usize,
5
+ hlen: usize = len >> 1;
6
+
7
+ if (ASC_SHRINK_LEVEL < 1) {
8
+ if (sizeof<T>() == 1) {
9
+ // TODO: Decide later: Does we need this fast path cases?
10
+ //
11
+ // if (len == 4) {
12
+ // store<u32>(ptr, bswap(load<u32>(ptr)));
13
+ // return;
14
+ // }
15
+ // if (len == 8) {
16
+ // store<u64>(ptr, bswap(load<u64>(ptr)));
17
+ // return;
18
+ // }
19
+ tail = len - 8;
20
+ while (i + 7 < hlen) {
21
+ let front = ptr + i;
22
+ let back = ptr + tail - i;
23
+ let temp = bswap(load<u64>(front));
24
+ store<u64>(front, bswap(load<u64>(back)));
25
+ store<u64>(back, temp);
26
+ i += 8;
27
+ }
28
+ }
29
+
30
+ if (sizeof<T>() == 2) {
31
+ tail = len - 2;
32
+ while (i + 1 < hlen) {
33
+ let front = ptr + (i << 1);
34
+ let back = ptr + ((tail - i) << 1);
35
+ let temp = rotr(load<u32>(back), 16);
36
+ store<u32>(back, rotr(load<u32>(front), 16));
37
+ store<u32>(front, temp);
38
+ i += 2;
39
+ }
40
+ }
41
+ }
42
+
43
+ tail = len - 1;
44
+ while (i < hlen) {
45
+ let front = ptr + (i << alignof<T>());
46
+ let back = ptr + ((tail - i) << alignof<T>());
47
+ let temp = load<T>(front);
48
+ store<T>(front, load<T>(back));
49
+ store<T>(back, temp);
50
+ i++;
51
+ }
52
+ }
53
+ }
54
+
55
+ export function FILL<T>(ptr: usize, len: usize, value: T, start: isize, end: isize): void {
56
+ start = start < 0 ? max(len + start, 0) : min(start, len);
57
+ end = end < 0 ? max(len + end, 0) : min(end, len);
58
+
59
+ if (sizeof<T>() == 1) {
60
+ if (start < end) {
61
+ memory.fill(ptr + <usize>start, u8(value), <usize>(end - start));
62
+ }
63
+ } else {
64
+ if (ASC_SHRINK_LEVEL <= 1) {
65
+ if (isInteger<T>()) {
66
+ // @ts-ignore
67
+ if ((value == <T>0) | (value == <T>-1)) {
68
+ if (start < end) {
69
+ memory.fill(ptr + ((<usize>start) << alignof<T>()), u8(value), (<usize>(end - start)) << alignof<T>());
70
+ }
71
+ return;
72
+ }
73
+ } else if (isFloat<T>()) {
74
+ // for floating non-negative zeros we can use fast memory.fill
75
+ if (
76
+ (sizeof<T>() == 4 && reinterpret<u32>(f32(value)) == 0) ||
77
+ (sizeof<T>() == 8 && reinterpret<u64>(f64(value)) == 0)
78
+ ) {
79
+ if (start < end) {
80
+ memory.fill(ptr + ((<usize>start) << alignof<T>()), 0, (<usize>(end - start)) << alignof<T>());
81
+ }
82
+ return;
83
+ }
84
+ }
85
+ }
86
+ for (; start < end; ++start) {
87
+ store<T>(ptr + ((<usize>start) << alignof<T>()), value);
88
+ }
89
+ }
90
+ }
@@ -0,0 +1,264 @@
1
+ // Total tables size: ~5 kb (usually compressed to ~4 kb)
2
+ // See: https://git.musl-libc.org/cgit/musl/tree/src/ctype/casemap.h
3
+
4
+ // @ts-ignore: decorator
5
+ @lazy @inline const TAB = memory.data<u8>([
6
+ 7, 8, 9, 10, 11, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 13, 6, 6, 14, 6, 6, 6, 6, 6, 6, 6, 6, 15, 16, 17, 18, 6,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, 86, 5, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 36, 80, 121, 49, 80, 49, 80, 49, 56, 80,
25
+ 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 78, 49, 2, 78, 13, 13, 78, 3, 78, 0, 36, 110, 0, 78, 49, 38,
26
+ 110, 81, 78, 36, 80, 78, 57, 20, 129, 27, 29, 29, 83, 49, 80, 49, 80, 13, 49, 80, 49, 80, 49, 80, 27, 83, 36, 80, 49,
27
+ 2, 92, 123, 92, 123, 92, 123, 92, 123, 92, 123, 20, 121, 92, 123, 92, 123, 92, 45, 43, 73, 3, 72, 3, 120, 92, 123, 20,
28
+ 0, 150, 10, 1, 43, 40, 6, 6, 0, 42, 6, 42, 42, 43, 7, 187, 181, 43, 30, 0, 43, 7, 43, 43, 43, 1, 43, 43, 43, 43, 43,
29
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1, 43, 43,
30
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 43, 43, 43, 43, 43, 43, 43,
31
+ 43, 43, 43, 43, 43, 43, 205, 70, 205, 43, 0, 37, 43, 7, 1, 6, 1, 85, 86, 86, 86, 86, 86, 85, 86, 86, 2, 36, 129, 129,
32
+ 129, 129, 129, 21, 129, 129, 129, 0, 0, 43, 0, 178, 209, 178, 209, 178, 209, 178, 209, 0, 0, 205, 204, 1, 0, 215, 215,
33
+ 215, 215, 215, 131, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 172, 172, 172, 172, 172, 172, 172, 172, 172,
34
+ 172, 28, 0, 0, 0, 0, 0, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 2, 0, 0, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80,
35
+ 49, 80, 49, 80, 49, 80, 49, 80, 78, 49, 80, 49, 80, 78, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 2,
36
+ 135, 166, 135, 166, 135, 166, 135, 166, 135, 166, 135, 166, 135, 166, 135, 166, 42, 43, 43, 43, 43, 43, 43, 43, 43,
37
+ 43, 43, 43, 43, 0, 0, 0, 84, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
38
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
39
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
40
+ 0, 0, 84, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 12, 0, 12, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
41
+ 43, 43, 7, 42, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
42
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 86, 86, 108, 129, 21, 0, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
44
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
45
+ 43, 43, 43, 7, 108, 3, 65, 43, 43, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 44, 86, 43, 43, 43, 43, 43,
46
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
47
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 108, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0,
48
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 37, 6, 37, 6, 37, 6,
49
+ 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6,
50
+ 37, 6, 37, 6, 37, 6, 37, 6, 37, 86, 122, 158, 38, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6,
51
+ 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 37, 6, 1, 43, 43, 79, 86, 86, 44, 43, 127, 86, 86, 57, 43, 43, 85, 86, 86, 43, 43,
52
+ 79, 86, 86, 44, 43, 127, 86, 86, 129, 55, 117, 91, 123, 92, 43, 43, 79, 86, 86, 2, 172, 4, 0, 0, 57, 43, 43, 85, 86,
53
+ 86, 43, 43, 79, 86, 86, 44, 43, 43, 86, 86, 50, 19, 129, 87, 0, 111, 129, 126, 201, 215, 126, 45, 129, 129, 14, 126,
54
+ 57, 127, 111, 87, 0, 129, 129, 126, 21, 0, 126, 3, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 7, 43, 36, 43, 151,
55
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 43, 43, 43, 43, 43, 86, 86, 86, 86, 86, 128, 129, 129, 129, 129, 57, 187, 42,
56
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
57
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 1, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
58
+ 129, 201, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 208, 13, 0, 78, 49, 2, 180, 193,
59
+ 193, 215, 215, 36, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80,
60
+ 49, 80, 49, 80, 49, 80, 49, 80, 215, 215, 83, 193, 71, 212, 215, 215, 215, 5, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
61
+ 43, 43, 7, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
62
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 78, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80, 49, 80,
64
+ 13, 0, 0, 0, 0, 0, 36, 80, 49, 80, 49, 80, 49, 80, 49, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
65
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 121, 92, 123, 92, 123, 79, 123,
66
+ 92, 123, 92, 123, 92, 123, 92, 123, 92, 123, 92, 123, 92, 123, 92, 123, 92, 123, 92, 45, 43, 43, 121, 20, 92, 123, 92,
67
+ 45, 121, 42, 92, 39, 92, 123, 92, 123, 92, 123, 164, 0, 10, 180, 92, 123, 92, 123, 79, 3, 120, 56, 43, 43, 43, 43, 43,
68
+ 43, 43, 43, 43, 43, 43, 43, 43, 79, 45, 43, 43, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
69
+ 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
70
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
71
+ 0, 0, 0, 0, 0, 0, 43, 43, 43, 43, 43, 43, 43, 43, 7, 0, 72, 86, 86, 86, 86, 86, 86, 86, 86, 2, 0, 0, 0, 0, 0, 0, 0, 0,
72
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
73
+ 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 85, 86, 86, 86, 86, 86, 86, 86, 86, 86,
74
+ 86, 86, 86, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 43,
75
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 7, 0, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 0, 0, 0, 0, 0, 0, 0, 0,
76
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 43,
77
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 7, 0, 0, 0, 0, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
78
+ 86, 86, 86, 86, 86, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
79
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 43, 43, 43, 43, 43, 43, 43, 43,
80
+ 43, 43, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
81
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 14,
82
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
83
+ 0, 0, 0, 0, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 85, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 14, 0, 0, 0, 0, 0,
84
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
85
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
86
+ ]);
87
+
88
+ // @ts-ignore: decorator
89
+ @lazy @inline const RULES = memory.data<i32>([
90
+ 0x0, 0x2001, -0x2000, 0x1dbf00, 0x2e700, 0x7900, 0x2402, 0x101, -0x100, 0x0, 0x201, -0x200, -0xc6ff, -0xe800, -0x78ff,
91
+ -0x12c00, 0xc300, 0xd201, 0xce01, 0xcd01, 0x4f01, 0xca01, 0xcb01, 0xcf01, 0x6100, 0xd301, 0xd101, 0xa300, 0xd501,
92
+ 0x8200, 0xd601, 0xda01, 0xd901, 0xdb01, 0x3800, 0x3, -0x4f00, -0x60ff, -0x37ff, 0x242802, 0x0, 0x101, -0x100, -0xcd00,
93
+ -0xda00, -0x81ff, 0x2a2b01, -0xa2ff, 0x2a2801, 0x2a3f00, -0xc2ff, 0x4501, 0x4701, 0x2a1f00, 0x2a1c00, 0x2a1e00,
94
+ -0xd200, -0xce00, -0xca00, -0xcb00, 0xa54f00, 0xa54b00, -0xcf00, 0xa52800, 0xa54400, -0xd100, -0xd300, 0x29f700,
95
+ 0xa54100, 0x29fd00, -0xd500, -0xd600, 0x29e700, 0xa54300, 0xa52a00, -0x4500, -0xd900, -0x4700, -0xdb00, 0xa51500,
96
+ 0xa51200, 0x4c2402, 0x0, 0x2001, -0x2000, 0x101, -0x100, 0x5400, 0x7401, 0x2601, 0x2501, 0x4001, 0x3f01, -0x2600,
97
+ -0x2500, -0x1f00, -0x4000, -0x3f00, 0x801, -0x3e00, -0x3900, -0x2f00, -0x3600, -0x800, -0x5600, -0x5000, 0x700,
98
+ -0x7400, -0x3bff, -0x6000, -0x6ff, 0x701a02, 0x101, -0x100, 0x2001, -0x2000, 0x5001, 0xf01, -0xf00, 0x0, 0x3001,
99
+ -0x3000, 0x101, -0x100, 0x0, 0xbc000, 0x1c6001, 0x0, 0x97d001, 0x801, -0x800, 0x8a0502, 0x0, -0xbbfff, -0x186200,
100
+ 0x89c200, -0x182500, -0x186e00, -0x186d00, -0x186400, -0x186300, -0x185c00, 0x0, 0x8a3800, 0x8a0400, 0xee600, 0x101,
101
+ -0x100, 0x0, -0x3b00, -0x1dbeff, 0x8f1d02, 0x800, -0x7ff, 0x0, 0x5600, -0x55ff, 0x4a00, 0x6400, 0x8000, 0x7000,
102
+ 0x7e00, 0x900, -0x49ff, -0x8ff, -0x1c2500, -0x63ff, -0x6fff, -0x7fff, -0x7dff, 0xac0502, 0x0, 0x1001, -0x1000, 0x1c01,
103
+ 0x101, -0x1d5cff, -0x20beff, -0x2045ff, -0x1c00, 0xb10b02, 0x101, -0x100, 0x3001, -0x3000, 0x0, -0x29f6ff, -0xee5ff,
104
+ -0x29e6ff, -0x2a2b00, -0x2a2800, -0x2a1bff, -0x29fcff, -0x2a1eff, -0x2a1dff, -0x2a3eff, 0x0, -0x1c6000, 0x0, 0x101,
105
+ -0x100, 0xbc0c02, 0x0, 0x101, -0x100, -0xa543ff, 0x3a001, -0x8a03ff, -0xa527ff, 0x3000, -0xa54eff, -0xa54aff,
106
+ -0xa540ff, -0xa511ff, -0xa529ff, -0xa514ff, -0x2fff, -0xa542ff, -0x8a37ff, 0x0, -0x97d000, -0x3a000, 0x0, 0x2001,
107
+ -0x2000, 0x0, 0x2801, -0x2800, 0x0, 0x4001, -0x4000, 0x0, 0x2001, -0x2000, 0x0, 0x2001, -0x2000, 0x0, 0x2201, -0x2200,
108
+ ]);
109
+
110
+ // @ts-ignore: decorator
111
+ @lazy @inline const RULE_BASES = memory.data<u8>([
112
+ 0, 6, 39, 81, 111, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 124, 0, 0, 127, 0, 0, 0, 0, 0, 0, 0, 0, 131, 142, 146, 151, 0,
113
+ 170, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 180, 196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
123
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
124
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 237, 0, 0, 0, 0, 0,
125
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
126
+ ]);
127
+
128
+ // @ts-ignore: decorator
129
+ @lazy @inline const EXCEPTIONS = memory.data<u8>([
130
+ 48, 12, 49, 13, 120, 14, 127, 15, 128, 16, 129, 17, 134, 18, 137, 19, 138, 19, 142, 20, 143, 21, 144, 22, 147, 19,
131
+ 148, 23, 149, 24, 150, 25, 151, 26, 154, 27, 156, 25, 157, 28, 158, 29, 159, 30, 166, 31, 169, 31, 174, 31, 177, 32,
132
+ 178, 32, 183, 33, 191, 34, 197, 35, 200, 35, 203, 35, 221, 36, 242, 35, 246, 37, 247, 38, 32, 45, 58, 46, 61, 47, 62,
133
+ 48, 63, 49, 64, 49, 67, 50, 68, 51, 69, 52, 80, 53, 81, 54, 82, 55, 83, 56, 84, 57, 89, 58, 91, 59, 92, 60, 97, 61,
134
+ 99, 62, 101, 63, 102, 64, 104, 65, 105, 66, 106, 64, 107, 67, 108, 68, 111, 66, 113, 69, 114, 70, 117, 71, 125, 72,
135
+ 130, 73, 135, 74, 137, 75, 138, 76, 139, 76, 140, 77, 146, 78, 157, 79, 158, 80, 69, 87, 123, 29, 124, 29, 125, 29,
136
+ 127, 88, 134, 89, 136, 90, 137, 90, 138, 90, 140, 91, 142, 92, 143, 92, 172, 93, 173, 94, 174, 94, 175, 94, 194, 95,
137
+ 204, 96, 205, 97, 206, 97, 207, 98, 208, 99, 209, 100, 213, 101, 214, 102, 215, 103, 240, 104, 241, 105, 242, 106,
138
+ 243, 107, 244, 108, 245, 109, 249, 110, 253, 45, 254, 45, 255, 45, 80, 105, 81, 105, 82, 105, 83, 105, 84, 105, 85,
139
+ 105, 86, 105, 87, 105, 88, 105, 89, 105, 90, 105, 91, 105, 92, 105, 93, 105, 94, 105, 95, 105, 130, 0, 131, 0, 132, 0,
140
+ 133, 0, 134, 0, 135, 0, 136, 0, 137, 0, 192, 117, 207, 118, 128, 137, 129, 138, 130, 139, 133, 140, 134, 141, 112,
141
+ 157, 113, 157, 118, 158, 119, 158, 120, 159, 121, 159, 122, 160, 123, 160, 124, 161, 125, 161, 179, 162, 186, 163,
142
+ 187, 163, 188, 164, 190, 165, 195, 162, 204, 164, 218, 166, 219, 166, 229, 106, 234, 167, 235, 167, 236, 110, 243,
143
+ 162, 248, 168, 249, 168, 250, 169, 251, 169, 252, 164, 38, 176, 42, 177, 43, 178, 78, 179, 132, 8, 98, 186, 99, 187,
144
+ 100, 188, 101, 189, 102, 190, 109, 191, 110, 192, 111, 193, 112, 194, 126, 195, 127, 195, 125, 207, 141, 208, 148,
145
+ 209, 171, 210, 172, 211, 173, 212, 176, 213, 177, 214, 178, 215, 196, 216, 197, 217, 198, 218,
146
+ ]);
147
+
148
+ /* Special Case Mappings
149
+ * See: https://unicode.org/Public/UNIDATA/SpecialCasing.txt
150
+ */
151
+
152
+ /*
153
+ @lazy @inline
154
+ const SPECIALS_LOWER: StaticArray<u16> = [
155
+ 0x0130, 0x0069, 0x0307, 0x0000,
156
+ ];
157
+ */
158
+
159
+ // @ts-ignore: decorator
160
+ @lazy @inlne
161
+ export const SPECIALS_UPPER: StaticArray<u16> = [
162
+ // String#toUpperCase needs .length
163
+ 0x00df, 0x0053, 0x0053, 0x0000, 0x0149, 0x02bc, 0x004e, 0x0000, 0x01f0, 0x004a, 0x030c, 0x0000, 0x0390, 0x0399,
164
+ 0x0308, 0x0301, 0x03b0, 0x03a5, 0x0308, 0x0301, 0x0587, 0x0535, 0x0552, 0x0000, 0x1e96, 0x0048, 0x0331, 0x0000,
165
+ 0x1e97, 0x0054, 0x0308, 0x0000, 0x1e98, 0x0057, 0x030a, 0x0000, 0x1e99, 0x0059, 0x030a, 0x0000, 0x1e9a, 0x0041,
166
+ 0x02be, 0x0000, 0x1f50, 0x03a5, 0x0313, 0x0000, 0x1f52, 0x03a5, 0x0313, 0x0300, 0x1f54, 0x03a5, 0x0313, 0x0301,
167
+ 0x1f56, 0x03a5, 0x0313, 0x0342, 0x1f80, 0x1f08, 0x0399, 0x0000, 0x1f81, 0x1f09, 0x0399, 0x0000, 0x1f82, 0x1f0a,
168
+ 0x0399, 0x0000, 0x1f83, 0x1f0b, 0x0399, 0x0000, 0x1f84, 0x1f0c, 0x0399, 0x0000, 0x1f85, 0x1f0d, 0x0399, 0x0000,
169
+ 0x1f86, 0x1f0e, 0x0399, 0x0000, 0x1f87, 0x1f0f, 0x0399, 0x0000, 0x1f88, 0x1f08, 0x0399, 0x0000, 0x1f89, 0x1f09,
170
+ 0x0399, 0x0000, 0x1f8a, 0x1f0a, 0x0399, 0x0000, 0x1f8b, 0x1f0b, 0x0399, 0x0000, 0x1f8c, 0x1f0c, 0x0399, 0x0000,
171
+ 0x1f8d, 0x1f0d, 0x0399, 0x0000, 0x1f8e, 0x1f0e, 0x0399, 0x0000, 0x1f8f, 0x1f0f, 0x0399, 0x0000, 0x1f90, 0x1f28,
172
+ 0x0399, 0x0000, 0x1f91, 0x1f29, 0x0399, 0x0000, 0x1f92, 0x1f2a, 0x0399, 0x0000, 0x1f93, 0x1f2b, 0x0399, 0x0000,
173
+ 0x1f94, 0x1f2c, 0x0399, 0x0000, 0x1f95, 0x1f2d, 0x0399, 0x0000, 0x1f96, 0x1f2e, 0x0399, 0x0000, 0x1f97, 0x1f2f,
174
+ 0x0399, 0x0000, 0x1f98, 0x1f28, 0x0399, 0x0000, 0x1f99, 0x1f29, 0x0399, 0x0000, 0x1f9a, 0x1f2a, 0x0399, 0x0000,
175
+ 0x1f9b, 0x1f2b, 0x0399, 0x0000, 0x1f9c, 0x1f2c, 0x0399, 0x0000, 0x1f9d, 0x1f2d, 0x0399, 0x0000, 0x1f9e, 0x1f2e,
176
+ 0x0399, 0x0000, 0x1f9f, 0x1f2f, 0x0399, 0x0000, 0x1fa0, 0x1f68, 0x0399, 0x0000, 0x1fa1, 0x1f69, 0x0399, 0x0000,
177
+ 0x1fa2, 0x1f6a, 0x0399, 0x0000, 0x1fa3, 0x1f6b, 0x0399, 0x0000, 0x1fa4, 0x1f6c, 0x0399, 0x0000, 0x1fa5, 0x1f6d,
178
+ 0x0399, 0x0000, 0x1fa6, 0x1f6e, 0x0399, 0x0000, 0x1fa7, 0x1f6f, 0x0399, 0x0000, 0x1fa8, 0x1f68, 0x0399, 0x0000,
179
+ 0x1fa9, 0x1f69, 0x0399, 0x0000, 0x1faa, 0x1f6a, 0x0399, 0x0000, 0x1fab, 0x1f6b, 0x0399, 0x0000, 0x1fac, 0x1f6c,
180
+ 0x0399, 0x0000, 0x1fad, 0x1f6d, 0x0399, 0x0000, 0x1fae, 0x1f6e, 0x0399, 0x0000, 0x1faf, 0x1f6f, 0x0399, 0x0000,
181
+ 0x1fb2, 0x1fba, 0x0399, 0x0000, 0x1fb3, 0x0391, 0x0399, 0x0000, 0x1fb4, 0x0386, 0x0399, 0x0000, 0x1fb6, 0x0391,
182
+ 0x0342, 0x0000, 0x1fb7, 0x0391, 0x0342, 0x0399, 0x1fbc, 0x0391, 0x0399, 0x0000, 0x1fc2, 0x1fca, 0x0399, 0x0000,
183
+ 0x1fc3, 0x0397, 0x0399, 0x0000, 0x1fc4, 0x0389, 0x0399, 0x0000, 0x1fc6, 0x0397, 0x0342, 0x0000, 0x1fc7, 0x0397,
184
+ 0x0342, 0x0399, 0x1fcc, 0x0397, 0x0399, 0x0000, 0x1fd2, 0x0399, 0x0308, 0x0300, 0x1fd3, 0x0399, 0x0308, 0x0301,
185
+ 0x1fd6, 0x0399, 0x0342, 0x0000, 0x1fd7, 0x0399, 0x0308, 0x0342, 0x1fe2, 0x03a5, 0x0308, 0x0300, 0x1fe3, 0x03a5,
186
+ 0x0308, 0x0301, 0x1fe4, 0x03a1, 0x0313, 0x0000, 0x1fe6, 0x03a5, 0x0342, 0x0000, 0x1fe7, 0x03a5, 0x0308, 0x0342,
187
+ 0x1ff2, 0x1ffa, 0x0399, 0x0000, 0x1ff3, 0x03a9, 0x0399, 0x0000, 0x1ff4, 0x038f, 0x0399, 0x0000, 0x1ff6, 0x03a9,
188
+ 0x0342, 0x0000, 0x1ff7, 0x03a9, 0x0342, 0x0399, 0x1ffc, 0x03a9, 0x0399, 0x0000, 0xfb00, 0x0046, 0x0046, 0x0000,
189
+ 0xfb01, 0x0046, 0x0049, 0x0000, 0xfb02, 0x0046, 0x004c, 0x0000, 0xfb03, 0x0046, 0x0046, 0x0049, 0xfb04, 0x0046,
190
+ 0x0046, 0x004c, 0xfb05, 0x0053, 0x0054, 0x0000, 0xfb06, 0x0053, 0x0054, 0x0000, 0xfb13, 0x0544, 0x0546, 0x0000,
191
+ 0xfb14, 0x0544, 0x0535, 0x0000, 0xfb15, 0x0544, 0x053b, 0x0000, 0xfb16, 0x054e, 0x0546, 0x0000, 0xfb17, 0x0544,
192
+ 0x053d, 0x0000,
193
+ ];
194
+
195
+ // @ts-ignore: decorator
196
+ @lazy @inline const MT = memory.data<i32>([2048, 342, 57]);
197
+
198
+ // Special binary search routine for Special Casing Tables
199
+ // @ts-ignore: decorator
200
+ @inline
201
+ export function bsearch(key: u32, ptr: usize, max: i32): i32 {
202
+ let min = 0;
203
+ while (min <= max) {
204
+ let mid = ((min + max) >>> 3) << 2;
205
+ let cmp = load<u16>(ptr + (mid << alignof<u16>())) - key;
206
+ if (cmp == 0)
207
+ return mid; // found
208
+ else if (cmp >>> 31)
209
+ min = mid + 4; // < 0
210
+ else max = mid - 4; // > 0
211
+ }
212
+ return -1; // not found
213
+ }
214
+
215
+ // See: https://git.musl-libc.org/cgit/musl/tree/src/ctype/towctrans.c
216
+ export function casemap(c: u32, dir: i32): i32 {
217
+ // if (c >= 0x20000) return c;
218
+ let c0 = c as i32;
219
+ let b = c >> 8;
220
+ c &= 255;
221
+
222
+ let x = c / 3;
223
+ let y = c % 3;
224
+
225
+ /* lookup entry in two-level base-6 table */
226
+ // v = tab[(tab[b] as i32) * 86 + x] as u32;
227
+ let v = <usize>load<u8>(TAB + <usize>load<u8>(TAB + b) * 86 + x);
228
+ // v = (v * mt[y] >> 11) % 6;
229
+ v = ((v * load<i32>(MT + (y << alignof<i32>()))) >> 11) % 6;
230
+ /* use the bit vector out of the tables as an index into
231
+ * a block-specific set of rules and decode the rule into
232
+ * a type and a case-mapping delta. */
233
+ // r = rules[(ruleBases[b] as u32) + v];
234
+ let r = load<i32>(RULES + ((<usize>load<u8>(RULE_BASES + b) + v) << alignof<i32>()));
235
+ let rt: u32 = r & 255;
236
+ let rd: i32 = r >> 8;
237
+ /* rules 0/1 are simple lower/upper case with a delta.
238
+ * apply according to desired mapping direction. */
239
+ if (rt < 2) return c0 + (rd & -(rt ^ dir));
240
+ /* binary search. endpoints of the binary search for
241
+ * this block are stored in the rule delta field. */
242
+ let xn: u32 = rd & 0xff;
243
+ let xb: u32 = rd >>> 8;
244
+ while (xn) {
245
+ let h = xn >> 1;
246
+ // let t = exceptions[(xb + h) * 2 + 0] as u32;
247
+ let t = <u32>load<u8>(EXCEPTIONS + (xb + h) * 2, 0);
248
+ if (t == c) {
249
+ // r = rules[exceptions[(xb + h) * 2 + 1]];
250
+ r = load<i32>(RULES + <usize>(load<u8>(EXCEPTIONS + (xb + h) * 2, 1) << alignof<i32>()));
251
+ rt = r & 255;
252
+ rd = r >> 8;
253
+ if (rt < 2) return c0 + (rd & -(rt ^ dir));
254
+ /* Hard-coded for the four exceptional titlecase */
255
+ return c0 + 1 - (dir << 1); // (dir ? -1 : 1);
256
+ } else if (t > c) {
257
+ xn = h;
258
+ } else {
259
+ xb += h;
260
+ xn -= h;
261
+ }
262
+ }
263
+ return c0;
264
+ }
@@ -0,0 +1,54 @@
1
+ // Common error messages for use across the standard library. Keeping error messages compact
2
+ // and reusing them where possible ensures minimal static data in binaries.
3
+
4
+ // @ts-ignore: decorator
5
+ @lazy @inline
6
+ export const E_INDEXOUTOFRANGE: string = "Index out of range";
7
+
8
+ // @ts-ignore: decorator
9
+ @lazy @inline
10
+ export const E_VALUEOUTOFRANGE: string = "Value out of range";
11
+
12
+ // @ts-ignore: decorator
13
+ @lazy @inline
14
+ export const E_INVALIDLENGTH: string = "Invalid length";
15
+
16
+ // @ts-ignore: decorator
17
+ @lazy @inline
18
+ export const E_EMPTYARRAY: string = "Array is empty";
19
+
20
+ // @ts-ignore: decorator
21
+ @lazy @inline
22
+ export const E_HOLEYARRAY: string = "Element type must be nullable if array is holey";
23
+
24
+ // @ts-ignore: decorator
25
+ @lazy @inline
26
+ export const E_NOTIMPLEMENTED: string = "Not implemented";
27
+
28
+ // @ts-ignore: decorator
29
+ @lazy @inline
30
+ export const E_KEYNOTFOUND: string = "Key does not exist";
31
+
32
+ // @ts-ignore: decorator
33
+ @lazy @inline
34
+ export const E_ALLOCATION_TOO_LARGE: string = "Allocation too large";
35
+
36
+ // @ts-ignore: decorator
37
+ @lazy @inline
38
+ export const E_ALREADY_PINNED: string = "Object already pinned";
39
+
40
+ // @ts-ignore: decorator
41
+ @lazy @inline
42
+ export const E_NOT_PINNED: string = "Object is not pinned";
43
+
44
+ // @ts-ignore: decorator
45
+ @lazy @inline
46
+ export const E_URI_MALFORMED: string = "URI malformed";
47
+
48
+ // @ts-ignore: decorator
49
+ @lazy @inline
50
+ export const E_INVALIDDATE: string = "Invalid Date";
51
+
52
+ // @ts-ignore: decorator
53
+ @lazy @inline
54
+ export const E_UNPAIRED_SURROGATE: string = "Unpaired surrogate";
@@ -0,0 +1,117 @@
1
+ export function HASH<T>(key: T): u32 {
2
+ if (isString<T>()) {
3
+ return hashStr(changetype<string>(key));
4
+ } else if (isReference<T>()) {
5
+ if (sizeof<T>() == 4) return hash32(changetype<u32>(key));
6
+ if (sizeof<T>() == 8) return hash64(changetype<u64>(key));
7
+ } else if (isFloat<T>()) {
8
+ if (sizeof<T>() == 4) return hash32(reinterpret<u32>(f32(key)));
9
+ if (sizeof<T>() == 8) return hash64(reinterpret<u64>(f64(key)));
10
+ } else {
11
+ if (sizeof<T>() <= 4) return hash32(u32(key), sizeof<T>());
12
+ if (sizeof<T>() == 8) return hash64(u64(key));
13
+ }
14
+ return unreachable();
15
+ }
16
+
17
+ // XXHash 32-bit as a starting point, see: https://cyan4973.github.io/xxHash
18
+
19
+ // primes
20
+ // @ts-ignore: decorator
21
+ @inline const XXH32_P1: u32 = 2654435761;
22
+ // @ts-ignore: decorator
23
+ @inline const XXH32_P2: u32 = 2246822519;
24
+ // @ts-ignore: decorator
25
+ @inline const XXH32_P3: u32 = 3266489917;
26
+ // @ts-ignore: decorator
27
+ @inline const XXH32_P4: u32 = 668265263;
28
+ // @ts-ignore: decorator
29
+ @inline const XXH32_P5: u32 = 374761393;
30
+ // @ts-ignore: decorator
31
+ @inline const XXH32_SEED: u32 = 0;
32
+
33
+ // @ts-ignore: decorator
34
+ @inline
35
+ function hash32(key: u32, len: u32 = 4): u32 {
36
+ let h: u32 = XXH32_SEED + XXH32_P5 + len;
37
+ h += key * XXH32_P3;
38
+ h = rotl(h, 17) * XXH32_P4;
39
+ h ^= h >> 15;
40
+ h *= XXH32_P2;
41
+ h ^= h >> 13;
42
+ h *= XXH32_P3;
43
+ h ^= h >> 16;
44
+ return h;
45
+ }
46
+
47
+ // @ts-ignore: decorator
48
+ @inline
49
+ function hash64(key: u64): u32 {
50
+ let h: u32 = XXH32_SEED + XXH32_P5 + 8;
51
+ h += <u32>key * XXH32_P3;
52
+ h = rotl(h, 17) * XXH32_P4;
53
+ h += <u32>(key >> 32) * XXH32_P3;
54
+ h = rotl(h, 17) * XXH32_P4;
55
+ h ^= h >> 15;
56
+ h *= XXH32_P2;
57
+ h ^= h >> 13;
58
+ h *= XXH32_P3;
59
+ h ^= h >> 16;
60
+ return h;
61
+ }
62
+
63
+ // @ts-ignore: decorator
64
+ @inline
65
+ function mix(h: u32, key: u32): u32 {
66
+ return rotl(h + key * XXH32_P2, 13) * XXH32_P1;
67
+ }
68
+
69
+ // @ts-ignore: decorator
70
+ @inline
71
+ function hashStr(key: string): u32 {
72
+ if (changetype<usize>(key) == 0) return XXH32_SEED;
73
+
74
+ let h: u32 = key.length << 1;
75
+ let len: usize = h;
76
+ let pos = changetype<usize>(key);
77
+
78
+ if (len >= 16) {
79
+ let s1 = XXH32_SEED + XXH32_P1 + XXH32_P2;
80
+ let s2 = XXH32_SEED + XXH32_P2;
81
+ let s3 = XXH32_SEED;
82
+ let s4 = XXH32_SEED - XXH32_P1;
83
+
84
+ let end = len + pos - 16;
85
+ while (pos <= end) {
86
+ s1 = mix(s1, load<u32>(pos));
87
+ s2 = mix(s2, load<u32>(pos, 4));
88
+ s3 = mix(s3, load<u32>(pos, 8));
89
+ s4 = mix(s4, load<u32>(pos, 12));
90
+ pos += 16;
91
+ }
92
+ h += rotl(s1, 1) + rotl(s2, 7) + rotl(s3, 12) + rotl(s4, 18);
93
+ } else {
94
+ h += XXH32_SEED + XXH32_P5;
95
+ }
96
+
97
+ let end = changetype<usize>(key) + len - 4;
98
+ while (pos <= end) {
99
+ h += load<u32>(pos) * XXH32_P3;
100
+ h = rotl(h, 17) * XXH32_P4;
101
+ pos += 4;
102
+ }
103
+
104
+ end = changetype<usize>(key) + len;
105
+ while (pos < end) {
106
+ h += <u32>load<u8>(pos) * XXH32_P5;
107
+ h = rotl(h, 11) * XXH32_P1;
108
+ pos++;
109
+ }
110
+
111
+ h ^= h >> 15;
112
+ h *= XXH32_P2;
113
+ h ^= h >> 13;
114
+ h *= XXH32_P3;
115
+ h ^= h >> 16;
116
+ return h;
117
+ }