From 2b268faf064f77b50fac40f562230f0a9b428083 Mon Sep 17 00:00:00 2001 From: Max Graey Date: Wed, 23 Jun 2021 12:09:31 +0300 Subject: [PATCH] (chore) Update dependencies (#69) --- build/release/bignum.wasm | Bin 30620 -> 31627 bytes build/release/bignum.wasm.map | 2 +- build/release/bignum.wat | 1178 +++++++++++++++++++++------------ package.json | 8 +- yarn.lock | 333 +++++++--- 5 files changed, 973 insertions(+), 548 deletions(-) diff --git a/build/release/bignum.wasm b/build/release/bignum.wasm index c9191fa53ada8033fea9a2b7d54ecd72dbebbc2d..50563853c6ba4bb27934b5ec62d92763624747ae 100644 GIT binary patch delta 8040 zcmbtZ4|r77mB07BnPg_(Oy=c(0vKKf0^wgE;m>9vNZw$gK}Zw`DhMQm0VX6FGBW`t zhCCERy5d6jc6VuuirTKW)vh`%T1#8|A1m0@>K3 z`+XZe?woV(x#ym9?m53XkQ2Y95B{DWt2Sg~bd(xh6c@=DC0$++a1n60F@noJSY*R6 zNS6mz12_-Y8s$=CQB1%BE^vI5uOnU5pnTcacNj^b)Ma3mVQ7BdN(4^N(NGU4#SqoiIRe&V%pl!b7b1L7H57M%7_6gcp zswf80gSdonDNypy&A!NfPFK?(u?5ndvtOr0@%o0wDe1(Tbay)56V0S!De_}lXi7Wd z1L;ORne5JxH`wD+2Yoa9pOQzSz3lfM&G;AU8^Y76SeooqEV6CU0@7!5oxt_mT-*Ex zGGKF^z$FA1Ppyw76J(b#IFLw_K|$_Hq)5Ffjcq4Mp}s2_Ya3YCL)O^rO|c%bI>>#1 zBk8t*9+Glc+)bO#4kpP4aV(u^Ygo95?6tT~yrv{tt*ndo1W=Jwu1dxk0F z`B^M3KpmbT;Q>F>28T(LYajU~;zrcRT3G6^n9Lg;7SpuM#X_E%1-pqK23~izG2c<= zDxUG>ETuEu>|fDB40=*_Hef5AFd`ZnTO!;;EMYUFi(DIiK4|B*`tj zV(Rt+*(S*DfvsePAX7W~$gLKcBrExA*QItOHxH4Oer_U}NcWLdHk~Bx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XVECJF8&fA`?B&;`j{p2RD%Ex}V|V(AsW zJKGw%Dw*+ezHekM{~$Y~^jx{Bti^LLl&dc*i_tA!I$X~6VSlcAcpB6`5>;UyGoFd6 zlS|ND1P9iM|4U1MNO?9!j~bYm_o8TWRq&CR3R_X1zdEu}yDFLS3bl>my^Z%}tGRK{ Gn*Rm$6^9W3 diff --git a/build/release/bignum.wasm.map b/build/release/bignum.wasm.map index 2c063a5..55efcdf 100644 --- a/build/release/bignum.wasm.map +++ b/build/release/bignum.wasm.map @@ -1 +1 @@ -{"version":3,"sources":["~lib/rt/common.ts","~lib/util/number.ts","~lib/util/math.ts","~lib/util/string.ts","~lib/rt/stub.ts","~lib/util/error.ts","assembly/integer/i128.ts","~lib/builtins.ts","assembly/utils.ts","~lib/string.ts","assembly/integer/u128.ts","~lib/array.ts","assembly/globals.ts","~lib/typedarray.ts","~lib/polyfills.ts","~lib/memory.ts","~lib/util/memory.ts","~lib/arraybuffer.ts","assembly/integer/i256.ts","assembly/integer/u256.ts","assembly/integer/safe/u128.ts"],"names":[],"mappings":"06LIqFE,AAAI,EAAO,SAAgC,eArD3C,AAAI,AAsDc,AAAkB,EAAlB,KAtDP,SAA+B,cAlB1C,AAAI,AAsBY,AAFN,AADE,IACO,KAEG,AADJ,AATV,AAAC,KAAmC,GAAY,QAZxC,AADA,AAAC,AAAC,AADA,IACsB,GAAM,GAAW,QAIvD,AAAI,AAAY,AADM,EAAa,AADjB,AAAO,AAAC,EAAY,GAAY,KAAU,KAAa,aAE1C,KAC7B,AAAI,AAAY,IAAe,SAGnC,AAAS,IAgBT,OAmDA,AADA,AAAa,AAAmB,EAAM,UAEtC,OACA,OACA,OACO,EAAM,8DEzEqB,EAiJf,EACA,OAjJe,EAAgB,EAiJ/B,OAhJe,EAAgB,EAAG,gBACnB,EAAgB,EAAe,yDE8GjE,AAAI,EAAa,EAAQ,GAArB,EAAQ,MACM,iBAGlB,AAAI,AAAC,AADK,ACtFD,AAAmB,EAA0B,MAA0B,Q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,YACvD,EAAS,SAEJ,WXngBX,AAAW,MKvGH,OLuGW,QACnB,AAAW,EAAQ,QACnB,AAAW,EAAQ,QACnB,AAAW,EAAQ,QAEnB,AAAa,KAER,AAAQ,OAAY,EAAK,KAExB,AADJ,AAAqC,IAAhC,OAAS,EAAO,KAAK,SAC1B,AAAoB,EAAc,AAAiB,EAAO,cAF1B,oCFwCf,KACA,qDY3JC,KACA,KACA,KACA,mDR4KD,KACA,qDSvCC,KACA,KACA,KACA,oDT1GlB,EAAgB,KAAW,gCAwN3B,OAAW,AAAI,AADL,AADD,OACM,KACM,QACrB,kCAVA,OAAW,AAAI,AADL,AADD,OACM,KACM,QACrB","sourceRoot":"./bignum.wasm","sourcesContent":["// Alignment guarantees\n\n// @ts-ignore: decorator\n@inline export const AL_BITS: u32 = 4; // 16 bytes to fit up to v128\n// @ts-ignore: decorator\n@inline export const AL_SIZE: usize = 1 << AL_BITS;\n// @ts-ignore: decorator\n@inline export const AL_MASK: usize = AL_SIZE - 1;\n\n// Extra debugging\n\n// @ts-ignore: decorator\n@inline export const DEBUG = true;\n// @ts-ignore: decorator\n@inline export const TRACE = false;\n// @ts-ignore: decorator\n@inline export const RTRACE = isDefined(ASC_RTRACE);\n// @ts-ignore: decorator\n@inline export const PROFILE = isDefined(ASC_PROFILE);\n\n// Memory manager\n\n// ╒════════════ Memory manager block layout (32-bit) ═════════════╕\n// 3 2 1\n// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 bits\n// ├─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┤\n// │ MM info │ -4\n// ╞>ptr═══════════════════════════════════════════════════════════╡\n// │ ... │\n@unmanaged export class BLOCK {\n /** Memory manager info. */\n mmInfo: usize;\n}\n\n/** Overhead of a memory manager block. */\n// @ts-ignore: decorator\n@inline export const BLOCK_OVERHEAD: usize = offsetof();\n\n/** Maximum size of a memory manager block's payload. */\n// @ts-ignore: decorator\n@inline export const BLOCK_MAXSIZE: usize = (1 << 30) - BLOCK_OVERHEAD;\n\n// Garbage collector\n\n// ╒══════════ Garbage collector object layout (32-bit) ═══════════╕\n// 3 2 1\n// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 bits\n// ├─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┤\n// │ Memory manager block │ -20\n// ╞═══════════════════════════════════════════════════════════════╡\n// │ GC info │ -16\n// ├───────────────────────────────────────────────────────────────┤\n// │ GC info │ -12\n// ├───────────────────────────────────────────────────────────────┤\n// │ RT id │ -8\n// ├───────────────────────────────────────────────────────────────┤\n// │ RT size │ -4\n// ╞>ptr═══════════════════════════════════════════════════════════╡\n// │ ... │\n@unmanaged export class OBJECT extends BLOCK {\n /** Garbage collector info. */\n gcInfo: u32;\n /** Garbage collector info. */\n gcInfo2: u32;\n /** Runtime class id. */\n rtId: u32;\n /** Runtime object size. */\n rtSize: u32;\n}\n\n/** Overhead of a garbage collector object. Excludes memory manager block overhead. */\n// @ts-ignore: decorator\n@inline export const OBJECT_OVERHEAD: usize = (offsetof() - BLOCK_OVERHEAD + AL_MASK) & ~AL_MASK;\n\n/** Maximum size of a garbage collector object's payload. */\n// @ts-ignore: decorator\n@inline export const OBJECT_MAXSIZE: usize = BLOCK_MAXSIZE - OBJECT_OVERHEAD;\n\n/** Total of memory manager and garbage collector overhead. */\n// @ts-ignore: decorator\n@inline export const TOTAL_OVERHEAD: usize = BLOCK_OVERHEAD + OBJECT_OVERHEAD;\n","/// \n\nimport { idof } from \"../builtins\";\nimport { CharCode } from \"./string\";\n\n// @ts-ignore: decorator\n@inline\nexport const MAX_DOUBLE_LENGTH = 28;\n\n// @ts-ignore: decorator\n@lazy @inline const POWERS10 = memory.data([\n 1,\n 10,\n 100,\n 1000,\n 10000,\n 100000,\n 1000000,\n 10000000,\n 100000000,\n 1000000000\n]);\n\n/*\n Lookup table for pairwise char codes in range [0-99]\n\n \"00\", \"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\",\n \"10\", \"11\", \"12\", \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", \"19\",\n \"20\", \"21\", \"22\", \"23\", \"24\", \"25\", \"26\", \"27\", \"28\", \"29\",\n \"30\", \"31\", \"32\", \"33\", \"34\", \"35\", \"36\", \"37\", \"38\", \"39\",\n \"40\", \"41\", \"42\", \"43\", \"44\", \"45\", \"46\", \"47\", \"48\", \"49\",\n \"50\", \"51\", \"52\", \"53\", \"54\", \"55\", \"56\", \"57\", \"58\", \"59\",\n \"60\", \"61\", \"62\", \"63\", \"64\", \"65\", \"66\", \"67\", \"68\", \"69\",\n \"70\", \"71\", \"72\", \"73\", \"74\", \"75\", \"76\", \"77\", \"78\", \"79\",\n \"80\", \"81\", \"82\", \"83\", \"84\", \"85\", \"86\", \"87\", \"88\", \"89\",\n \"90\", \"91\", \"92\", \"93\", \"94\", \"95\", \"96\", \"97\", \"98\", \"99\"\n*/\n// @ts-ignore: decorator\n@lazy @inline const DIGITS = memory.data([\n 0x00300030, 0x00310030, 0x00320030, 0x00330030, 0x00340030,\n 0x00350030, 0x00360030, 0x00370030, 0x00380030, 0x00390030,\n 0x00300031, 0x00310031, 0x00320031, 0x00330031, 0x00340031,\n 0x00350031, 0x00360031, 0x00370031, 0x00380031, 0x00390031,\n 0x00300032, 0x00310032, 0x00320032, 0x00330032, 0x00340032,\n 0x00350032, 0x00360032, 0x00370032, 0x00380032, 0x00390032,\n 0x00300033, 0x00310033, 0x00320033, 0x00330033, 0x00340033,\n 0x00350033, 0x00360033, 0x00370033, 0x00380033, 0x00390033,\n 0x00300034, 0x00310034, 0x00320034, 0x00330034, 0x00340034,\n 0x00350034, 0x00360034, 0x00370034, 0x00380034, 0x00390034,\n 0x00300035, 0x00310035, 0x00320035, 0x00330035, 0x00340035,\n 0x00350035, 0x00360035, 0x00370035, 0x00380035, 0x00390035,\n 0x00300036, 0x00310036, 0x00320036, 0x00330036, 0x00340036,\n 0x00350036, 0x00360036, 0x00370036, 0x00380036, 0x00390036,\n 0x00300037, 0x00310037, 0x00320037, 0x00330037, 0x00340037,\n 0x00350037, 0x00360037, 0x00370037, 0x00380037, 0x00390037,\n 0x00300038, 0x00310038, 0x00320038, 0x00330038, 0x00340038,\n 0x00350038, 0x00360038, 0x00370038, 0x00380038, 0x00390038,\n 0x00300039, 0x00310039, 0x00320039, 0x00330039, 0x00340039,\n 0x00350039, 0x00360039, 0x00370039, 0x00380039, 0x00390039\n]);\n\n// Lookup table for pairwise char codes in range [0x00-0xFF]\n// @ts-ignore: decorator\n@lazy @inline const HEX_DIGITS =\n\"000102030405060708090a0b0c0d0e0f\\\n101112131415161718191a1b1c1d1e1f\\\n202122232425262728292a2b2c2d2e2f\\\n303132333435363738393a3b3c3d3e3f\\\n404142434445464748494a4b4c4d4e4f\\\n505152535455565758595a5b5c5d5e5f\\\n606162636465666768696a6b6c6d6e6f\\\n707172737475767778797a7b7c7d7e7f\\\n808182838485868788898a8b8c8d8e8f\\\n909192939495969798999a9b9c9d9e9f\\\na0a1a2a3a4a5a6a7a8a9aaabacadaeaf\\\nb0b1b2b3b4b5b6b7b8b9babbbcbdbebf\\\nc0c1c2c3c4c5c6c7c8c9cacbcccdcecf\\\nd0d1d2d3d4d5d6d7d8d9dadbdcdddedf\\\ne0e1e2e3e4e5e6e7e8e9eaebecedeeef\\\nf0f1f2f3f4f5f6f7f8f9fafbfcfdfeff\";\n\n// @ts-ignore: decorator\n@lazy @inline const ANY_DIGITS = \"0123456789abcdefghijklmnopqrstuvwxyz\";\n\n// @ts-ignore: decorator\n@lazy @inline const EXP_POWERS = memory.data([/* eslint-disable indent */\n -1220, -1193, -1166, -1140, -1113, -1087, -1060, -1034, -1007, -980,\n -954, -927, -901, -874, -847, -821, -794, -768, -741, -715,\n -688, -661, -635, -608, -582, -555, -529, -502, -475, -449,\n -422, -396, -369, -343, -316, -289, -263, -236, -210, -183,\n -157, -130, -103, -77, -50, -24, 3, 30, 56, 83,\n 109, 136, 162, 189, 216, 242, 269, 295, 322, 348,\n 375, 402, 428, 455, 481, 508, 534, 561, 588, 614,\n 641, 667, 694, 720, 747, 774, 800, 827, 853, 880,\n 907, 933, 960, 986, 1013, 1039, 1066\n/* eslint-enable indent */]);\n\n// 1e-348, 1e-340, ..., 1e340\n// @ts-ignore: decorator\n@lazy @inline const FRC_POWERS = memory.data([\n 0xFA8FD5A0081C0288, 0xBAAEE17FA23EBF76, 0x8B16FB203055AC76, 0xCF42894A5DCE35EA,\n 0x9A6BB0AA55653B2D, 0xE61ACF033D1A45DF, 0xAB70FE17C79AC6CA, 0xFF77B1FCBEBCDC4F,\n 0xBE5691EF416BD60C, 0x8DD01FAD907FFC3C, 0xD3515C2831559A83, 0x9D71AC8FADA6C9B5,\n 0xEA9C227723EE8BCB, 0xAECC49914078536D, 0x823C12795DB6CE57, 0xC21094364DFB5637,\n 0x9096EA6F3848984F, 0xD77485CB25823AC7, 0xA086CFCD97BF97F4, 0xEF340A98172AACE5,\n 0xB23867FB2A35B28E, 0x84C8D4DFD2C63F3B, 0xC5DD44271AD3CDBA, 0x936B9FCEBB25C996,\n 0xDBAC6C247D62A584, 0xA3AB66580D5FDAF6, 0xF3E2F893DEC3F126, 0xB5B5ADA8AAFF80B8,\n 0x87625F056C7C4A8B, 0xC9BCFF6034C13053, 0x964E858C91BA2655, 0xDFF9772470297EBD,\n 0xA6DFBD9FB8E5B88F, 0xF8A95FCF88747D94, 0xB94470938FA89BCF, 0x8A08F0F8BF0F156B,\n 0xCDB02555653131B6, 0x993FE2C6D07B7FAC, 0xE45C10C42A2B3B06, 0xAA242499697392D3,\n 0xFD87B5F28300CA0E, 0xBCE5086492111AEB, 0x8CBCCC096F5088CC, 0xD1B71758E219652C,\n 0x9C40000000000000, 0xE8D4A51000000000, 0xAD78EBC5AC620000, 0x813F3978F8940984,\n 0xC097CE7BC90715B3, 0x8F7E32CE7BEA5C70, 0xD5D238A4ABE98068, 0x9F4F2726179A2245,\n 0xED63A231D4C4FB27, 0xB0DE65388CC8ADA8, 0x83C7088E1AAB65DB, 0xC45D1DF942711D9A,\n 0x924D692CA61BE758, 0xDA01EE641A708DEA, 0xA26DA3999AEF774A, 0xF209787BB47D6B85,\n 0xB454E4A179DD1877, 0x865B86925B9BC5C2, 0xC83553C5C8965D3D, 0x952AB45CFA97A0B3,\n 0xDE469FBD99A05FE3, 0xA59BC234DB398C25, 0xF6C69A72A3989F5C, 0xB7DCBF5354E9BECE,\n 0x88FCF317F22241E2, 0xCC20CE9BD35C78A5, 0x98165AF37B2153DF, 0xE2A0B5DC971F303A,\n 0xA8D9D1535CE3B396, 0xFB9B7CD9A4A7443C, 0xBB764C4CA7A44410, 0x8BAB8EEFB6409C1A,\n 0xD01FEF10A657842C, 0x9B10A4E5E9913129, 0xE7109BFBA19C0C9D, 0xAC2820D9623BF429,\n 0x80444B5E7AA7CF85, 0xBF21E44003ACDD2D, 0x8E679C2F5E44FF8F, 0xD433179D9C8CB841,\n 0x9E19DB92B4E31BA9, 0xEB96BF6EBADF77D9, 0xAF87023B9BF0EE6B\n]);\n\n// @ts-ignore: decorator\n@inline\nexport function isPowerOf2(value: T): bool {\n return popcnt(value) == 1;\n}\n\n// Count number of decimals for u32 values\n// In our case input value always non-zero so we can simplify some parts\nexport function decimalCount32(value: u32): u32 {\n if (value < 100000) {\n if (value < 100) {\n return 1 + u32(value >= 10);\n } else {\n return 3 + u32(value >= 10000) + u32(value >= 1000);\n }\n } else {\n if (value < 10000000) {\n return 6 + u32(value >= 1000000);\n } else {\n return 8 + u32(value >= 1000000000) + u32(value >= 100000000);\n }\n }\n}\n\n// Count number of decimals for u64 values\n// In our case input value always greater than 2^32-1 so we can skip some parts\nexport function decimalCount64High(value: u64): u32 {\n if (value < 1000000000000000) {\n if (value < 1000000000000) {\n return 10 + u32(value >= 100000000000) + u32(value >= 10000000000);\n } else {\n return 13 + u32(value >= 100000000000000) + u32(value >= 10000000000000);\n }\n } else {\n if (value < 100000000000000000) {\n return 16 + u32(value >= 10000000000000000);\n } else {\n return 18 + u32(value >= 10000000000000000000) + u32(value >= 1000000000000000000);\n }\n }\n}\n\nfunction ulog_base(num: u64, base: i32): u32 {\n if (isPowerOf2(base)) {\n return (63 - clz(num)) / (31 - clz(base)) + 1;\n }\n var b64 = u64(base), b = b64, e: u32 = 1;\n while (num >= b) {\n num /= b;\n b *= b;\n e <<= 1;\n }\n while (num >= 1) {\n num /= b64;\n e++;\n }\n return e - 1;\n}\n\nfunction utoa32_dec_lut(buffer: usize, num: u32, offset: usize): void {\n while (num >= 10000) {\n // in most VMs i32/u32 div and modulo by constant can be shared and simplificate\n let t = num / 10000;\n let r = num % 10000;\n num = t;\n\n let d1 = r / 100;\n let d2 = r % 100;\n\n let digits1 = load(DIGITS + (d1 << alignof()));\n let digits2 = load(DIGITS + (d2 << alignof()));\n\n offset -= 4;\n store(buffer + (offset << 1), digits1 | (digits2 << 32));\n }\n\n if (num >= 100) {\n let t = num / 100;\n let d1 = num % 100;\n num = t;\n offset -= 2;\n let digits = load(DIGITS + (d1 << alignof()));\n store(buffer + (offset << 1), digits);\n }\n\n if (num >= 10) {\n offset -= 2;\n let digits = load(DIGITS + (num << alignof()));\n store(buffer + (offset << 1), digits);\n } else {\n offset -= 1;\n let digit = CharCode._0 + num;\n store(buffer + (offset << 1), digit);\n }\n}\n\nfunction utoa64_dec_lut(buffer: usize, num: u64, offset: usize): void {\n while (num >= 100000000) {\n let t = num / 100000000;\n let r = (num - t * 100000000);\n num = t;\n\n let b = r / 10000;\n let c = r % 10000;\n\n let b1 = b / 100;\n let b2 = b % 100;\n let c1 = c / 100;\n let c2 = c % 100;\n\n let digits1 = load(DIGITS + (c1 << alignof()));\n let digits2 = load(DIGITS + (c2 << alignof()));\n\n offset -= 4;\n store(buffer + (offset << 1), digits1 | (digits2 << 32));\n\n digits1 = load(DIGITS + (b1 << alignof()));\n digits2 = load(DIGITS + (b2 << alignof()));\n\n offset -= 4;\n store(buffer + (offset << 1), digits1 | (digits2 << 32));\n }\n\n utoa32_dec_lut(buffer, num, offset);\n}\n\nfunction utoa_hex_lut(buffer: usize, num: u64, offset: usize): void {\n const lut = changetype(HEX_DIGITS);\n while (offset >= 2) {\n offset -= 2;\n store(\n buffer + (offset << 1),\n load(lut + ((num & 0xFF) << alignof()))\n );\n num >>= 8;\n }\n if (offset & 1) {\n store(buffer, load(lut + (num << 6)));\n }\n}\n\nfunction utoa_dec_simple(buffer: usize, num: T, offset: usize): void {\n do {\n let t = num / 10;\n let r = (num % 10);\n num = changetype(t);\n offset--;\n store(buffer + (offset << 1), CharCode._0 + r);\n } while (num);\n}\n\nfunction utoa_hex_simple(buffer: usize, num: T, offset: usize): void {\n do {\n let d = num & 0x0F | CharCode._0;\n d += select(0x27, 0, d > CharCode._9);\n offset--;\n store(buffer + (offset << 1), d);\n // @ts-ignore: type\n num >>= 4;\n } while (num);\n}\n\n// @ts-ignore: decorator\n@inline\nexport function utoa32_dec_core(buffer: usize, num: u32, offset: usize): void {\n if (ASC_SHRINK_LEVEL >= 1) {\n utoa_dec_simple(buffer, num, offset);\n } else {\n utoa32_dec_lut(buffer, num, offset);\n }\n}\n\n// @ts-ignore: decorator\n@inline\nfunction utoa32_hex_core(buffer: usize, num: u32, offset: usize): void {\n if (ASC_SHRINK_LEVEL >= 1) {\n utoa_hex_simple(buffer, num, offset);\n } else {\n utoa_hex_lut(buffer, num, offset);\n }\n}\n\n// @ts-ignore: decorator\n@inline\nfunction utoa64_dec_core(buffer: usize, num: u64, offset: usize): void {\n if (ASC_SHRINK_LEVEL >= 1) {\n utoa_dec_simple(buffer, num, offset);\n } else {\n utoa64_dec_lut(buffer, num, offset);\n }\n}\n\n// @ts-ignore: decorator\n@inline\nfunction utoa64_hex_core(buffer: usize, num: u64, offset: usize): void {\n if (ASC_SHRINK_LEVEL >= 1) {\n utoa_hex_simple(buffer, num, offset);\n } else {\n utoa_hex_lut(buffer, num, offset);\n }\n}\n\nfunction utoa64_any_core(buffer: usize, num: u64, offset: usize, radix: i32): void {\n const lut = changetype(ANY_DIGITS);\n var base = u64(radix);\n if ((radix & (radix - 1)) == 0) { // for radix which pow of two\n let shift = u64(ctz(radix) & 7);\n let mask = base - 1;\n do {\n offset--;\n store(buffer + (offset << 1), load(lut + (usize(num & mask) << 1)));\n num >>= shift;\n } while (num);\n } else {\n do {\n offset--;\n let q = num / base;\n store(buffer + (offset << 1), load(lut + (usize(num - q * base) << 1)));\n num = q;\n } while (num);\n }\n}\n\nexport function utoa32(value: u32, radix: i32): String {\n if (radix < 2 || radix > 36) {\n throw new RangeError(\"toString() radix argument must be between 2 and 36\");\n }\n if (!value) return \"0\";\n var out: String;\n\n if (radix == 10) {\n let decimals = decimalCount32(value);\n out = changetype(__new(decimals << 1, idof()));\n utoa32_dec_core(changetype(out), value, decimals);\n } else if (radix == 16) {\n let decimals = (31 - clz(value) >> 2) + 1;\n out = changetype(__new(decimals << 1, idof()));\n utoa32_hex_core(changetype(out), value, decimals);\n } else {\n let decimals = ulog_base(value, radix);\n out = changetype(__new(decimals << 1, idof()));\n utoa64_any_core(changetype(out), value, decimals, radix);\n }\n return out;\n}\n\nexport function itoa32(value: i32, radix: i32): String {\n if (radix < 2 || radix > 36) {\n throw new RangeError(\"toString() radix argument must be between 2 and 36\");\n }\n if (!value) return \"0\";\n\n var sign = value >>> 31;\n if (sign) value = -value;\n var out: String;\n\n if (radix == 10) {\n let decimals = decimalCount32(value) + sign;\n out = changetype(__new(decimals << 1, idof()));\n utoa32_dec_core(changetype(out), value, decimals);\n } else if (radix == 16) {\n let decimals = (31 - clz(value) >> 2) + 1 + sign;\n out = changetype(__new(decimals << 1, idof()));\n utoa32_hex_core(changetype(out), value, decimals);\n } else {\n let val32 = u32(value);\n let decimals = ulog_base(val32, radix) + sign;\n out = changetype(__new(decimals << 1, idof()));\n utoa64_any_core(changetype(out), val32, decimals, radix);\n }\n if (sign) store(changetype(out), CharCode.MINUS);\n return out;\n}\n\nexport function utoa64(value: u64, radix: i32): String {\n if (radix < 2 || radix > 36) {\n throw new RangeError(\"toString() radix argument must be between 2 and 36\");\n }\n if (!value) return \"0\";\n var out: String;\n\n if (radix == 10) {\n if (value <= u32.MAX_VALUE) {\n let val32 = value;\n let decimals = decimalCount32(val32);\n out = changetype(__new(decimals << 1, idof()));\n utoa32_dec_core(changetype(out), val32, decimals);\n } else {\n let decimals = decimalCount64High(value);\n out = changetype(__new(decimals << 1, idof()));\n utoa64_dec_core(changetype(out), value, decimals);\n }\n } else if (radix == 16) {\n let decimals = (63 - u32(clz(value)) >> 2) + 1;\n out = changetype(__new(decimals << 1, idof()));\n utoa64_hex_core(changetype(out), value, decimals);\n } else {\n let decimals = ulog_base(value, radix);\n out = changetype(__new(decimals << 1, idof()));\n utoa64_any_core(changetype(out), value, decimals, radix);\n }\n return out;\n}\n\nexport function itoa64(value: i64, radix: i32): String {\n if (radix < 2 || radix > 36) {\n throw new RangeError(\"toString() radix argument must be between 2 and 36\");\n }\n if (!value) return \"0\";\n\n var sign = u32(value >>> 63);\n if (sign) value = -value;\n var out: String;\n\n if (radix == 10) {\n if (value <= u32.MAX_VALUE) {\n let val32 = value;\n let decimals = decimalCount32(val32) + sign;\n out = changetype(__new(decimals << 1, idof()));\n utoa32_dec_core(changetype(out), val32, decimals);\n } else {\n let decimals = decimalCount64High(value) + sign;\n out = changetype(__new(decimals << 1, idof()));\n utoa64_dec_core(changetype(out), value, decimals);\n }\n } else if (radix == 16) {\n let decimals = (63 - u32(clz(value)) >> 2) + 1 + sign;\n out = changetype(__new(decimals << 1, idof()));\n utoa64_hex_core(changetype(out), value, decimals);\n } else {\n let decimals = ulog_base(value, radix) + sign;\n out = changetype(__new(decimals << 1, idof()));\n utoa64_any_core(changetype(out), value, decimals, radix);\n }\n if (sign) store(changetype(out), CharCode.MINUS);\n return out;\n}\n\n// @ts-ignore: decorator\n@lazy var _K: i32 = 0;\n\n// // @ts-ignore: decorator\n// @lazy\n// var _frc: u64 = 0;\n\n// @ts-ignore: decorator\n@lazy var _exp: i32 = 0;\n\n// @ts-ignore: decorator\n@lazy var _frc_minus: u64 = 0;\n\n// @ts-ignore: decorator\n@lazy var _frc_plus: u64 = 0;\n\n// @ts-ignore: decorator\n@lazy var _frc_pow: u64 = 0;\n\n// @ts-ignore: decorator\n@lazy var _exp_pow: i32 = 0;\n\n// @ts-ignore: decorator\n@inline\nfunction umul64f(u: u64, v: u64): u64 {\n var u0 = u & 0xFFFFFFFF;\n var v0 = v & 0xFFFFFFFF;\n\n var u1 = u >> 32;\n var v1 = v >> 32;\n\n var l = u0 * v0;\n var t = u1 * v0 + (l >> 32);\n var w = u0 * v1 + (t & 0xFFFFFFFF);\n\n w += 0x7FFFFFFF; // rounding\n\n t >>= 32;\n w >>= 32;\n\n return u1 * v1 + t + w;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction umul64e(e1: i32, e2: i32): i32 {\n return e1 + e2 + 64; // where 64 is significand size\n}\n\n// @ts-ignore: decorator\n@inline\nfunction normalizedBoundaries(f: u64, e: i32): void {\n var frc = (f << 1) + 1;\n var exp = e - 1;\n var off = clz(frc);\n frc <<= off;\n exp -= off;\n\n var m = 1 + i32(f == 0x0010000000000000);\n\n _frc_plus = frc;\n _frc_minus = ((f << m) - 1) << e - m - exp;\n _exp = exp;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction grisuRound(buffer: usize, len: i32, delta: u64, rest: u64, ten_kappa: u64, wp_w: u64): void {\n var lastp = buffer + ((len - 1) << 1);\n var digit = load(lastp);\n while (\n rest < wp_w &&\n delta - rest >= ten_kappa && (\n rest + ten_kappa < wp_w ||\n wp_w - rest > rest + ten_kappa - wp_w\n )\n ) {\n --digit;\n rest += ten_kappa;\n }\n store(lastp, digit);\n}\n\n// @ts-ignore: decorator\n@inline\nfunction getCachedPower(minExp: i32): void {\n const c = reinterpret(0x3FD34413509F79FE); // 1 / lg(10) = 0.30102999566398114\n var dk = (-61 - minExp) * c + 347;\t // dk must be positive, so can do ceiling in positive\n var k = dk;\n k += i32(k != dk); // conversion with ceil\n\n var index = (k >> 3) + 1;\n _K = 348 - (index << 3);\t// decimal exponent no need lookup table\n _frc_pow = load(FRC_POWERS + (index << alignof()));\n _exp_pow = load(EXP_POWERS + (index << alignof()));\n}\n\n// @ts-ignore: decorator\n@inline\nfunction grisu2(value: f64, buffer: usize, sign: i32): i32 {\n\n // frexp routine\n var uv = reinterpret(value);\n var exp = i32((uv & 0x7FF0000000000000) >>> 52);\n var sid = uv & 0x000FFFFFFFFFFFFF;\n var frc = (u64(exp != 0) << 52) + sid;\n exp = select(exp, 1, exp) - (0x3FF + 52);\n\n normalizedBoundaries(frc, exp);\n getCachedPower(_exp);\n\n // normalize\n var off = clz(frc);\n frc <<= off;\n exp -= off;\n\n var frc_pow = _frc_pow;\n var exp_pow = _exp_pow;\n\n var w_frc = umul64f(frc, frc_pow);\n var w_exp = umul64e(exp, exp_pow);\n\n var wp_frc = umul64f(_frc_plus, frc_pow) - 1;\n var wp_exp = umul64e(_exp, exp_pow);\n\n var wm_frc = umul64f(_frc_minus, frc_pow) + 1;\n var delta = wp_frc - wm_frc;\n\n return genDigits(buffer, w_frc, w_exp, wp_frc, wp_exp, delta, sign);\n}\n\nfunction genDigits(buffer: usize, w_frc: u64, w_exp: i32, mp_frc: u64, mp_exp: i32, delta: u64, sign: i32): i32 {\n var one_exp = -mp_exp;\n var one_frc = (1) << one_exp;\n var mask = one_frc - 1;\n\n var wp_w_frc = mp_frc - w_frc;\n\n var p1 = u32(mp_frc >> one_exp);\n var p2 = mp_frc & mask;\n\n var kappa = decimalCount32(p1);\n var len = sign;\n\n while (kappa > 0) {\n let d: u32;\n switch (kappa) {\n case 10: { d = p1 / 1000000000; p1 %= 1000000000; break; }\n case 9: { d = p1 / 100000000; p1 %= 100000000; break; }\n case 8: { d = p1 / 10000000; p1 %= 10000000; break; }\n case 7: { d = p1 / 1000000; p1 %= 1000000; break; }\n case 6: { d = p1 / 100000; p1 %= 100000; break; }\n case 5: { d = p1 / 10000; p1 %= 10000; break; }\n case 4: { d = p1 / 1000; p1 %= 1000; break; }\n case 3: { d = p1 / 100; p1 %= 100; break; }\n case 2: { d = p1 / 10; p1 %= 10; break; }\n case 1: { d = p1; p1 = 0; break; }\n default: { d = 0; break; }\n }\n\n if (d | len) store(buffer + (len++ << 1), CharCode._0 + d);\n\n --kappa;\n let tmp = ((p1) << one_exp) + p2;\n if (tmp <= delta) {\n _K += kappa;\n grisuRound(buffer, len, delta, tmp, load(POWERS10 + (kappa << alignof())) << one_exp, wp_w_frc);\n return len;\n }\n }\n\n while (true) {\n p2 *= 10;\n delta *= 10;\n\n let d = p2 >> one_exp;\n if (d | len) store(buffer + (len++ << 1), CharCode._0 + d);\n\n p2 &= mask;\n --kappa;\n if (p2 < delta) {\n _K += kappa;\n wp_w_frc *= load(POWERS10 + (-kappa << alignof()));\n grisuRound(buffer, len, delta, p2, one_frc, wp_w_frc);\n return len;\n }\n }\n}\n\n// @ts-ignore: decorator\n@inline\nfunction genExponent(buffer: usize, k: i32): i32 {\n var sign = k < 0;\n if (sign) k = -k;\n var decimals = decimalCount32(k) + 1;\n utoa32_dec_core(buffer, k, decimals);\n store(buffer, select(CharCode.MINUS, CharCode.PLUS, sign));\n return decimals;\n}\n\nfunction prettify(buffer: usize, length: i32, k: i32): i32 {\n if (!k) {\n store(buffer + (length << 1), CharCode.DOT | (CharCode._0 << 16));\n return length + 2;\n }\n\n var kk = length + k;\n if (length <= kk && kk <= 21) {\n // 1234e7 -> 12340000000\n for (let i = length; i < kk; ++i) {\n store(buffer + (i << 1), CharCode._0);\n }\n store(buffer + (kk << 1), CharCode.DOT | (CharCode._0 << 16));\n return kk + 2;\n } else if (kk > 0 && kk <= 21) {\n // 1234e-2 -> 12.34\n let ptr = buffer + (kk << 1);\n memory.copy(\n ptr + 2,\n ptr,\n -k << 1\n );\n store(buffer + (kk << 1), CharCode.DOT);\n return length + 1;\n } else if (-6 < kk && kk <= 0) {\n // 1234e-6 -> 0.001234\n let offset = 2 - kk;\n memory.copy(\n buffer + (offset << 1),\n buffer,\n length << 1\n );\n store(buffer, CharCode._0 | (CharCode.DOT << 16));\n for (let i = 2; i < offset; ++i) {\n store(buffer + (i << 1), CharCode._0);\n }\n return length + offset;\n } else if (length == 1) {\n // 1e30\n store(buffer, CharCode.e, 2);\n length = genExponent(buffer + 4, kk - 1);\n return length + 2;\n } else {\n let len = length << 1;\n memory.copy(\n buffer + 4,\n buffer + 2,\n len - 2\n );\n store(buffer, CharCode.DOT, 2);\n store(buffer + len, CharCode.e, 2);\n length += genExponent(buffer + len + 4, kk - 1);\n return length + 2;\n }\n}\n\nfunction dtoa_core(buffer: usize, value: f64): i32 {\n var sign = i32(value < 0);\n if (sign) {\n value = -value;\n store(buffer, CharCode.MINUS);\n }\n // assert(value > 0 && value <= 1.7976931348623157e308);\n var len = grisu2(value, buffer, sign);\n len = prettify(buffer + (sign << 1), len - sign, _K);\n return len + sign;\n}\n\n// @ts-ignore: decorator\n@lazy @inline const dtoa_buf = memory.data(MAX_DOUBLE_LENGTH << 1);\n\nexport function dtoa(value: f64): String {\n if (value == 0) return \"0.0\";\n if (!isFinite(value)) {\n if (isNaN(value)) return \"NaN\";\n return select(\"-Infinity\", \"Infinity\", value < 0);\n }\n var size = dtoa_core(dtoa_buf, value) << 1;\n var result = changetype(__new(size, idof()));\n memory.copy(changetype(result), dtoa_buf, size);\n return result;\n}\n\nexport function itoa_buffered(buffer: usize, value: T): u32 {\n var sign: u32 = 0;\n if (isSigned()) {\n sign = u32(value < 0);\n if (sign) {\n value = changetype(-value);\n store(buffer, CharCode.MINUS);\n }\n }\n if (ASC_SHRINK_LEVEL <= 1) {\n if (isSigned()) {\n if (sizeof() <= 4) {\n if (value < 10) {\n store(buffer + (sign << 1), value | CharCode._0);\n return 1 + sign;\n }\n } else {\n if (value < 10) {\n store(buffer + (sign << 1), value | CharCode._0);\n return 1 + sign;\n }\n }\n } else {\n if (value < 10) {\n store(buffer, value | CharCode._0);\n return 1;\n }\n }\n }\n var decimals = sign;\n if (sizeof() <= 4) {\n decimals += decimalCount32(value);\n utoa32_dec_core(buffer, value, decimals);\n } else {\n if (value <= u32.MAX_VALUE) {\n let val32 = value;\n decimals += decimalCount32(val32);\n utoa32_dec_core(buffer, val32, decimals);\n } else {\n decimals += decimalCount64High(value);\n utoa64_dec_core(buffer, value, decimals);\n }\n }\n return decimals;\n}\n\nexport function dtoa_buffered(buffer: usize, value: f64): u32 {\n if (value == 0) {\n store(buffer, CharCode._0);\n store(buffer, CharCode.DOT, 2);\n store(buffer, CharCode._0, 4);\n return 3;\n }\n if (!isFinite(value)) {\n if (isNaN(value)) {\n store(buffer, CharCode.N);\n store(buffer, CharCode.a, 2);\n store(buffer, CharCode.N, 4);\n return 3;\n } else {\n let sign = value < 0;\n if (sign) {\n store(buffer, CharCode.MINUS); // -\n buffer += 2;\n }\n store(buffer, 0x690066006E0049, 0); // ifnI\n store(buffer, 0x7900740069006E, 8); // ytin\n return 8 + u32(sign);\n }\n }\n return dtoa_core(buffer, value);\n}\n","//\n// Lookup data for exp2f\n//\n\n// @ts-ignore: decorator\n@inline const EXP2F_TABLE_BITS = 5;\n\n// @ts-ignore: decorator\n@lazy @inline const EXP2F_DATA_TAB = memory.data([\n // exp2f_data_tab[i] = uint(2^(i/N)) - (i << 52-BITS)\n // used for computing 2^(k/N) for an int |k| < 150 N as\n // double(tab[k%N] + (k << 52-BITS))\n 0x3FF0000000000000, 0x3FEFD9B0D3158574, 0x3FEFB5586CF9890F, 0x3FEF9301D0125B51,\n 0x3FEF72B83C7D517B, 0x3FEF54873168B9AA, 0x3FEF387A6E756238, 0x3FEF1E9DF51FDEE1,\n 0x3FEF06FE0A31B715, 0x3FEEF1A7373AA9CB, 0x3FEEDEA64C123422, 0x3FEECE086061892D,\n 0x3FEEBFDAD5362A27, 0x3FEEB42B569D4F82, 0x3FEEAB07DD485429, 0x3FEEA47EB03A5585,\n 0x3FEEA09E667F3BCD, 0x3FEE9F75E8EC5F74, 0x3FEEA11473EB0187, 0x3FEEA589994CCE13,\n 0x3FEEACE5422AA0DB, 0x3FEEB737B0CDC5E5, 0x3FEEC49182A3F090, 0x3FEED503B23E255D,\n 0x3FEEE89F995AD3AD, 0x3FEEFF76F2FB5E47, 0x3FEF199BDD85529C, 0x3FEF3720DCEF9069,\n 0x3FEF5818DCFBA487, 0x3FEF7C97337B9B5F, 0x3FEFA4AFA2A490DA, 0x3FEFD0765B6E4540\n]);\n\n// ULP error: 0.502 (nearest rounding.)\n// Relative error: 1.69 * 2^-34 in [-1/64, 1/64] (before rounding.)\n// Wrong count: 168353 (all nearest rounding wrong results with fma.)\n// @ts-ignore: decorator\n@inline\nexport function exp2f_lut(x: f32): f32 {\n const\n N = 1 << EXP2F_TABLE_BITS,\n N_MASK = N - 1,\n shift = reinterpret(0x4338000000000000) / N, // 0x1.8p+52\n Ox127f = reinterpret(0x7F000000);\n\n const\n C0 = reinterpret(0x3FAC6AF84B912394), // 0x1.c6af84b912394p-5\n C1 = reinterpret(0x3FCEBFCE50FAC4F3), // 0x1.ebfce50fac4f3p-3\n C2 = reinterpret(0x3FE62E42FF0C52D6); // 0x1.62e42ff0c52d6p-1\n\n var xd = x;\n var ix = reinterpret(x);\n var ux = ix >> 20 & 0x7FF;\n if (ux >= 0x430) {\n // |x| >= 128 or x is nan.\n if (ix == 0xFF800000) return 0; // x == -Inf -> 0\n if (ux >= 0x7F8) return x + x; // x == Inf/NaN -> Inf/NaN\n if (x > 0) return x * Ox127f; // x > 0 -> HugeVal (Owerflow)\n if (x <= -150) return 0; // x <= -150 -> 0 (Underflow)\n }\n\n // x = k/N + r with r in [-1/(2N), 1/(2N)] and int k.\n var kd = xd + shift;\n var ki = reinterpret(kd);\n var r = xd - (kd - shift);\n var t: u64, y: f64, s: f64;\n\n // exp2(x) = 2^(k/N) * 2^r ~= s * (C0*r^3 + C1*r^2 + C2*r + 1)\n t = load(EXP2F_DATA_TAB + ((ki & N_MASK) << alignof()));\n t += ki << (52 - EXP2F_TABLE_BITS);\n s = reinterpret(t);\n y = C2 * r + 1;\n y += (C0 * r + C1) * (r * r);\n y *= s;\n\n return y;\n}\n\n// ULP error: 0.502 (nearest rounding.)\n// Relative error: 1.69 * 2^-34 in [-ln2/64, ln2/64] (before rounding.)\n// Wrong count: 170635 (all nearest rounding wrong results with fma.)\n// @ts-ignore: decorator\n@inline\nexport function expf_lut(x: f32): f32 {\n const\n N = 1 << EXP2F_TABLE_BITS,\n N_MASK = N - 1,\n shift = reinterpret(0x4338000000000000), // 0x1.8p+52\n InvLn2N = reinterpret(0x3FF71547652B82FE) * N, // 0x1.71547652b82fep+0\n Ox1p127f = reinterpret(0x7F000000);\n\n const\n C0 = reinterpret(0x3FAC6AF84B912394) / N / N / N, // 0x1.c6af84b912394p-5\n C1 = reinterpret(0x3FCEBFCE50FAC4F3) / N / N, // 0x1.ebfce50fac4f3p-3\n C2 = reinterpret(0x3FE62E42FF0C52D6) / N; // 0x1.62e42ff0c52d6p-1\n\n var xd = x;\n var ix = reinterpret(x);\n var ux = ix >> 20 & 0x7FF;\n if (ux >= 0x42B) {\n // |x| >= 88 or x is nan.\n if (ix == 0xFF800000) return 0; // x == -Inf -> 0\n if (ux >= 0x7F8) return x + x; // x == Inf/NaN -> Inf/NaN\n if (x > reinterpret(0x42B17217)) return x * Ox1p127f; // x > log(0x1p128) ~= 88.72 -> HugeVal (Owerflow)\n if (x < reinterpret(0xC2CFF1B4)) return 0; // x < log(0x1p-150) ~= -103.97 -> 0 (Underflow)\n }\n\n // x*N/Ln2 = k + r with r in [-1/2, 1/2] and int k.\n var z = InvLn2N * xd;\n\n // Round and convert z to int, the result is in [-150*N, 128*N] and\n // ideally ties-to-even rule is used, otherwise the magnitude of r\n // can be bigger which gives larger approximation error.\n var kd = (z + shift);\n var ki = reinterpret(kd);\n var r = z - (kd - shift);\n var s: f64, y: f64, t: u64;\n\n // exp(x) = 2^(k/N) * 2^(r/N) ~= s * (C0*r^3 + C1*r^2 + C2*r + 1)\n t = load(EXP2F_DATA_TAB + ((ki & N_MASK) << alignof()));\n t += ki << (52 - EXP2F_TABLE_BITS);\n s = reinterpret(t);\n z = C0 * r + C1;\n y = C2 * r + 1;\n y += z * (r * r);\n y *= s;\n\n return y;\n}\n\n//\n// Lookup data for log2f\n//\n\n// @ts-ignore: decorator\n@inline const LOG2F_TABLE_BITS = 4;\n\n// @ts-ignore: decorator\n@lazy @inline const LOG2F_DATA_TAB = memory.data([\n reinterpret(0x3FF661EC79F8F3BE), reinterpret(0xBFDEFEC65B963019), // 0x1.661ec79f8f3bep+0, -0x1.efec65b963019p-2,\n reinterpret(0x3FF571ED4AAF883D), reinterpret(0xBFDB0B6832D4FCA4), // 0x1.571ed4aaf883dp+0, -0x1.b0b6832d4fca4p-2,\n reinterpret(0x3FF49539F0F010B0), reinterpret(0xBFD7418B0A1FB77B), // 0x1.49539f0f010bp+0 , -0x1.7418b0a1fb77bp-2,\n reinterpret(0x3FF3C995B0B80385), reinterpret(0xBFD39DE91A6DCF7B), // 0x1.3c995b0b80385p+0, -0x1.39de91a6dcf7bp-2,\n reinterpret(0x3FF30D190C8864A5), reinterpret(0xBFD01D9BF3F2B631), // 0x1.30d190c8864a5p+0, -0x1.01d9bf3f2b631p-2,\n reinterpret(0x3FF25E227B0B8EA0), reinterpret(0xBFC97C1D1B3B7AF0), // 0x1.25e227b0b8eap+0 , -0x1.97c1d1b3b7afp-3 ,\n reinterpret(0x3FF1BB4A4A1A343F), reinterpret(0xBFC2F9E393AF3C9F), // 0x1.1bb4a4a1a343fp+0, -0x1.2f9e393af3c9fp-3,\n reinterpret(0x3FF12358F08AE5BA), reinterpret(0xBFB960CBBF788D5C), // 0x1.12358f08ae5bap+0, -0x1.960cbbf788d5cp-4,\n reinterpret(0x3FF0953F419900A7), reinterpret(0xBFAA6F9DB6475FCE), // 0x1.0953f419900a7p+0, -0x1.a6f9db6475fcep-5,\n reinterpret(0x3FF0000000000000), 0, // 0x1p+0, 0x0,\n reinterpret(0x3FEE608CFD9A47AC), reinterpret(0x3FB338CA9F24F53D), // 0x1.e608cfd9a47acp-1, 0x1.338ca9f24f53dp-4,\n reinterpret(0x3FECA4B31F026AA0), reinterpret(0x3FC476A9543891BA), // 0x1.ca4b31f026aap-1 , 0x1.476a9543891bap-3,\n reinterpret(0x3FEB2036576AFCE6), reinterpret(0x3FCE840B4AC4E4D2), // 0x1.b2036576afce6p-1, 0x1.e840b4ac4e4d2p-3,\n reinterpret(0x3FE9C2D163A1AA2D), reinterpret(0x3FD40645F0C6651C), // 0x1.9c2d163a1aa2dp-1, 0x1.40645f0c6651cp-2,\n reinterpret(0x3FE886E6037841ED), reinterpret(0x3FD88E9C2C1B9FF8), // 0x1.886e6037841edp-1, 0x1.88e9c2c1b9ff8p-2,\n reinterpret(0x3FE767DCF5534862), reinterpret(0x3FDCE0A44EB17BCC) // 0x1.767dcf5534862p-1, 0x1.ce0a44eb17bccp-2\n]);\n\n// ULP error: 0.752 (nearest rounding.)\n// Relative error: 1.9 * 2^-26 (before rounding.)\n// @ts-ignore: decorator\n@inline\nexport function log2f_lut(x: f32): f32 {\n const\n N_MASK = (1 << LOG2F_TABLE_BITS) - 1,\n Ox1p23f = reinterpret(0x4B000000); // 0x1p23f\n\n const\n A0 = reinterpret(0xBFD712B6F70A7E4D), // -0x1.712b6f70a7e4dp-2\n A1 = reinterpret(0x3FDECABF496832E0), // 0x1.ecabf496832ep-2\n A2 = reinterpret(0xBFE715479FFAE3DE), // -0x1.715479ffae3dep-1\n A3 = reinterpret(0x3FF715475F35C8B8); // 0x1.715475f35c8b8p0\n\n var ux = reinterpret(x);\n // Fix sign of zero with downward rounding when x==1.\n // if (WANT_ROUNDING && predict_false(ix == 0x3f800000)) return 0;\n if (ux - 0x00800000 >= 0x7F800000 - 0x00800000) {\n // x < 0x1p-126 or inf or nan.\n if (ux * 2 == 0) return -Infinity;\n if (ux == 0x7F800000) return x; // log2(inf) == inf.\n if ((ux >> 31) || ux * 2 >= 0xFF000000) return (x - x) / (x - x);\n // x is subnormal, normalize it.\n ux = reinterpret(x * Ox1p23f);\n ux -= 23 << 23;\n }\n // x = 2^k z; where z is in range [OFF,2*OFF] and exact.\n // The range is split into N subintervals.\n // The ith subinterval contains z and c is near its center.\n var tmp = ux - 0x3F330000;\n var i = (tmp >> (23 - LOG2F_TABLE_BITS)) & N_MASK;\n var top = tmp & 0xFF800000;\n var iz = ux - top;\n var k = tmp >> 23;\n\n var invc = load(LOG2F_DATA_TAB + (i << (1 + alignof())), 0 << alignof());\n var logc = load(LOG2F_DATA_TAB + (i << (1 + alignof())), 1 << alignof());\n var z = reinterpret(iz);\n\n // log2(x) = log1p(z/c-1)/ln2 + log2(c) + k\n var r = z * invc - 1;\n var y0 = logc + k;\n\n // Pipelined polynomial evaluation to approximate log1p(r)/ln2.\n var y = A1 * r + A2;\n var p = A3 * r + y0;\n var r2 = r * r;\n y += A0 * r2;\n y = y * r2 + p;\n\n return y;\n}\n\n//\n// Lookup data for logf. See: https://git.musl-libc.org/cgit/musl/tree/src/math/logf.c\n//\n\n// @ts-ignore: decorator\n@inline const LOGF_TABLE_BITS = 4;\n\n// @ts-ignore: decorator\n@lazy @inline const LOGF_DATA_TAB = memory.data([\n reinterpret(0x3FF661EC79F8F3BE), reinterpret(0xBFD57BF7808CAADE), // 0x1.661ec79f8f3bep+0, -0x1.57bf7808caadep-2,\n reinterpret(0x3FF571ED4AAF883D), reinterpret(0xBFD2BEF0A7C06DDB), // 0x1.571ed4aaf883dp+0, -0x1.2bef0a7c06ddbp-2,\n reinterpret(0x3FF49539F0F010B0), reinterpret(0xBFD01EAE7F513A67), // 0x1.49539f0f010bp+0 , -0x1.01eae7f513a67p-2,\n reinterpret(0x3FF3C995B0B80385), reinterpret(0xBFCB31D8A68224E9), // 0x1.3c995b0b80385p+0, -0x1.b31d8a68224e9p-3,\n reinterpret(0x3FF30D190C8864A5), reinterpret(0xBFC6574F0AC07758), // 0x1.30d190c8864a5p+0, -0x1.6574f0ac07758p-3,\n reinterpret(0x3FF25E227B0B8EA0), reinterpret(0xBFC1AA2BC79C8100), // 0x1.25e227b0b8eap+0 , -0x1.1aa2bc79c81p-3 ,\n reinterpret(0x3FF1BB4A4A1A343F), reinterpret(0xBFBA4E76CE8C0E5E), // 0x1.1bb4a4a1a343fp+0, -0x1.a4e76ce8c0e5ep-4,\n reinterpret(0x3FF12358F08AE5BA), reinterpret(0xBFB1973C5A611CCC), // 0x1.12358f08ae5bap+0, -0x1.1973c5a611cccp-4,\n reinterpret(0x3FF0953F419900A7), reinterpret(0xBFA252F438E10C1E), // 0x1.0953f419900a7p+0, -0x1.252f438e10c1ep-5,\n reinterpret(0x3FF0000000000000), 0, // 0x1p+0, 0,\n reinterpret(0x3FEE608CFD9A47AC), reinterpret(0x3FAAA5AA5DF25984), // 0x1.e608cfd9a47acp-1, 0x1.aa5aa5df25984p-5,\n reinterpret(0x3FECA4B31F026AA0), reinterpret(0x3FBC5E53AA362EB4), // 0x1.ca4b31f026aap-1 , 0x1.c5e53aa362eb4p-4,\n reinterpret(0x3FEB2036576AFCE6), reinterpret(0x3FC526E57720DB08), // 0x1.b2036576afce6p-1, 0x1.526e57720db08p-3,\n reinterpret(0x3FE9C2D163A1AA2D), reinterpret(0x3FCBC2860D224770), // 0x1.9c2d163a1aa2dp-1, 0x1.bc2860d22477p-3 ,\n reinterpret(0x3FE886E6037841ED), reinterpret(0x3FD1058BC8A07EE1), // 0x1.886e6037841edp-1, 0x1.1058bc8a07ee1p-2,\n reinterpret(0x3FE767DCF5534862), reinterpret(0x3FD4043057B6EE09) // 0x1.767dcf5534862p-1, 0x1.4043057b6ee09p-2\n]);\n\n// ULP error: 0.818 (nearest rounding.)\n// Relative error: 1.957 * 2^-26 (before rounding.)\n// @ts-ignore: decorator\n@inline\nexport function logf_lut(x: f32): f32 {\n const\n N_MASK = (1 << LOGF_TABLE_BITS) - 1,\n Ox1p23f = reinterpret(0x4B000000); // 0x1p23f\n\n const\n Ln2 = reinterpret(0x3FE62E42FEFA39EF), // 0x1.62e42fefa39efp-1;\n A0 = reinterpret(0xBFD00EA348B88334), // -0x1.00ea348b88334p-2\n A1 = reinterpret(0x3FD5575B0BE00B6A), // 0x1.5575b0be00b6ap-2\n A2 = reinterpret(0xBFDFFFFEF20A4123); // -0x1.ffffef20a4123p-2\n\n var ux = reinterpret(x);\n // Fix sign of zero with downward rounding when x==1.\n // if (WANT_ROUNDING && ux == 0x3f800000) return 0;\n if (ux - 0x00800000 >= 0x7F800000 - 0x00800000) {\n // x < 0x1p-126 or inf or nan.\n if ((ux << 1) == 0) return -Infinity;\n if (ux == 0x7F800000) return x; // log(inf) == inf.\n if ((ux >> 31) || (ux << 1) >= 0xFF000000) return (x - x) / (x - x);\n // x is subnormal, normalize it.\n ux = reinterpret(x * Ox1p23f);\n ux -= 23 << 23;\n }\n // x = 2^k z; where z is in range [OFF,2*OFF] and exact.\n // The range is split into N subintervals.\n // The ith subinterval contains z and c is near its center.\n var tmp = ux - 0x3F330000;\n var i = (tmp >> (23 - LOGF_TABLE_BITS)) & N_MASK;\n var k = tmp >> 23;\n var iz = ux - (tmp & 0x1FF << 23);\n\n var invc = load(LOGF_DATA_TAB + (i << (1 + alignof())), 0 << alignof());\n var logc = load(LOGF_DATA_TAB + (i << (1 + alignof())), 1 << alignof());\n\n var z = reinterpret(iz);\n\n // log(x) = log1p(z/c-1) + log(c) + k*Ln2\n var r = z * invc - 1;\n var y0 = logc + k * Ln2;\n\n // Pipelined polynomial evaluation to approximate log1p(r).\n var r2 = r * r;\n var y = A1 * r + A2;\n y += A0 * r2;\n y = y * r2 + (y0 + r);\n\n return y;\n}\n\n//\n// Lookup data for powf. See: https://git.musl-libc.org/cgit/musl/tree/src/math/powf.c\n//\n\n// @ts-ignore: decorator\n@inline\nfunction zeroinfnanf(ux: u32): bool {\n return (ux << 1) - 1 >= (0x7f800000 << 1) - 1;\n}\n\n// Returns 0 if not int, 1 if odd int, 2 if even int. The argument is\n// the bit representation of a non-zero finite floating-point value.\n// @ts-ignore: decorator\n@inline\nfunction checkintf(iy: u32): i32 {\n var e = iy >> 23 & 0xFF;\n if (e < 0x7F ) return 0;\n if (e > 0x7F + 23) return 2;\n e = 1 << (0x7F + 23 - e);\n if (iy & (e - 1)) return 0;\n if (iy & e ) return 1;\n return 2;\n}\n\n// Subnormal input is normalized so ix has negative biased exponent.\n// Output is multiplied by N (POWF_SCALE) if TOINT_INTRINICS is set.\n// @ts-ignore: decorator\n@inline\nfunction log2f_inline(ux: u32): f64 {\n const N_MASK = (1 << LOG2F_TABLE_BITS) - 1;\n\n const\n A0 = reinterpret(0x3FD27616C9496E0B), // 0x1.27616c9496e0bp-2\n A1 = reinterpret(0xBFD71969A075C67A), // -0x1.71969a075c67ap-2\n A2 = reinterpret(0x3FDEC70A6CA7BADD), // 0x1.ec70a6ca7baddp-2\n A3 = reinterpret(0xBFE7154748BEF6C8), // -0x1.7154748bef6c8p-1\n A4 = reinterpret(0x3FF71547652AB82B); // 0x1.71547652ab82bp+0\n\n // x = 2^k z; where z is in range [OFF,2*OFF] and exact.\n // The range is split into N subintervals.\n // The ith subinterval contains z and c is near its center.\n var tmp = ux - 0x3F330000;\n var i = ((tmp >> (23 - LOG2F_TABLE_BITS)) & N_MASK);\n var top = tmp & 0xFF800000;\n var uz = ux - top;\n var k = (top >> 23);\n\n var invc = load(LOG2F_DATA_TAB + (i << (1 + alignof())), 0 << alignof());\n var logc = load(LOG2F_DATA_TAB + (i << (1 + alignof())), 1 << alignof());\n var z = reinterpret(uz);\n\n // log2(x) = log1p(z/c-1)/ln2 + log2(c) + k\n var r = z * invc - 1;\n var y0 = logc + k;\n\n // Pipelined polynomial evaluation to approximate log1p(r)/ln2.\n var y = A0 * r + A1;\n var p = A2 * r + A3;\n var q = A4 * r + y0;\n\n r *= r;\n q += p * r;\n y = y * (r * r) + q;\n\n return y;\n}\n\n// The output of log2 and thus the input of exp2 is either scaled by N\n// (in case of fast toint intrinsics) or not. The unscaled xd must be\n// in [-1021,1023], sign_bias sets the sign of the result.\n// @ts-ignore: decorator\n@inline\nfunction exp2f_inline(xd: f64, signBias: u32): f32 {\n const\n N = 1 << EXP2F_TABLE_BITS,\n N_MASK = N - 1,\n shift = reinterpret(0x4338000000000000) / N; // 0x1.8p+52\n\n const\n C0 = reinterpret(0x3FAC6AF84B912394), // 0x1.c6af84b912394p-5\n C1 = reinterpret(0x3FCEBFCE50FAC4F3), // 0x1.ebfce50fac4f3p-3\n C2 = reinterpret(0x3FE62E42FF0C52D6); // 0x1.62e42ff0c52d6p-1\n\n // x = k/N + r with r in [-1/(2N), 1/(2N)]\n var kd = (xd + shift);\n var ki = reinterpret(kd);\n var r = xd - (kd - shift);\n var t: u64, z: f64, y: f64, s: f64;\n\n // exp2(x) = 2^(k/N) * 2^r ~= s * (C0*r^3 + C1*r^2 + C2*r + 1)\n t = load(EXP2F_DATA_TAB + ((ki & N_MASK) << alignof()));\n t += (ki + signBias) << (52 - EXP2F_TABLE_BITS);\n s = reinterpret(t);\n z = C0 * r + C1;\n y = C2 * r + 1;\n y += z * (r * r);\n y *= s;\n return y;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction xflowf(sign: u32, y: f32): f32 {\n return select(-y, y, sign) * y;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction oflowf(sign: u32): f32 {\n return xflowf(sign, reinterpret(0x70000000)); // 0x1p97f\n}\n\n// @ts-ignore: decorator\n@inline\nfunction uflowf(sign: u32): f32 {\n return xflowf(sign, reinterpret(0x10000000)); // 0x1p-95f\n}\n\n// @ts-ignore: decorator\n@inline\nexport function powf_lut(x: f32, y: f32): f32 {\n const\n Ox1p23f = reinterpret(0x4B000000), // 0x1p23f\n UPPER_LIMIT = reinterpret(0x405FFFFFFFD1D571), // 0x1.fffffffd1d571p+6\n LOWER_LIMIT = -150.0,\n SIGN_BIAS = 1 << (EXP2F_TABLE_BITS + 11);\n\n var signBias: u32 = 0;\n var ix = reinterpret(x);\n var iy = reinterpret(y);\n var ny = 0;\n\n if (i32(ix - 0x00800000 >= 0x7f800000 - 0x00800000) | (ny = i32(zeroinfnanf(iy)))) {\n // Either (x < 0x1p-126 or inf or nan) or (y is 0 or inf or nan).\n if (ny) {\n if ((iy << 1) == 0) return 1.0;\n if (ix == 0x3F800000) return NaN; // original: 1.0\n if ((ix << 1) > (0x7F800000 << 1) || (iy << 1) > (0x7F800000 << 1)) return x + y;\n if ((ix << 1) == (0x3F800000 << 1)) return NaN; // original: 1.0\n if (((ix << 1) < (0x3F800000 << 1)) == !(iy >> 31)) return 0; // |x| < 1 && y==inf or |x| > 1 && y==-inf.\n return y * y;\n }\n if (zeroinfnanf(ix)) {\n let x2 = x * x;\n if ((ix >> 31) && checkintf(iy) == 1) x2 = -x2;\n return iy >> 31 ? 1 / x2 : x2;\n }\n // x and y are non-zero finite.\n if (ix >> 31) {\n // Finite x < 0.\n let yint = checkintf(iy);\n if (yint == 0) return (x - x) / (x - x);\n if (yint == 1) signBias = SIGN_BIAS;\n ix &= 0x7FFFFFFF;\n }\n if (ix < 0x00800000) {\n // Normalize subnormal x so exponent becomes negative.\n ix = reinterpret(x * Ox1p23f);\n ix &= 0x7FFFFFFF;\n ix -= 23 << 23;\n }\n }\n var logx = log2f_inline(ix);\n var ylogx = y * logx; // cannot overflow, y is single prec.\n if ((reinterpret(ylogx) >> 47 & 0xFFFF) >= 0x80BF) { // reinterpret(126.0) >> 47\n // |y * log(x)| >= 126\n if (ylogx > UPPER_LIMIT) return oflowf(signBias); // overflow\n if (ylogx <= LOWER_LIMIT) return uflowf(signBias); // underflow\n }\n return exp2f_inline(ylogx, signBias);\n}\n\n//\n// Lookup data for exp. See: https://git.musl-libc.org/cgit/musl/tree/src/math/exp.c\n//\n\n// @ts-ignore: decorator\n@inline const EXP_TABLE_BITS = 7;\n\n// @ts-ignore: decorator\n@lazy @inline const EXP_DATA_TAB = memory.data([\n 0x0000000000000000, 0x3FF0000000000000,\n 0x3C9B3B4F1A88BF6E, 0x3FEFF63DA9FB3335,\n 0xBC7160139CD8DC5D, 0x3FEFEC9A3E778061,\n 0xBC905E7A108766D1, 0x3FEFE315E86E7F85,\n 0x3C8CD2523567F613, 0x3FEFD9B0D3158574,\n 0xBC8BCE8023F98EFA, 0x3FEFD06B29DDF6DE,\n 0x3C60F74E61E6C861, 0x3FEFC74518759BC8,\n 0x3C90A3E45B33D399, 0x3FEFBE3ECAC6F383,\n 0x3C979AA65D837B6D, 0x3FEFB5586CF9890F,\n 0x3C8EB51A92FDEFFC, 0x3FEFAC922B7247F7,\n 0x3C3EBE3D702F9CD1, 0x3FEFA3EC32D3D1A2,\n 0xBC6A033489906E0B, 0x3FEF9B66AFFED31B,\n 0xBC9556522A2FBD0E, 0x3FEF9301D0125B51,\n 0xBC5080EF8C4EEA55, 0x3FEF8ABDC06C31CC,\n 0xBC91C923B9D5F416, 0x3FEF829AAEA92DE0,\n 0x3C80D3E3E95C55AF, 0x3FEF7A98C8A58E51,\n 0xBC801B15EAA59348, 0x3FEF72B83C7D517B,\n 0xBC8F1FF055DE323D, 0x3FEF6AF9388C8DEA,\n 0x3C8B898C3F1353BF, 0x3FEF635BEB6FCB75,\n 0xBC96D99C7611EB26, 0x3FEF5BE084045CD4,\n 0x3C9AECF73E3A2F60, 0x3FEF54873168B9AA,\n 0xBC8FE782CB86389D, 0x3FEF4D5022FCD91D,\n 0x3C8A6F4144A6C38D, 0x3FEF463B88628CD6,\n 0x3C807A05B0E4047D, 0x3FEF3F49917DDC96,\n 0x3C968EFDE3A8A894, 0x3FEF387A6E756238,\n 0x3C875E18F274487D, 0x3FEF31CE4FB2A63F,\n 0x3C80472B981FE7F2, 0x3FEF2B4565E27CDD,\n 0xBC96B87B3F71085E, 0x3FEF24DFE1F56381,\n 0x3C82F7E16D09AB31, 0x3FEF1E9DF51FDEE1,\n 0xBC3D219B1A6FBFFA, 0x3FEF187FD0DAD990,\n 0x3C8B3782720C0AB4, 0x3FEF1285A6E4030B,\n 0x3C6E149289CECB8F, 0x3FEF0CAFA93E2F56,\n 0x3C834D754DB0ABB6, 0x3FEF06FE0A31B715,\n 0x3C864201E2AC744C, 0x3FEF0170FC4CD831,\n 0x3C8FDD395DD3F84A, 0x3FEEFC08B26416FF,\n 0xBC86A3803B8E5B04, 0x3FEEF6C55F929FF1,\n 0xBC924AEDCC4B5068, 0x3FEEF1A7373AA9CB,\n 0xBC9907F81B512D8E, 0x3FEEECAE6D05D866,\n 0xBC71D1E83E9436D2, 0x3FEEE7DB34E59FF7,\n 0xBC991919B3CE1B15, 0x3FEEE32DC313A8E5,\n 0x3C859F48A72A4C6D, 0x3FEEDEA64C123422,\n 0xBC9312607A28698A, 0x3FEEDA4504AC801C,\n 0xBC58A78F4817895B, 0x3FEED60A21F72E2A,\n 0xBC7C2C9B67499A1B, 0x3FEED1F5D950A897,\n 0x3C4363ED60C2AC11, 0x3FEECE086061892D,\n 0x3C9666093B0664EF, 0x3FEECA41ED1D0057,\n 0x3C6ECCE1DAA10379, 0x3FEEC6A2B5C13CD0,\n 0x3C93FF8E3F0F1230, 0x3FEEC32AF0D7D3DE,\n 0x3C7690CEBB7AAFB0, 0x3FEEBFDAD5362A27,\n 0x3C931DBDEB54E077, 0x3FEEBCB299FDDD0D,\n 0xBC8F94340071A38E, 0x3FEEB9B2769D2CA7,\n 0xBC87DECCDC93A349, 0x3FEEB6DAA2CF6642,\n 0xBC78DEC6BD0F385F, 0x3FEEB42B569D4F82,\n 0xBC861246EC7B5CF6, 0x3FEEB1A4CA5D920F,\n 0x3C93350518FDD78E, 0x3FEEAF4736B527DA,\n 0x3C7B98B72F8A9B05, 0x3FEEAD12D497C7FD,\n 0x3C9063E1E21C5409, 0x3FEEAB07DD485429,\n 0x3C34C7855019C6EA, 0x3FEEA9268A5946B7,\n 0x3C9432E62B64C035, 0x3FEEA76F15AD2148,\n 0xBC8CE44A6199769F, 0x3FEEA5E1B976DC09,\n 0xBC8C33C53BEF4DA8, 0x3FEEA47EB03A5585,\n 0xBC845378892BE9AE, 0x3FEEA34634CCC320,\n 0xBC93CEDD78565858, 0x3FEEA23882552225,\n 0x3C5710AA807E1964, 0x3FEEA155D44CA973,\n 0xBC93B3EFBF5E2228, 0x3FEEA09E667F3BCD,\n 0xBC6A12AD8734B982, 0x3FEEA012750BDABF,\n 0xBC6367EFB86DA9EE, 0x3FEE9FB23C651A2F,\n 0xBC80DC3D54E08851, 0x3FEE9F7DF9519484,\n 0xBC781F647E5A3ECF, 0x3FEE9F75E8EC5F74,\n 0xBC86EE4AC08B7DB0, 0x3FEE9F9A48A58174,\n 0xBC8619321E55E68A, 0x3FEE9FEB564267C9,\n 0x3C909CCB5E09D4D3, 0x3FEEA0694FDE5D3F,\n 0xBC7B32DCB94DA51D, 0x3FEEA11473EB0187,\n 0x3C94ECFD5467C06B, 0x3FEEA1ED0130C132,\n 0x3C65EBE1ABD66C55, 0x3FEEA2F336CF4E62,\n 0xBC88A1C52FB3CF42, 0x3FEEA427543E1A12,\n 0xBC9369B6F13B3734, 0x3FEEA589994CCE13,\n 0xBC805E843A19FF1E, 0x3FEEA71A4623C7AD,\n 0xBC94D450D872576E, 0x3FEEA8D99B4492ED,\n 0x3C90AD675B0E8A00, 0x3FEEAAC7D98A6699,\n 0x3C8DB72FC1F0EAB4, 0x3FEEACE5422AA0DB,\n 0xBC65B6609CC5E7FF, 0x3FEEAF3216B5448C,\n 0x3C7BF68359F35F44, 0x3FEEB1AE99157736,\n 0xBC93091FA71E3D83, 0x3FEEB45B0B91FFC6,\n 0xBC5DA9B88B6C1E29, 0x3FEEB737B0CDC5E5,\n 0xBC6C23F97C90B959, 0x3FEEBA44CBC8520F,\n 0xBC92434322F4F9AA, 0x3FEEBD829FDE4E50,\n 0xBC85CA6CD7668E4B, 0x3FEEC0F170CA07BA,\n 0x3C71AFFC2B91CE27, 0x3FEEC49182A3F090,\n 0x3C6DD235E10A73BB, 0x3FEEC86319E32323,\n 0xBC87C50422622263, 0x3FEECC667B5DE565,\n 0x3C8B1C86E3E231D5, 0x3FEED09BEC4A2D33,\n 0xBC91BBD1D3BCBB15, 0x3FEED503B23E255D,\n 0x3C90CC319CEE31D2, 0x3FEED99E1330B358,\n 0x3C8469846E735AB3, 0x3FEEDE6B5579FDBF,\n 0xBC82DFCD978E9DB4, 0x3FEEE36BBFD3F37A,\n 0x3C8C1A7792CB3387, 0x3FEEE89F995AD3AD,\n 0xBC907B8F4AD1D9FA, 0x3FEEEE07298DB666,\n 0xBC55C3D956DCAEBA, 0x3FEEF3A2B84F15FB,\n 0xBC90A40E3DA6F640, 0x3FEEF9728DE5593A,\n 0xBC68D6F438AD9334, 0x3FEEFF76F2FB5E47,\n 0xBC91EEE26B588A35, 0x3FEF05B030A1064A,\n 0x3C74FFD70A5FDDCD, 0x3FEF0C1E904BC1D2,\n 0xBC91BDFBFA9298AC, 0x3FEF12C25BD71E09,\n 0x3C736EAE30AF0CB3, 0x3FEF199BDD85529C,\n 0x3C8EE3325C9FFD94, 0x3FEF20AB5FFFD07A,\n 0x3C84E08FD10959AC, 0x3FEF27F12E57D14B,\n 0x3C63CDAF384E1A67, 0x3FEF2F6D9406E7B5,\n 0x3C676B2C6C921968, 0x3FEF3720DCEF9069,\n 0xBC808A1883CCB5D2, 0x3FEF3F0B555DC3FA,\n 0xBC8FAD5D3FFFFA6F, 0x3FEF472D4A07897C,\n 0xBC900DAE3875A949, 0x3FEF4F87080D89F2,\n 0x3C74A385A63D07A7, 0x3FEF5818DCFBA487,\n 0xBC82919E2040220F, 0x3FEF60E316C98398,\n 0x3C8E5A50D5C192AC, 0x3FEF69E603DB3285,\n 0x3C843A59AC016B4B, 0x3FEF7321F301B460,\n 0xBC82D52107B43E1F, 0x3FEF7C97337B9B5F,\n 0xBC892AB93B470DC9, 0x3FEF864614F5A129,\n 0x3C74B604603A88D3, 0x3FEF902EE78B3FF6,\n 0x3C83C5EC519D7271, 0x3FEF9A51FBC74C83,\n 0xBC8FF7128FD391F0, 0x3FEFA4AFA2A490DA,\n 0xBC8DAE98E223747D, 0x3FEFAF482D8E67F1,\n 0x3C8EC3BC41AA2008, 0x3FEFBA1BEE615A27,\n 0x3C842B94C3A9EB32, 0x3FEFC52B376BBA97,\n 0x3C8A64A931D185EE, 0x3FEFD0765B6E4540,\n 0xBC8E37BAE43BE3ED, 0x3FEFDBFDAD9CBE14,\n 0x3C77893B4D91CD9D, 0x3FEFE7C1819E90D8,\n 0x3C5305C14160CC89, 0x3FEFF3C22B8F71F1\n]);\n\n// Handle cases that may overflow or underflow when computing the result that\n// is scale*(1+TMP) without intermediate rounding. The bit representation of\n// scale is in SBITS, however it has a computed exponent that may have\n// overflown into the sign bit so that needs to be adjusted before using it as\n// a double. (int32_t)KI is the k used in the argument reduction and exponent\n// adjustment of scale, positive k here means the result may overflow and\n// negative k means the result may underflow.\n// @ts-ignore: decorator\n@inline\nfunction specialcase(tmp: f64, sbits: u64, ki: u64): f64 {\n const\n Ox1p_1022 = reinterpret(0x0010000000000000), // 0x1p-1022\n Ox1p1009 = reinterpret(0x7F00000000000000); // 0x1p1009\n\n var scale: f64;\n if (!(ki & 0x80000000)) {\n // k > 0, the exponent of scale might have overflowed by <= 460.\n sbits -= u64(1009) << 52;\n scale = reinterpret(sbits);\n return Ox1p1009 * (scale + scale * tmp); // 0x1p1009\n }\n // k < 0, need special care in the subnormal range.\n sbits += u64(1022) << 52;\n // Note: sbits is signed scale.\n scale = reinterpret(sbits);\n var y = scale + scale * tmp;\n if (abs(y) < 1.0) {\n // Round y to the right precision before scaling it into the subnormal\n // range to avoid double rounding that can cause 0.5+E/2 ulp error where\n // E is the worst-case ulp error outside the subnormal range. So this\n // is only useful if the goal is better than 1 ulp worst-case error.\n let one = copysign(1.0, y);\n let lo = scale - y + scale * tmp;\n let hi = one + y;\n lo = one - hi + y + lo;\n y = (hi + lo) - one;\n // Fix the sign of 0.\n if (y == 0.0) y = reinterpret(sbits & 0x8000000000000000);\n }\n return y * Ox1p_1022;\n}\n\n// @ts-ignore: decorator\n@inline\nexport function exp_lut(x: f64): f64 {\n const\n N = 1 << EXP_TABLE_BITS,\n N_MASK = N - 1;\n\n const\n InvLn2N = reinterpret(0x3FF71547652B82FE) * N, // 0x1.71547652b82fep0\n NegLn2hiN = reinterpret(0xBF762E42FEFA0000), // -0x1.62e42fefa0000p-8\n NegLn2loN = reinterpret(0xBD0CF79ABC9E3B3A), // -0x1.cf79abc9e3b3ap-47\n shift = reinterpret(0x4338000000000000); // 0x1.8p52;\n\n const\n C2 = reinterpret(0x3FDFFFFFFFFFFDBD), // __exp_data.poly[0] (0x1.ffffffffffdbdp-2)\n C3 = reinterpret(0x3FC555555555543C), // __exp_data.poly[1] (0x1.555555555543cp-3)\n C4 = reinterpret(0x3FA55555CF172B91), // __exp_data.poly[2] (0x1.55555cf172b91p-5)\n C5 = reinterpret(0x3F81111167A4D017); // __exp_data.poly[3] (0x1.1111167a4d017p-7)\n\n var ux = reinterpret(x);\n var abstop = (ux >> 52 & 0x7FF);\n if (abstop - 0x3C9 >= 0x03F) {\n if (abstop - 0x3C9 >= 0x80000000) return 1;\n if (abstop >= 0x409) {\n if (ux == 0xFFF0000000000000) return 0;\n if (abstop >= 0x7FF) return 1.0 + x;\n return select(0, Infinity, ux >> 63);\n }\n // Large x is special cased below.\n abstop = 0;\n }\n\n // exp(x) = 2^(k/N) * exp(r), with exp(r) in [2^(-1/2N),2^(1/2N)]\n // x = ln2/N*k + r, with int k and r in [-ln2/2N, ln2/2N]\n var z = InvLn2N * x;\n // #if TOINT_INTRINSICS\n // \tkd = roundtoint(z);\n // \tki = converttoint(z);\n // #elif EXP_USE_TOINT_NARROW\n // \t// z - kd is in [-0.5-2^-16, 0.5] in all rounding modes.\n // var kd = z + shift;\n // var ki = reinterpret(kd) >> 16;\n // var kd = ki;\n // #else\n // z - kd is in [-1, 1] in non-nearest rounding modes.\n var kd = z + shift;\n var ki = reinterpret(kd);\n kd -= shift;\n // #endif\n var r = x + kd * NegLn2hiN + kd * NegLn2loN;\n // 2^(k/N) ~= scale * (1 + tail).\n var idx = ((ki & N_MASK) << 1);\n var top = ki << (52 - EXP_TABLE_BITS);\n\n var tail = reinterpret(load(EXP_DATA_TAB + (idx << alignof()))); // T[idx]\n // This is only a valid scale when -1023*N < k < 1024*N\n var sbits = load(EXP_DATA_TAB + (idx << alignof()), 1 << alignof()) + top; // T[idx + 1]\n // exp(x) = 2^(k/N) * exp(r) ~= scale + scale * (tail + exp(r) - 1).\n // Evaluation is optimized assuming superscalar pipelined execution.\n var r2 = r * r;\n // Without fma the worst case error is 0.25/N ulp larger.\n // Worst case error is less than 0.5+1.11/N+(abs poly error * 2^53) ulp.\n var tmp = tail + r + r2 * (C2 + r * C3) + r2 * r2 * (C4 + r * C5);\n if (abstop == 0) return specialcase(tmp, sbits, ki);\n var scale = reinterpret(sbits);\n // Note: tmp == 0 or |tmp| > 2^-200 and scale > 2^-739, so there\n // is no spurious underflow here even without fma.\n return scale + scale * tmp;\n}\n\n//\n// Lookup data for exp2. See: https://git.musl-libc.org/cgit/musl/tree/src/math/exp2.c\n//\n\n// Handle cases that may overflow or underflow when computing the result that\n// is scale*(1+TMP) without intermediate rounding. The bit representation of\n// scale is in SBITS, however it has a computed exponent that may have\n// overflown into the sign bit so that needs to be adjusted before using it as\n// a double. (int32_t)KI is the k used in the argument reduction and exponent\n// adjustment of scale, positive k here means the result may overflow and\n// negative k means the result may underflow.\n// @ts-ignore: decorator\n@inline\nfunction specialcase2(tmp: f64, sbits: u64, ki: u64): f64 {\n const Ox1p_1022 = reinterpret(0x10000000000000); // 0x1p-1022\n var scale: f64;\n if ((ki & 0x80000000) == 0) {\n // k > 0, the exponent of scale might have overflowed by 1\n sbits -= u64(1) << 52;\n scale = reinterpret(sbits);\n return 2 * (scale * tmp + scale);\n }\n // k < 0, need special care in the subnormal range\n sbits += u64(1022) << 52;\n scale = reinterpret(sbits);\n var y = scale * tmp + scale;\n if (y < 1.0) {\n // Round y to the right precision before scaling it into the subnormal\n // range to avoid double rounding that can cause 0.5+E/2 ulp error where\n // E is the worst-case ulp error outside the subnormal range. So this\n // is only useful if the goal is better than 1 ulp worst-case error.\n let hi: f64, lo: f64;\n lo = scale - y + scale * tmp;\n hi = 1.0 + y;\n lo = 1.0 - hi + y + lo;\n y = (hi + lo) - 1.0;\n }\n return y * Ox1p_1022;\n}\n\n// @ts-ignore: decorator\n@inline\nexport function exp2_lut(x: f64): f64 {\n const\n N = 1 << EXP_TABLE_BITS,\n N_MASK = N - 1,\n shift = reinterpret(0x4338000000000000) / N; // 0x1.8p52\n\n const\n C1 = reinterpret(0x3FE62E42FEFA39EF), // 0x1.62e42fefa39efp-1\n C2 = reinterpret(0x3FCEBFBDFF82C424), // 0x1.ebfbdff82c424p-3\n C3 = reinterpret(0x3FAC6B08D70CF4B5), // 0x1.c6b08d70cf4b5p-5\n C4 = reinterpret(0x3F83B2ABD24650CC), // 0x1.3b2abd24650ccp-7\n C5 = reinterpret(0x3F55D7E09B4E3A84); // 0x1.5d7e09b4e3a84p-10\n\n var ux = reinterpret(x);\n var abstop = (ux >> 52 & 0x7ff);\n if (abstop - 0x3C9 >= 0x03F) {\n if (abstop - 0x3C9 >= 0x80000000) return 1.0;\n if (abstop >= 0x409) {\n if (ux == 0xFFF0000000000000) return 0;\n if (abstop >= 0x7FF) return 1.0 + x;\n if (!(ux >> 63)) return Infinity;\n else if (ux >= 0xC090CC0000000000) return 0;\n }\n if ((ux << 1) > 0x811A000000000000) abstop = 0; // Large x is special cased below.\n }\n\n // exp2(x) = 2^(k/N) * 2^r, with 2^r in [2^(-1/2N),2^(1/2N)].\n // x = k/N + r, with int k and r in [-1/2N, 1/2N]\n var kd = x + shift;\n var ki = reinterpret(kd);\n kd -= shift; // k/N for int k\n var r = x - kd;\n // 2^(k/N) ~= scale * (1 + tail)\n var idx = ((ki & N_MASK) << 1);\n var top = ki << (52 - EXP_TABLE_BITS);\n\n var tail = reinterpret(load(EXP_DATA_TAB + (idx << alignof()), 0 << alignof())); // T[idx])\n // This is only a valid scale when -1023*N < k < 1024*N\n var sbits = load(EXP_DATA_TAB + (idx << alignof()), 1 << alignof()) + top; // T[idx + 1]\n // exp2(x) = 2^(k/N) * 2^r ~= scale + scale * (tail + 2^r - 1).\n // Evaluation is optimized assuming superscalar pipelined execution\n var r2 = r * r;\n // Without fma the worst case error is 0.5/N ulp larger.\n // Worst case error is less than 0.5+0.86/N+(abs poly error * 2^53) ulp.\n var tmp = tail + r * C1 + r2 * (C2 + r * C3) + r2 * r2 * (C4 + r * C5);\n if (abstop == 0) return specialcase2(tmp, sbits, ki);\n var scale = reinterpret(sbits);\n // Note: tmp == 0 or |tmp| > 2^-65 and scale > 2^-928, so there\n // is no spurious underflow here even without fma.\n return scale * tmp + scale;\n}\n\n//\n// Lookup data for log2. See: https://git.musl-libc.org/cgit/musl/tree/src/math/log2.c\n//\n\n// @ts-ignore: decorator\n@inline const LOG2_TABLE_BITS = 6;\n\n/* Algorithm:\n\n x = 2^k z\n log2(x) = k + log2(c) + log2(z/c)\n log2(z/c) = poly(z/c - 1)\n\nwhere z is in [1.6p-1; 1.6p0] which is split into N subintervals and z falls\ninto the ith one, then table entries are computed as\n\n tab[i].invc = 1/c\n tab[i].logc = (double)log2(c)\n tab2[i].chi = (double)c\n tab2[i].clo = (double)(c - (double)c)\n\nwhere c is near the center of the subinterval and is chosen by trying +-2^29\nfloating point invc candidates around 1/center and selecting one for which\n\n 1) the rounding error in 0x1.8p10 + logc is 0,\n 2) the rounding error in z - chi - clo is < 0x1p-64 and\n 3) the rounding error in (double)log2(c) is minimized (< 0x1p-68).\n\nNote: 1) ensures that k + logc can be computed without rounding error, 2)\nensures that z/c - 1 can be computed as (z - chi - clo)*invc with close to a\nsingle rounding error when there is no fast fma for z*invc - 1, 3) ensures\nthat logc + poly(z/c - 1) has small error, however near x == 1 when\n|log2(x)| < 0x1p-4, this is not enough so that is special cased. */\n\n// @ts-ignore: decorator\n@lazy @inline const LOG2_DATA_TAB1 = memory.data([\n // invc , logc\n reinterpret(0x3FF724286BB1ACF8), reinterpret(0xBFE1095FEECDB000),\n reinterpret(0x3FF6E1F766D2CCA1), reinterpret(0xBFE08494BD76D000),\n reinterpret(0x3FF6A13D0E30D48A), reinterpret(0xBFE00143AEE8F800),\n reinterpret(0x3FF661EC32D06C85), reinterpret(0xBFDEFEC5360B4000),\n reinterpret(0x3FF623FA951198F8), reinterpret(0xBFDDFDD91AB7E000),\n reinterpret(0x3FF5E75BA4CF026C), reinterpret(0xBFDCFFAE0CC79000),\n reinterpret(0x3FF5AC055A214FB8), reinterpret(0xBFDC043811FDA000),\n reinterpret(0x3FF571ED0F166E1E), reinterpret(0xBFDB0B67323AE000),\n reinterpret(0x3FF53909590BF835), reinterpret(0xBFDA152F5A2DB000),\n reinterpret(0x3FF5014FED61ADDD), reinterpret(0xBFD9217F5AF86000),\n reinterpret(0x3FF4CAB88E487BD0), reinterpret(0xBFD8304DB0719000),\n reinterpret(0x3FF49539B4334FEE), reinterpret(0xBFD74189F9A9E000),\n reinterpret(0x3FF460CBDFAFD569), reinterpret(0xBFD6552BB5199000),\n reinterpret(0x3FF42D664EE4B953), reinterpret(0xBFD56B23A29B1000),\n reinterpret(0x3FF3FB01111DD8A6), reinterpret(0xBFD483650F5FA000),\n reinterpret(0x3FF3C995B70C5836), reinterpret(0xBFD39DE937F6A000),\n reinterpret(0x3FF3991C4AB6FD4A), reinterpret(0xBFD2BAA1538D6000),\n reinterpret(0x3FF3698E0CE099B5), reinterpret(0xBFD1D98340CA4000),\n reinterpret(0x3FF33AE48213E7B2), reinterpret(0xBFD0FA853A40E000),\n reinterpret(0x3FF30D191985BDB1), reinterpret(0xBFD01D9C32E73000),\n reinterpret(0x3FF2E025CAB271D7), reinterpret(0xBFCE857DA2FA6000),\n reinterpret(0x3FF2B404CF13CD82), reinterpret(0xBFCCD3C8633D8000),\n reinterpret(0x3FF288B02C7CCB50), reinterpret(0xBFCB26034C14A000),\n reinterpret(0x3FF25E2263944DE5), reinterpret(0xBFC97C1C2F4FE000),\n reinterpret(0x3FF234563D8615B1), reinterpret(0xBFC7D6023F800000),\n reinterpret(0x3FF20B46E33EAF38), reinterpret(0xBFC633A71A05E000),\n reinterpret(0x3FF1E2EEFDCDA3DD), reinterpret(0xBFC494F5E9570000),\n reinterpret(0x3FF1BB4A580B3930), reinterpret(0xBFC2F9E424E0A000),\n reinterpret(0x3FF19453847F2200), reinterpret(0xBFC162595AFDC000),\n reinterpret(0x3FF16E06C0D5D73C), reinterpret(0xBFBF9C9A75BD8000),\n reinterpret(0x3FF1485F47B7E4C2), reinterpret(0xBFBC7B575BF9C000),\n reinterpret(0x3FF12358AD0085D1), reinterpret(0xBFB960C60FF48000),\n reinterpret(0x3FF0FEF00F532227), reinterpret(0xBFB64CE247B60000),\n reinterpret(0x3FF0DB2077D03A8F), reinterpret(0xBFB33F78B2014000),\n reinterpret(0x3FF0B7E6D65980D9), reinterpret(0xBFB0387D1A42C000),\n reinterpret(0x3FF0953EFE7B408D), reinterpret(0xBFAA6F9208B50000),\n reinterpret(0x3FF07325CAC53B83), reinterpret(0xBFA47A954F770000),\n reinterpret(0x3FF05197E40D1B5C), reinterpret(0xBF9D23A8C50C0000),\n reinterpret(0x3FF03091C1208EA2), reinterpret(0xBF916A2629780000),\n reinterpret(0x3FF0101025B37E21), reinterpret(0xBF7720F8D8E80000),\n reinterpret(0x3FEFC07EF9CAA76B), reinterpret(0x3F86FE53B1500000),\n reinterpret(0x3FEF4465D3F6F184), reinterpret(0x3FA11CCCE10F8000),\n reinterpret(0x3FEECC079F84107F), reinterpret(0x3FAC4DFC8C8B8000),\n reinterpret(0x3FEE573A99975AE8), reinterpret(0x3FB3AA321E574000),\n reinterpret(0x3FEDE5D6F0BD3DE6), reinterpret(0x3FB918A0D08B8000),\n reinterpret(0x3FED77B681FF38B3), reinterpret(0x3FBE72E9DA044000),\n reinterpret(0x3FED0CB5724DE943), reinterpret(0x3FC1DCD2507F6000),\n reinterpret(0x3FECA4B2DC0E7563), reinterpret(0x3FC476AB03DEA000),\n reinterpret(0x3FEC3F8EE8D6CB51), reinterpret(0x3FC7074377E22000),\n reinterpret(0x3FEBDD2B4F020C4C), reinterpret(0x3FC98EDE8BA94000),\n reinterpret(0x3FEB7D6C006015CA), reinterpret(0x3FCC0DB86AD2E000),\n reinterpret(0x3FEB20366E2E338F), reinterpret(0x3FCE840AAFCEE000),\n reinterpret(0x3FEAC57026295039), reinterpret(0x3FD0790AB4678000),\n reinterpret(0x3FEA6D01BC2731DD), reinterpret(0x3FD1AC056801C000),\n reinterpret(0x3FEA16D3BC3FF18B), reinterpret(0x3FD2DB11D4FEE000),\n reinterpret(0x3FE9C2D14967FEAD), reinterpret(0x3FD406464EC58000),\n reinterpret(0x3FE970E4F47C9902), reinterpret(0x3FD52DBE093AF000),\n reinterpret(0x3FE920FB3982BCF2), reinterpret(0x3FD651902050D000),\n reinterpret(0x3FE8D30187F759F1), reinterpret(0x3FD771D2CDEAF000),\n reinterpret(0x3FE886E5EBB9F66D), reinterpret(0x3FD88E9C857D9000),\n reinterpret(0x3FE83C97B658B994), reinterpret(0x3FD9A80155E16000),\n reinterpret(0x3FE7F405FFC61022), reinterpret(0x3FDABE186ED3D000),\n reinterpret(0x3FE7AD22181415CA), reinterpret(0x3FDBD0F2AEA0E000),\n reinterpret(0x3FE767DCF99EFF8C), reinterpret(0x3FDCE0A43DBF4000)\n]);\n\n// @ts-ignore: decorator\n@lazy @inline const LOG2_DATA_TAB2 = memory.data([\n // chi , clo\n reinterpret(0x3FE6200012B90A8E), reinterpret(0x3C8904AB0644B605),\n reinterpret(0x3FE66000045734A6), reinterpret(0x3C61FF9BEA62F7A9),\n reinterpret(0x3FE69FFFC325F2C5), reinterpret(0x3C827ECFCB3C90BA),\n reinterpret(0x3FE6E00038B95A04), reinterpret(0x3C88FF8856739326),\n reinterpret(0x3FE71FFFE09994E3), reinterpret(0x3C8AFD40275F82B1),\n reinterpret(0x3FE7600015590E10), reinterpret(0xBC72FD75B4238341),\n reinterpret(0x3FE7A00012655BD5), reinterpret(0x3C7808E67C242B76),\n reinterpret(0x3FE7E0003259E9A6), reinterpret(0xBC6208E426F622B7),\n reinterpret(0x3FE81FFFEDB4B2D2), reinterpret(0xBC8402461EA5C92F),\n reinterpret(0x3FE860002DFAFCC3), reinterpret(0x3C6DF7F4A2F29A1F),\n reinterpret(0x3FE89FFFF78C6B50), reinterpret(0xBC8E0453094995FD),\n reinterpret(0x3FE8E00039671566), reinterpret(0xBC8A04F3BEC77B45),\n reinterpret(0x3FE91FFFE2BF1745), reinterpret(0xBC77FA34400E203C),\n reinterpret(0x3FE95FFFCC5C9FD1), reinterpret(0xBC76FF8005A0695D),\n reinterpret(0x3FE9A0003BBA4767), reinterpret(0x3C70F8C4C4EC7E03),\n reinterpret(0x3FE9DFFFE7B92DA5), reinterpret(0x3C8E7FD9478C4602),\n reinterpret(0x3FEA1FFFD72EFDAF), reinterpret(0xBC6A0C554DCDAE7E),\n reinterpret(0x3FEA5FFFDE04FF95), reinterpret(0x3C867DA98CE9B26B),\n reinterpret(0x3FEA9FFFCA5E8D2B), reinterpret(0xBC8284C9B54C13DE),\n reinterpret(0x3FEADFFFDDAD03EA), reinterpret(0x3C5812C8EA602E3C),\n reinterpret(0x3FEB1FFFF10D3D4D), reinterpret(0xBC8EFADDAD27789C),\n reinterpret(0x3FEB5FFFCE21165A), reinterpret(0x3C53CB1719C61237),\n reinterpret(0x3FEB9FFFD950E674), reinterpret(0x3C73F7D94194CE00),\n reinterpret(0x3FEBE000139CA8AF), reinterpret(0x3C750AC4215D9BC0),\n reinterpret(0x3FEC20005B46DF99), reinterpret(0x3C6BEEA653E9C1C9),\n reinterpret(0x3FEC600040B9F7AE), reinterpret(0xBC7C079F274A70D6),\n reinterpret(0x3FECA0006255FD8A), reinterpret(0xBC7A0B4076E84C1F),\n reinterpret(0x3FECDFFFD94C095D), reinterpret(0x3C88F933F99AB5D7),\n reinterpret(0x3FED1FFFF975D6CF), reinterpret(0xBC582C08665FE1BE),\n reinterpret(0x3FED5FFFA2561C93), reinterpret(0xBC7B04289BD295F3),\n reinterpret(0x3FED9FFF9D228B0C), reinterpret(0x3C870251340FA236),\n reinterpret(0x3FEDE00065BC7E16), reinterpret(0xBC75011E16A4D80C),\n reinterpret(0x3FEE200002F64791), reinterpret(0x3C89802F09EF62E0),\n reinterpret(0x3FEE600057D7A6D8), reinterpret(0xBC7E0B75580CF7FA),\n reinterpret(0x3FEEA00027EDC00C), reinterpret(0xBC8C848309459811),\n reinterpret(0x3FEEE0006CF5CB7C), reinterpret(0xBC8F8027951576F4),\n reinterpret(0x3FEF2000782B7DCC), reinterpret(0xBC8F81D97274538F),\n reinterpret(0x3FEF6000260C450A), reinterpret(0xBC4071002727FFDC),\n reinterpret(0x3FEF9FFFE88CD533), reinterpret(0xBC581BDCE1FDA8B0),\n reinterpret(0x3FEFDFFFD50F8689), reinterpret(0x3C87F91ACB918E6E),\n reinterpret(0x3FF0200004292367), reinterpret(0x3C9B7FF365324681),\n reinterpret(0x3FF05FFFE3E3D668), reinterpret(0x3C86FA08DDAE957B),\n reinterpret(0x3FF0A0000A85A757), reinterpret(0xBC57E2DE80D3FB91),\n reinterpret(0x3FF0E0001A5F3FCC), reinterpret(0xBC91823305C5F014),\n reinterpret(0x3FF11FFFF8AFBAF5), reinterpret(0xBC8BFABB6680BAC2),\n reinterpret(0x3FF15FFFE54D91AD), reinterpret(0xBC9D7F121737E7EF),\n reinterpret(0x3FF1A00011AC36E1), reinterpret(0x3C9C000A0516F5FF),\n reinterpret(0x3FF1E00019C84248), reinterpret(0xBC9082FBE4DA5DA0),\n reinterpret(0x3FF220000FFE5E6E), reinterpret(0xBC88FDD04C9CFB43),\n reinterpret(0x3FF26000269FD891), reinterpret(0x3C8CFE2A7994D182),\n reinterpret(0x3FF2A00029A6E6DA), reinterpret(0xBC700273715E8BC5),\n reinterpret(0x3FF2DFFFE0293E39), reinterpret(0x3C9B7C39DAB2A6F9),\n reinterpret(0x3FF31FFFF7DCF082), reinterpret(0x3C7DF1336EDC5254),\n reinterpret(0x3FF35FFFF05A8B60), reinterpret(0xBC9E03564CCD31EB),\n reinterpret(0x3FF3A0002E0EAECC), reinterpret(0x3C75F0E74BD3A477),\n reinterpret(0x3FF3E000043BB236), reinterpret(0x3C9C7DCB149D8833),\n reinterpret(0x3FF4200002D187FF), reinterpret(0x3C7E08AFCF2D3D28),\n reinterpret(0x3FF460000D387CB1), reinterpret(0x3C820837856599A6),\n reinterpret(0x3FF4A00004569F89), reinterpret(0xBC89FA5C904FBCD2),\n reinterpret(0x3FF4E000043543F3), reinterpret(0xBC781125ED175329),\n reinterpret(0x3FF51FFFCC027F0F), reinterpret(0x3C9883D8847754DC),\n reinterpret(0x3FF55FFFFD87B36F), reinterpret(0xBC8709E731D02807),\n reinterpret(0x3FF59FFFF21DF7BA), reinterpret(0x3C87F79F68727B02),\n reinterpret(0x3FF5DFFFEBFC3481), reinterpret(0xBC9180902E30E93E)\n]);\n\n// @ts-ignore: decorator\n@inline\nexport function log2_lut(x: f64): f64 {\n const N_MASK = (1 << LOG2_TABLE_BITS) - 1;\n\n const\n LO: u64 = 0x3FEEA4AF00000000, // reinterpret(1.0 - 0x1.5b51p-5)\n HI: u64 = 0x3FF0B55900000000; // reinterpret(1.0 + 0x1.6ab2p-5)\n\n const\n InvLn2hi = reinterpret(0x3FF7154765200000), // 0x1.7154765200000p+0\n InvLn2lo = reinterpret(0x3DE705FC2EEFA200), // 0x1.705fc2eefa200p-33\n Ox1p52 = reinterpret(0x4330000000000000); // 0x1p52\n\n const\n B0 = reinterpret(0xBFE71547652B82FE), // -0x1.71547652b82fep-1\n B1 = reinterpret(0x3FDEC709DC3A03F7), // 0x1.ec709dc3a03f7p-2\n B2 = reinterpret(0xBFD71547652B7C3F), // -0x1.71547652b7c3fp-2\n B3 = reinterpret(0x3FD2776C50F05BE4), // 0x1.2776c50f05be4p-2\n B4 = reinterpret(0xBFCEC709DD768FE5), // -0x1.ec709dd768fe5p-3\n B5 = reinterpret(0x3FCA61761EC4E736), // 0x1.a61761ec4e736p-3\n B6 = reinterpret(0xBFC7153FBC64A79B), // -0x1.7153fbc64a79bp-3\n B7 = reinterpret(0x3FC484D154F01B4A), // 0x1.484d154f01b4ap-3\n B8 = reinterpret(0xBFC289E4A72C383C), // -0x1.289e4a72c383cp-3\n B9 = reinterpret(0x3FC0B32F285AEE66); // 0x1.0b32f285aee66p-3\n\n const\n A0 = reinterpret(0xBFE71547652B8339), // -0x1.71547652b8339p-1\n A1 = reinterpret(0x3FDEC709DC3A04BE), // 0x1.ec709dc3a04bep-2\n A2 = reinterpret(0xBFD7154764702FFB), // -0x1.7154764702ffbp-2\n A3 = reinterpret(0x3FD2776C50034C48), // 0x1.2776c50034c48p-2\n A4 = reinterpret(0xBFCEC7B328EA92BC), // -0x1.ec7b328ea92bcp-3\n A5 = reinterpret(0x3FCA6225E117F92E); // 0x1.a6225e117f92ep-3\n\n var ix = reinterpret(x);\n if (ix - LO < HI - LO) {\n let r = x - 1.0;\n // #if __FP_FAST_FMA\n // hi = r * InvLn2hi;\n // lo = r * InvLn2lo + __builtin_fma(r, InvLn2hi, -hi);\n // #else\n let rhi = reinterpret(reinterpret(r) & 0xFFFFFFFF00000000);\n let rlo = r - rhi;\n let hi = rhi * InvLn2hi;\n let lo = rlo * InvLn2hi + r * InvLn2lo;\n // #endif\n let r2 = r * r; // rounding error: 0x1p-62\n let r4 = r2 * r2;\n // Worst-case error is less than 0.54 ULP (0.55 ULP without fma)\n let p = r2 * (B0 + r * B1);\n let y = hi + p;\n lo += hi - y + p;\n lo += r4 * (B2 + r * B3 + r2 * (B4 + r * B5) +\n r4 * (B6 + r * B7 + r2 * (B8 + r * B9)));\n return y + lo;\n }\n var top = (ix >> 48);\n if (top - 0x0010 >= 0x7ff0 - 0x0010) {\n // x < 0x1p-1022 or inf or nan.\n if ((ix << 1) == 0) return -1.0 / (x * x);\n if (ix == 0x7FF0000000000000) return x; // log(inf) == inf\n if ((top & 0x8000) || (top & 0x7FF0) == 0x7FF0) return (x - x) / (x - x);\n // x is subnormal, normalize it.\n ix = reinterpret(x * Ox1p52);\n ix -= u64(52) << 52;\n }\n\n // x = 2^k z; where z is in range [OFF,2*OFF) and exact.\n // The range is split into N subintervals.\n // The ith subinterval contains z and c is near its center.\n var tmp = ix - 0x3FE6000000000000;\n var i = ((tmp >> (52 - LOG2_TABLE_BITS)) & N_MASK);\n var k = tmp >> 52;\n var iz = ix - (tmp & 0xFFF0000000000000);\n\n var invc = load(LOG2_DATA_TAB1 + (i << (1 + alignof())), 0 << alignof()); // T[i].invc;\n var logc = load(LOG2_DATA_TAB1 + (i << (1 + alignof())), 1 << alignof()); // T[i].logc;\n var z = reinterpret(iz);\n var kd = k;\n\n // log2(x) = log2(z/c) + log2(c) + k.\n // r ~= z/c - 1, |r| < 1/(2*N).\n // #if __FP_FAST_FMA\n // \t// rounding error: 0x1p-55/N.\n // \tr = __builtin_fma(z, invc, -1.0);\n // \tt1 = r * InvLn2hi;\n // \tt2 = r * InvLn2lo + __builtin_fma(r, InvLn2hi, -t1);\n // #else\n // rounding error: 0x1p-55/N + 0x1p-65.\n var chi = load(LOG2_DATA_TAB2 + (i << (1 + alignof())), 0 << alignof()); // T[i].chi;\n var clo = load(LOG2_DATA_TAB2 + (i << (1 + alignof())), 1 << alignof()); // T[i].clo;\n\n var r = (z - chi - clo) * invc;\n var rhi = reinterpret(reinterpret(r) & 0xFFFFFFFF00000000);\n var rlo = r - rhi;\n var t1 = rhi * InvLn2hi;\n var t2 = rlo * InvLn2hi + r * InvLn2lo;\n // #endif\n\n // hi + lo = r/ln2 + log2(c) + k\n var t3 = kd + logc;\n var hi = t3 + t1;\n var lo = t3 - hi + t1 + t2;\n\n // log2(r+1) = r/ln2 + r^2*poly(r)\n // Evaluation is optimized assuming superscalar pipelined execution\n var r2 = r * r; // rounding error: 0x1p-54/N^2\n // Worst-case error if |y| > 0x1p-4: 0.547 ULP (0.550 ULP without fma).\n // ~ 0.5 + 2/N/ln2 + abs-poly-error*0x1p56 ULP (+ 0.003 ULP without fma).\n var p = A0 + r * A1 + r2 * (A2 + r * A3) + (r2 * r2) * (A4 + r * A5);\n return lo + r2 * p + hi;\n}\n\n//\n// Lookup data for log. See: https://git.musl-libc.org/cgit/musl/tree/src/math/log.c\n//\n\n// @ts-ignore: decorator\n@inline const LOG_TABLE_BITS = 7;\n\n/* Algorithm:\n\n x = 2^k z\n log(x) = k ln2 + log(c) + log(z/c)\n log(z/c) = poly(z/c - 1)\n\nwhere z is in [1.6p-1; 1.6p0] which is split into N subintervals and z falls\ninto the ith one, then table entries are computed as\n\n tab[i].invc = 1/c\n tab[i].logc = (double)log(c)\n tab2[i].chi = (double)c\n tab2[i].clo = (double)(c - (double)c)\n\nwhere c is near the center of the subinterval and is chosen by trying +-2^29\nfloating point invc candidates around 1/center and selecting one for which\n\n 1) the rounding error in 0x1.8p9 + logc is 0,\n 2) the rounding error in z - chi - clo is < 0x1p-66 and\n 3) the rounding error in (double)log(c) is minimized (< 0x1p-66).\n\nNote: 1) ensures that k*ln2hi + logc can be computed without rounding error,\n2) ensures that z/c - 1 can be computed as (z - chi - clo)*invc with close to\na single rounding error when there is no fast fma for z*invc - 1, 3) ensures\nthat logc + poly(z/c - 1) has small error, however near x == 1 when\n|log(x)| < 0x1p-4, this is not enough so that is special cased.*/\n\n// @ts-ignore: decorator\n@lazy @inline const LOG_DATA_TAB1 = memory.data([\n // invc , logc\n reinterpret(0x3FF734F0C3E0DE9F), reinterpret(0xBFD7CC7F79E69000),\n reinterpret(0x3FF713786A2CE91F), reinterpret(0xBFD76FEEC20D0000),\n reinterpret(0x3FF6F26008FAB5A0), reinterpret(0xBFD713E31351E000),\n reinterpret(0x3FF6D1A61F138C7D), reinterpret(0xBFD6B85B38287800),\n reinterpret(0x3FF6B1490BC5B4D1), reinterpret(0xBFD65D5590807800),\n reinterpret(0x3FF69147332F0CBA), reinterpret(0xBFD602D076180000),\n reinterpret(0x3FF6719F18224223), reinterpret(0xBFD5A8CA86909000),\n reinterpret(0x3FF6524F99A51ED9), reinterpret(0xBFD54F4356035000),\n reinterpret(0x3FF63356AA8F24C4), reinterpret(0xBFD4F637C36B4000),\n reinterpret(0x3FF614B36B9DDC14), reinterpret(0xBFD49DA7FDA85000),\n reinterpret(0x3FF5F66452C65C4C), reinterpret(0xBFD445923989A800),\n reinterpret(0x3FF5D867B5912C4F), reinterpret(0xBFD3EDF439B0B800),\n reinterpret(0x3FF5BABCCB5B90DE), reinterpret(0xBFD396CE448F7000),\n reinterpret(0x3FF59D61F2D91A78), reinterpret(0xBFD3401E17BDA000),\n reinterpret(0x3FF5805612465687), reinterpret(0xBFD2E9E2EF468000),\n reinterpret(0x3FF56397CEE76BD3), reinterpret(0xBFD2941B3830E000),\n reinterpret(0x3FF54725E2A77F93), reinterpret(0xBFD23EC58CDA8800),\n reinterpret(0x3FF52AFF42064583), reinterpret(0xBFD1E9E129279000),\n reinterpret(0x3FF50F22DBB2BDDF), reinterpret(0xBFD1956D2B48F800),\n reinterpret(0x3FF4F38F4734DED7), reinterpret(0xBFD141679AB9F800),\n reinterpret(0x3FF4D843CFDE2840), reinterpret(0xBFD0EDD094EF9800),\n reinterpret(0x3FF4BD3EC078A3C8), reinterpret(0xBFD09AA518DB1000),\n reinterpret(0x3FF4A27FC3E0258A), reinterpret(0xBFD047E65263B800),\n reinterpret(0x3FF4880524D48434), reinterpret(0xBFCFEB224586F000),\n reinterpret(0x3FF46DCE1B192D0B), reinterpret(0xBFCF474A7517B000),\n reinterpret(0x3FF453D9D3391854), reinterpret(0xBFCEA4443D103000),\n reinterpret(0x3FF43A2744B4845A), reinterpret(0xBFCE020D44E9B000),\n reinterpret(0x3FF420B54115F8FB), reinterpret(0xBFCD60A22977F000),\n reinterpret(0x3FF40782DA3EF4B1), reinterpret(0xBFCCC00104959000),\n reinterpret(0x3FF3EE8F5D57FE8F), reinterpret(0xBFCC202956891000),\n reinterpret(0x3FF3D5D9A00B4CE9), reinterpret(0xBFCB81178D811000),\n reinterpret(0x3FF3BD60C010C12B), reinterpret(0xBFCAE2C9CCD3D000),\n reinterpret(0x3FF3A5242B75DAB8), reinterpret(0xBFCA45402E129000),\n reinterpret(0x3FF38D22CD9FD002), reinterpret(0xBFC9A877681DF000),\n reinterpret(0x3FF3755BC5847A1C), reinterpret(0xBFC90C6D69483000),\n reinterpret(0x3FF35DCE49AD36E2), reinterpret(0xBFC87120A645C000),\n reinterpret(0x3FF34679984DD440), reinterpret(0xBFC7D68FB4143000),\n reinterpret(0x3FF32F5CCEFFCB24), reinterpret(0xBFC73CB83C627000),\n reinterpret(0x3FF3187775A10D49), reinterpret(0xBFC6A39A9B376000),\n reinterpret(0x3FF301C8373E3990), reinterpret(0xBFC60B3154B7A000),\n reinterpret(0x3FF2EB4EBB95F841), reinterpret(0xBFC5737D76243000),\n reinterpret(0x3FF2D50A0219A9D1), reinterpret(0xBFC4DC7B8FC23000),\n reinterpret(0x3FF2BEF9A8B7FD2A), reinterpret(0xBFC4462C51D20000),\n reinterpret(0x3FF2A91C7A0C1BAB), reinterpret(0xBFC3B08ABC830000),\n reinterpret(0x3FF293726014B530), reinterpret(0xBFC31B996B490000),\n reinterpret(0x3FF27DFA5757A1F5), reinterpret(0xBFC2875490A44000),\n reinterpret(0x3FF268B39B1D3BBF), reinterpret(0xBFC1F3B9F879A000),\n reinterpret(0x3FF2539D838FF5BD), reinterpret(0xBFC160C8252CA000),\n reinterpret(0x3FF23EB7AAC9083B), reinterpret(0xBFC0CE7F57F72000),\n reinterpret(0x3FF22A012BA940B6), reinterpret(0xBFC03CDC49FEA000),\n reinterpret(0x3FF2157996CC4132), reinterpret(0xBFBF57BDBC4B8000),\n reinterpret(0x3FF201201DD2FC9B), reinterpret(0xBFBE370896404000),\n reinterpret(0x3FF1ECF4494D480B), reinterpret(0xBFBD17983EF94000),\n reinterpret(0x3FF1D8F5528F6569), reinterpret(0xBFBBF9674ED8A000),\n reinterpret(0x3FF1C52311577E7C), reinterpret(0xBFBADC79202F6000),\n reinterpret(0x3FF1B17C74CB26E9), reinterpret(0xBFB9C0C3E7288000),\n reinterpret(0x3FF19E010C2C1AB6), reinterpret(0xBFB8A646B372C000),\n reinterpret(0x3FF18AB07BB670BD), reinterpret(0xBFB78D01B3AC0000),\n reinterpret(0x3FF1778A25EFBCB6), reinterpret(0xBFB674F145380000),\n reinterpret(0x3FF1648D354C31DA), reinterpret(0xBFB55E0E6D878000),\n reinterpret(0x3FF151B990275FDD), reinterpret(0xBFB4485CDEA1E000),\n reinterpret(0x3FF13F0EA432D24C), reinterpret(0xBFB333D94D6AA000),\n reinterpret(0x3FF12C8B7210F9DA), reinterpret(0xBFB22079F8C56000),\n reinterpret(0x3FF11A3028ECB531), reinterpret(0xBFB10E4698622000),\n reinterpret(0x3FF107FBDA8434AF), reinterpret(0xBFAFFA6C6AD20000),\n reinterpret(0x3FF0F5EE0F4E6BB3), reinterpret(0xBFADDA8D4A774000),\n reinterpret(0x3FF0E4065D2A9FCE), reinterpret(0xBFABBCECE4850000),\n reinterpret(0x3FF0D244632CA521), reinterpret(0xBFA9A1894012C000),\n reinterpret(0x3FF0C0A77CE2981A), reinterpret(0xBFA788583302C000),\n reinterpret(0x3FF0AF2F83C636D1), reinterpret(0xBFA5715E67D68000),\n reinterpret(0x3FF09DDB98A01339), reinterpret(0xBFA35C8A49658000),\n reinterpret(0x3FF08CABAF52E7DF), reinterpret(0xBFA149E364154000),\n reinterpret(0x3FF07B9F2F4E28FB), reinterpret(0xBF9E72C082EB8000),\n reinterpret(0x3FF06AB58C358F19), reinterpret(0xBF9A55F152528000),\n reinterpret(0x3FF059EEA5ECF92C), reinterpret(0xBF963D62CF818000),\n reinterpret(0x3FF04949CDD12C90), reinterpret(0xBF9228FB8CAA0000),\n reinterpret(0x3FF038C6C6F0ADA9), reinterpret(0xBF8C317B20F90000),\n reinterpret(0x3FF02865137932A9), reinterpret(0xBF8419355DAA0000),\n reinterpret(0x3FF0182427EA7348), reinterpret(0xBF781203C2EC0000),\n reinterpret(0x3FF008040614B195), reinterpret(0xBF60040979240000),\n reinterpret(0x3FEFE01FF726FA1A), reinterpret(0x3F6FEFF384900000),\n reinterpret(0x3FEFA11CC261EA74), reinterpret(0x3F87DC41353D0000),\n reinterpret(0x3FEF6310B081992E), reinterpret(0x3F93CEA3C4C28000),\n reinterpret(0x3FEF25F63CEEADCD), reinterpret(0x3F9B9FC114890000),\n reinterpret(0x3FEEE9C8039113E7), reinterpret(0x3FA1B0D8CE110000),\n reinterpret(0x3FEEAE8078CBB1AB), reinterpret(0x3FA58A5BD001C000),\n reinterpret(0x3FEE741AA29D0C9B), reinterpret(0x3FA95C8340D88000),\n reinterpret(0x3FEE3A91830A99B5), reinterpret(0x3FAD276AEF578000),\n reinterpret(0x3FEE01E009609A56), reinterpret(0x3FB07598E598C000),\n reinterpret(0x3FEDCA01E577BB98), reinterpret(0x3FB253F5E30D2000),\n reinterpret(0x3FED92F20B7C9103), reinterpret(0x3FB42EDD8B380000),\n reinterpret(0x3FED5CAC66FB5CCE), reinterpret(0x3FB606598757C000),\n reinterpret(0x3FED272CAA5EDE9D), reinterpret(0x3FB7DA76356A0000),\n reinterpret(0x3FECF26E3E6B2CCD), reinterpret(0x3FB9AB434E1C6000),\n reinterpret(0x3FECBE6DA2A77902), reinterpret(0x3FBB78C7BB0D6000),\n reinterpret(0x3FEC8B266D37086D), reinterpret(0x3FBD431332E72000),\n reinterpret(0x3FEC5894BD5D5804), reinterpret(0x3FBF0A3171DE6000),\n reinterpret(0x3FEC26B533BB9F8C), reinterpret(0x3FC067152B914000),\n reinterpret(0x3FEBF583EEECE73F), reinterpret(0x3FC147858292B000),\n reinterpret(0x3FEBC4FD75DB96C1), reinterpret(0x3FC2266ECDCA3000),\n reinterpret(0x3FEB951E0C864A28), reinterpret(0x3FC303D7A6C55000),\n reinterpret(0x3FEB65E2C5EF3E2C), reinterpret(0x3FC3DFC33C331000),\n reinterpret(0x3FEB374867C9888B), reinterpret(0x3FC4BA366B7A8000),\n reinterpret(0x3FEB094B211D304A), reinterpret(0x3FC5933928D1F000),\n reinterpret(0x3FEADBE885F2EF7E), reinterpret(0x3FC66ACD2418F000),\n reinterpret(0x3FEAAF1D31603DA2), reinterpret(0x3FC740F8EC669000),\n reinterpret(0x3FEA82E63FD358A7), reinterpret(0x3FC815C0F51AF000),\n reinterpret(0x3FEA5740EF09738B), reinterpret(0x3FC8E92954F68000),\n reinterpret(0x3FEA2C2A90AB4B27), reinterpret(0x3FC9BB3602F84000),\n reinterpret(0x3FEA01A01393F2D1), reinterpret(0x3FCA8BED1C2C0000),\n reinterpret(0x3FE9D79F24DB3C1B), reinterpret(0x3FCB5B515C01D000),\n reinterpret(0x3FE9AE2505C7B190), reinterpret(0x3FCC2967CCBCC000),\n reinterpret(0x3FE9852EF297CE2F), reinterpret(0x3FCCF635D5486000),\n reinterpret(0x3FE95CBAEEA44B75), reinterpret(0x3FCDC1BD3446C000),\n reinterpret(0x3FE934C69DE74838), reinterpret(0x3FCE8C01B8CFE000),\n reinterpret(0x3FE90D4F2F6752E6), reinterpret(0x3FCF5509C0179000),\n reinterpret(0x3FE8E6528EFFD79D), reinterpret(0x3FD00E6C121FB800),\n reinterpret(0x3FE8BFCE9FCC007C), reinterpret(0x3FD071B80E93D000),\n reinterpret(0x3FE899C0DABEC30E), reinterpret(0x3FD0D46B9E867000),\n reinterpret(0x3FE87427AA2317FB), reinterpret(0x3FD13687334BD000),\n reinterpret(0x3FE84F00ACB39A08), reinterpret(0x3FD1980D67234800),\n reinterpret(0x3FE82A49E8653E55), reinterpret(0x3FD1F8FFE0CC8000),\n reinterpret(0x3FE8060195F40260), reinterpret(0x3FD2595FD7636800),\n reinterpret(0x3FE7E22563E0A329), reinterpret(0x3FD2B9300914A800),\n reinterpret(0x3FE7BEB377DCB5AD), reinterpret(0x3FD3187210436000),\n reinterpret(0x3FE79BAA679725C2), reinterpret(0x3FD377266DEC1800),\n reinterpret(0x3FE77907F2170657), reinterpret(0x3FD3D54FFBAF3000),\n reinterpret(0x3FE756CADBD6130C), reinterpret(0x3FD432EEE32FE000)\n]);\n\n// @ts-ignore: decorator\n@lazy @inline const LOG_DATA_TAB2 = memory.data([\n // chi , clo\n reinterpret(0x3FE61000014FB66B), reinterpret(0x3C7E026C91425B3C),\n reinterpret(0x3FE63000034DB495), reinterpret(0x3C8DBFEA48005D41),\n reinterpret(0x3FE650000D94D478), reinterpret(0x3C8E7FA786D6A5B7),\n reinterpret(0x3FE67000074E6FAD), reinterpret(0x3C61FCEA6B54254C),\n reinterpret(0x3FE68FFFFEDF0FAE), reinterpret(0xBC7C7E274C590EFD),\n reinterpret(0x3FE6B0000763C5BC), reinterpret(0xBC8AC16848DCDA01),\n reinterpret(0x3FE6D0001E5CC1F6), reinterpret(0x3C833F1C9D499311),\n reinterpret(0x3FE6EFFFEB05F63E), reinterpret(0xBC7E80041AE22D53),\n reinterpret(0x3FE710000E869780), reinterpret(0x3C7BFF6671097952),\n reinterpret(0x3FE72FFFFC67E912), reinterpret(0x3C8C00E226BD8724),\n reinterpret(0x3FE74FFFDF81116A), reinterpret(0xBC6E02916EF101D2),\n reinterpret(0x3FE770000F679C90), reinterpret(0xBC67FC71CD549C74),\n reinterpret(0x3FE78FFFFA7EC835), reinterpret(0x3C81BEC19EF50483),\n reinterpret(0x3FE7AFFFFE20C2E6), reinterpret(0xBC707E1729CC6465),\n reinterpret(0x3FE7CFFFED3FC900), reinterpret(0xBC808072087B8B1C),\n reinterpret(0x3FE7EFFFE9261A76), reinterpret(0x3C8DC0286D9DF9AE),\n reinterpret(0x3FE81000049CA3E8), reinterpret(0x3C897FD251E54C33),\n reinterpret(0x3FE8300017932C8F), reinterpret(0xBC8AFEE9B630F381),\n reinterpret(0x3FE850000633739C), reinterpret(0x3C89BFBF6B6535BC),\n reinterpret(0x3FE87000204289C6), reinterpret(0xBC8BBF65F3117B75),\n reinterpret(0x3FE88FFFEBF57904), reinterpret(0xBC89006EA23DCB57),\n reinterpret(0x3FE8B00022BC04DF), reinterpret(0xBC7D00DF38E04B0A),\n reinterpret(0x3FE8CFFFE50C1B8A), reinterpret(0xBC88007146FF9F05),\n reinterpret(0x3FE8EFFFFC918E43), reinterpret(0x3C83817BD07A7038),\n reinterpret(0x3FE910001EFA5FC7), reinterpret(0x3C893E9176DFB403),\n reinterpret(0x3FE9300013467BB9), reinterpret(0x3C7F804E4B980276),\n reinterpret(0x3FE94FFFE6EE076F), reinterpret(0xBC8F7EF0D9FF622E),\n reinterpret(0x3FE96FFFDE3C12D1), reinterpret(0xBC7082AA962638BA),\n reinterpret(0x3FE98FFFF4458A0D), reinterpret(0xBC87801B9164A8EF),\n reinterpret(0x3FE9AFFFDD982E3E), reinterpret(0xBC8740E08A5A9337),\n reinterpret(0x3FE9CFFFED49FB66), reinterpret(0x3C3FCE08C19BE000),\n reinterpret(0x3FE9F00020F19C51), reinterpret(0xBC8A3FAA27885B0A),\n reinterpret(0x3FEA10001145B006), reinterpret(0x3C74FF489958DA56),\n reinterpret(0x3FEA300007BBF6FA), reinterpret(0x3C8CBEAB8A2B6D18),\n reinterpret(0x3FEA500010971D79), reinterpret(0x3C88FECADD787930),\n reinterpret(0x3FEA70001DF52E48), reinterpret(0xBC8F41763DD8ABDB),\n reinterpret(0x3FEA90001C593352), reinterpret(0xBC8EBF0284C27612),\n reinterpret(0x3FEAB0002A4F3E4B), reinterpret(0xBC69FD043CFF3F5F),\n reinterpret(0x3FEACFFFD7AE1ED1), reinterpret(0xBC823EE7129070B4),\n reinterpret(0x3FEAEFFFEE510478), reinterpret(0x3C6A063EE00EDEA3),\n reinterpret(0x3FEB0FFFDB650D5B), reinterpret(0x3C5A06C8381F0AB9),\n reinterpret(0x3FEB2FFFFEAACA57), reinterpret(0xBC79011E74233C1D),\n reinterpret(0x3FEB4FFFD995BADC), reinterpret(0xBC79FF1068862A9F),\n reinterpret(0x3FEB7000249E659C), reinterpret(0x3C8AFF45D0864F3E),\n reinterpret(0x3FEB8FFFF9871640), reinterpret(0x3C7CFE7796C2C3F9),\n reinterpret(0x3FEBAFFFD204CB4F), reinterpret(0xBC63FF27EEF22BC4),\n reinterpret(0x3FEBCFFFD2415C45), reinterpret(0xBC6CFFB7EE3BEA21),\n reinterpret(0x3FEBEFFFF86309DF), reinterpret(0xBC814103972E0B5C),\n reinterpret(0x3FEC0FFFE1B57653), reinterpret(0x3C8BC16494B76A19),\n reinterpret(0x3FEC2FFFF1FA57E3), reinterpret(0xBC64FEEF8D30C6ED),\n reinterpret(0x3FEC4FFFDCBFE424), reinterpret(0xBC843F68BCEC4775),\n reinterpret(0x3FEC6FFFED54B9F7), reinterpret(0x3C847EA3F053E0EC),\n reinterpret(0x3FEC8FFFEB998FD5), reinterpret(0x3C7383068DF992F1),\n reinterpret(0x3FECB0002125219A), reinterpret(0xBC68FD8E64180E04),\n reinterpret(0x3FECCFFFDD94469C), reinterpret(0x3C8E7EBE1CC7EA72),\n reinterpret(0x3FECEFFFEAFDC476), reinterpret(0x3C8EBE39AD9F88FE),\n reinterpret(0x3FED1000169AF82B), reinterpret(0x3C757D91A8B95A71),\n reinterpret(0x3FED30000D0FF71D), reinterpret(0x3C89C1906970C7DA),\n reinterpret(0x3FED4FFFEA790FC4), reinterpret(0xBC580E37C558FE0C),\n reinterpret(0x3FED70002EDC87E5), reinterpret(0xBC7F80D64DC10F44),\n reinterpret(0x3FED900021DC82AA), reinterpret(0xBC747C8F94FD5C5C),\n reinterpret(0x3FEDAFFFD86B0283), reinterpret(0x3C8C7F1DC521617E),\n reinterpret(0x3FEDD000296C4739), reinterpret(0x3C88019EB2FFB153),\n reinterpret(0x3FEDEFFFE54490F5), reinterpret(0x3C6E00D2C652CC89),\n reinterpret(0x3FEE0FFFCDABF694), reinterpret(0xBC7F8340202D69D2),\n reinterpret(0x3FEE2FFFDB52C8DD), reinterpret(0x3C7B00C1CA1B0864),\n reinterpret(0x3FEE4FFFF24216EF), reinterpret(0x3C72FFA8B094AB51),\n reinterpret(0x3FEE6FFFE88A5E11), reinterpret(0xBC57F673B1EFBE59),\n reinterpret(0x3FEE9000119EFF0D), reinterpret(0xBC84808D5E0BC801),\n reinterpret(0x3FEEAFFFDFA51744), reinterpret(0x3C780006D54320B5),\n reinterpret(0x3FEED0001A127FA1), reinterpret(0xBC5002F860565C92),\n reinterpret(0x3FEEF00007BABCC4), reinterpret(0xBC8540445D35E611),\n reinterpret(0x3FEF0FFFF57A8D02), reinterpret(0xBC4FFB3139EF9105),\n reinterpret(0x3FEF30001EE58AC7), reinterpret(0x3C8A81ACF2731155),\n reinterpret(0x3FEF4FFFF5823494), reinterpret(0x3C8A3F41D4D7C743),\n reinterpret(0x3FEF6FFFFCA94C6B), reinterpret(0xBC6202F41C987875),\n reinterpret(0x3FEF8FFFE1F9C441), reinterpret(0x3C777DD1F477E74B),\n reinterpret(0x3FEFAFFFD2E0E37E), reinterpret(0xBC6F01199A7CA331),\n reinterpret(0x3FEFD0001C77E49E), reinterpret(0x3C7181EE4BCEACB1),\n reinterpret(0x3FEFEFFFF7E0C331), reinterpret(0xBC6E05370170875A),\n reinterpret(0x3FF00FFFF465606E), reinterpret(0xBC8A7EAD491C0ADA),\n reinterpret(0x3FF02FFFF3867A58), reinterpret(0xBC977F69C3FCB2E0),\n reinterpret(0x3FF04FFFFDFC0D17), reinterpret(0x3C97BFFE34CB945B),\n reinterpret(0x3FF0700003CD4D82), reinterpret(0x3C820083C0E456CB),\n reinterpret(0x3FF08FFFF9F2CBE8), reinterpret(0xBC6DFFDFBE37751A),\n reinterpret(0x3FF0B000010CDA65), reinterpret(0xBC913F7FAEE626EB),\n reinterpret(0x3FF0D00001A4D338), reinterpret(0x3C807DFA79489FF7),\n reinterpret(0x3FF0EFFFFADAFDFD), reinterpret(0xBC77040570D66BC0),\n reinterpret(0x3FF110000BBAFD96), reinterpret(0x3C8E80D4846D0B62),\n reinterpret(0x3FF12FFFFAE5F45D), reinterpret(0x3C9DBFFA64FD36EF),\n reinterpret(0x3FF150000DD59AD9), reinterpret(0x3C9A0077701250AE),\n reinterpret(0x3FF170000F21559A), reinterpret(0x3C8DFDF9E2E3DEEE),\n reinterpret(0x3FF18FFFFC275426), reinterpret(0x3C910030DC3B7273),\n reinterpret(0x3FF1B000123D3C59), reinterpret(0x3C997F7980030188),\n reinterpret(0x3FF1CFFFF8299EB7), reinterpret(0xBC65F932AB9F8C67),\n reinterpret(0x3FF1EFFFF48AD400), reinterpret(0x3C937FBF9DA75BEB),\n reinterpret(0x3FF210000C8B86A4), reinterpret(0x3C9F806B91FD5B22),\n reinterpret(0x3FF2300003854303), reinterpret(0x3C93FFC2EB9FBF33),\n reinterpret(0x3FF24FFFFFBCF684), reinterpret(0x3C7601E77E2E2E72),\n reinterpret(0x3FF26FFFF52921D9), reinterpret(0x3C7FFCBB767F0C61),\n reinterpret(0x3FF2900014933A3C), reinterpret(0xBC7202CA3C02412B),\n reinterpret(0x3FF2B00014556313), reinterpret(0xBC92808233F21F02),\n reinterpret(0x3FF2CFFFEBFE523B), reinterpret(0xBC88FF7E384FDCF2),\n reinterpret(0x3FF2F0000BB8AD96), reinterpret(0xBC85FF51503041C5),\n reinterpret(0x3FF30FFFFB7AE2AF), reinterpret(0xBC810071885E289D),\n reinterpret(0x3FF32FFFFEAC5F7F), reinterpret(0xBC91FF5D3FB7B715),\n reinterpret(0x3FF350000CA66756), reinterpret(0x3C957F82228B82BD),\n reinterpret(0x3FF3700011FBF721), reinterpret(0x3C8000BAC40DD5CC),\n reinterpret(0x3FF38FFFF9592FB9), reinterpret(0xBC943F9D2DB2A751),\n reinterpret(0x3FF3B00004DDD242), reinterpret(0x3C857F6B707638E1),\n reinterpret(0x3FF3CFFFF5B2C957), reinterpret(0x3C7A023A10BF1231),\n reinterpret(0x3FF3EFFFEAB0B418), reinterpret(0x3C987F6D66B152B0),\n reinterpret(0x3FF410001532AFF4), reinterpret(0x3C67F8375F198524),\n reinterpret(0x3FF4300017478B29), reinterpret(0x3C8301E672DC5143),\n reinterpret(0x3FF44FFFE795B463), reinterpret(0x3C89FF69B8B2895A),\n reinterpret(0x3FF46FFFE80475E0), reinterpret(0xBC95C0B19BC2F254),\n reinterpret(0x3FF48FFFEF6FC1E7), reinterpret(0x3C9B4009F23A2A72),\n reinterpret(0x3FF4AFFFE5BEA704), reinterpret(0xBC94FFB7BF0D7D45),\n reinterpret(0x3FF4D000171027DE), reinterpret(0xBC99C06471DC6A3D),\n reinterpret(0x3FF4F0000FF03EE2), reinterpret(0x3C977F890B85531C),\n reinterpret(0x3FF5100012DC4BD1), reinterpret(0x3C6004657166A436),\n reinterpret(0x3FF530001605277A), reinterpret(0xBC96BFCECE233209),\n reinterpret(0x3FF54FFFECDB704C), reinterpret(0xBC8902720505A1D7),\n reinterpret(0x3FF56FFFEF5F54A9), reinterpret(0x3C9BBFE60EC96412),\n reinterpret(0x3FF5900017E61012), reinterpret(0x3C887EC581AFEF90),\n reinterpret(0x3FF5B00003C93E92), reinterpret(0xBC9F41080ABF0CC0),\n reinterpret(0x3FF5D0001D4919BC), reinterpret(0xBC98812AFB254729),\n reinterpret(0x3FF5EFFFE7B87A89), reinterpret(0xBC947EB780ED6904)\n]);\n\n// @ts-ignore: decorator\n@inline\nexport function log_lut(x: f64): f64 {\n const N_MASK = (1 << LOG_TABLE_BITS) - 1;\n\n const\n B0 = reinterpret(0xBFE0000000000000), // -0x1p-1\n B1 = reinterpret(0x3FD5555555555577), // 0x1.5555555555577p-2\n B2 = reinterpret(0xBFCFFFFFFFFFFDCB), // -0x1.ffffffffffdcbp-3\n B3 = reinterpret(0x3FC999999995DD0C), // 0x1.999999995dd0cp-3\n B4 = reinterpret(0xBFC55555556745A7), // -0x1.55555556745a7p-3\n B5 = reinterpret(0x3FC24924A344DE30), // 0x1.24924a344de3p-3\n B6 = reinterpret(0xBFBFFFFFA4423D65), // -0x1.fffffa4423d65p-4\n B7 = reinterpret(0x3FBC7184282AD6CA), // 0x1.c7184282ad6cap-4\n B8 = reinterpret(0xBFB999EB43B068FF), // -0x1.999eb43b068ffp-4\n B9 = reinterpret(0x3FB78182F7AFD085), // 0x1.78182f7afd085p-4\n B10 = reinterpret(0xBFB5521375D145CD); // -0x1.5521375d145cdp-4\n\n const\n A0 = reinterpret(0xBFE0000000000001), // -0x1.0000000000001p-1\n A1 = reinterpret(0x3FD555555551305B), // 0x1.555555551305bp-2\n A2 = reinterpret(0xBFCFFFFFFFEB4590), // -0x1.fffffffeb459p-3\n A3 = reinterpret(0x3FC999B324F10111), // 0x1.999b324f10111p-3\n A4 = reinterpret(0xBFC55575E506C89F); // -0x1.55575e506c89fp-3\n\n const\n LO: u64 = 0x3FEE000000000000,\n HI: u64 = 0x3FF1090000000000;\n\n const\n Ln2hi = reinterpret(0x3FE62E42FEFA3800), // 0x1.62e42fefa3800p-1\n Ln2lo = reinterpret(0x3D2EF35793C76730), // 0x1.ef35793c76730p-45\n Ox1p27 = reinterpret(0x41A0000000000000), // 0x1p27\n Ox1p52 = reinterpret(0x4330000000000000); // 0x1p52\n\n var ix = reinterpret(x);\n if (ix - LO < HI - LO) {\n let r = x - 1.0;\n let r2 = r * r;\n let r3 = r2 * r;\n let y =\n r3 * (B1 + r * B2 + r2 * B3 +\n r3 * (B4 + r * B5 + r2 * B6 +\n r3 * (B7 + r * B8 + r2 * B9 + r3 * B10)));\n // Worst-case error is around 0.507 ULP\n let w = r * Ox1p27;\n let rhi = r + w - w;\n let rlo = r - rhi;\n w = rhi * rhi * B0; // B[0] == -0.5\n let hi = r + w;\n let lo = r - hi + w;\n lo += B0 * rlo * (rhi + r);\n return y + lo + hi;\n }\n var top = u32(ix >> 48);\n if (top - 0x0010 >= 0x7FF0 - 0x0010) {\n // x < 0x1p-1022 or inf or nan\n if ((ix << 1) == 0) return -1.0 / (x * x);\n if (ix == reinterpret(Infinity)) return x; // log(inf) == inf\n if ((top & 0x8000) || (top & 0x7FF0) == 0x7FF0) return (x - x) / (x - x);\n // x is subnormal, normalize it\n ix = reinterpret(x * Ox1p52);\n ix -= u64(52) << 52;\n }\n\n // x = 2^k z; where z is in range [OFF,2*OFF) and exact.\n // The range is split into N subintervals.\n // The ith subinterval contains z and c is near its center.\n var tmp = ix - 0x3FE6000000000000;\n var i = ((tmp >> (52 - LOG_TABLE_BITS)) & N_MASK);\n var k = tmp >> 52;\n var iz = ix - (tmp & (u64(0xFFF) << 52));\n\n var invc = load(LOG_DATA_TAB1 + (i << (1 + alignof())), 0 << alignof()); // T[i].invc;\n var logc = load(LOG_DATA_TAB1 + (i << (1 + alignof())), 1 << alignof()); // T[i].logc;\n var z = reinterpret(iz);\n\n // log(x) = log1p(z/c-1) + log(c) + k*Ln2.\n // r ~= z/c - 1, |r| < 1/(2*N)\n // #if __FP_FAST_FMA\n // \t// rounding error: 0x1p-55/N\n // \tr = __builtin_fma(z, invc, -1.0);\n // #else\n // rounding error: 0x1p-55/N + 0x1p-66\n const chi = load(LOG_DATA_TAB2 + (i << (1 + alignof())), 0 << alignof()); // T2[i].chi\n const clo = load(LOG_DATA_TAB2 + (i << (1 + alignof())), 1 << alignof()); // T2[i].clo\n var r = (z - chi - clo) * invc;\n // #endif\n var kd = k;\n\n // hi + lo = r + log(c) + k*Ln2\n var w = kd * Ln2hi + logc;\n var hi = w + r;\n var lo = w - hi + r + kd * Ln2lo;\n\n // log(x) = lo + (log1p(r) - r) + hi\n var r2 = r * r; // rounding error: 0x1p-54/N^2\n // Worst case error if |y| > 0x1p-5:\n // 0.5 + 4.13/N + abs-poly-error*2^57 ULP (+ 0.002 ULP without fma)\n // Worst case error if |y| > 0x1p-4:\n // 0.5 + 2.06/N + abs-poly-error*2^56 ULP (+ 0.001 ULP without fma).\n return lo + r2 * A0 + r * r2 * (A1 + r * A2 + r2 * (A3 + r * A4)) + hi;\n}\n\n//\n// Lookup data for pow. See: https://git.musl-libc.org/cgit/musl/tree/src/math/pow.c\n//\n\n// @ts-ignore: decorator\n@inline const POW_LOG_TABLE_BITS = 7;\n\n/* Algorithm:\n\n x = 2^k z\n log(x) = k ln2 + log(c) + log(z/c)\n log(z/c) = poly(z/c - 1)\n\nwhere z is in [0x1.69555p-1; 0x1.69555p0] which is split into N subintervals\nand z falls into the ith one, then table entries are computed as\n\n tab[i].invc = 1/c\n tab[i].logc = round(0x1p43*log(c))/0x1p43\n tab[i].logctail = (double)(log(c) - logc)\n\nwhere c is chosen near the center of the subinterval such that 1/c has only a\nfew precision bits so z/c - 1 is exactly representible as double:\n\n 1/c = center < 1 ? round(N/center)/N : round(2*N/center)/N/2\n\nNote: |z/c - 1| < 1/N for the chosen c, |log(c) - logc - logctail| < 0x1p-97,\nthe last few bits of logc are rounded away so k*ln2hi + logc has no rounding\nerror and the interval for z is selected such that near x == 1, where log(x)\nis tiny, large cancellation error is avoided in logc + poly(z/c - 1). */\n\n// @ts-ignore: decorator\n@lazy @inline const POW_LOG_DATA_TAB = memory.data([\n // invc ,pad, logc , logctail\n reinterpret(0x3FF6A00000000000), 0, reinterpret(0xBFD62C82F2B9C800), reinterpret(0x3CFAB42428375680),\n reinterpret(0x3FF6800000000000), 0, reinterpret(0xBFD5D1BDBF580800), reinterpret(0xBD1CA508D8E0F720),\n reinterpret(0x3FF6600000000000), 0, reinterpret(0xBFD5767717455800), reinterpret(0xBD2362A4D5B6506D),\n reinterpret(0x3FF6400000000000), 0, reinterpret(0xBFD51AAD872DF800), reinterpret(0xBCE684E49EB067D5),\n reinterpret(0x3FF6200000000000), 0, reinterpret(0xBFD4BE5F95777800), reinterpret(0xBD041B6993293EE0),\n reinterpret(0x3FF6000000000000), 0, reinterpret(0xBFD4618BC21C6000), reinterpret(0x3D13D82F484C84CC),\n reinterpret(0x3FF5E00000000000), 0, reinterpret(0xBFD404308686A800), reinterpret(0x3CDC42F3ED820B3A),\n reinterpret(0x3FF5C00000000000), 0, reinterpret(0xBFD3A64C55694800), reinterpret(0x3D20B1C686519460),\n reinterpret(0x3FF5A00000000000), 0, reinterpret(0xBFD347DD9A988000), reinterpret(0x3D25594DD4C58092),\n reinterpret(0x3FF5800000000000), 0, reinterpret(0xBFD2E8E2BAE12000), reinterpret(0x3D267B1E99B72BD8),\n reinterpret(0x3FF5600000000000), 0, reinterpret(0xBFD2895A13DE8800), reinterpret(0x3D15CA14B6CFB03F),\n reinterpret(0x3FF5600000000000), 0, reinterpret(0xBFD2895A13DE8800), reinterpret(0x3D15CA14B6CFB03F),\n reinterpret(0x3FF5400000000000), 0, reinterpret(0xBFD22941FBCF7800), reinterpret(0xBD165A242853DA76),\n reinterpret(0x3FF5200000000000), 0, reinterpret(0xBFD1C898C1699800), reinterpret(0xBD1FAFBC68E75404),\n reinterpret(0x3FF5000000000000), 0, reinterpret(0xBFD1675CABABA800), reinterpret(0x3D1F1FC63382A8F0),\n reinterpret(0x3FF4E00000000000), 0, reinterpret(0xBFD1058BF9AE4800), reinterpret(0xBD26A8C4FD055A66),\n reinterpret(0x3FF4C00000000000), 0, reinterpret(0xBFD0A324E2739000), reinterpret(0xBD0C6BEE7EF4030E),\n reinterpret(0x3FF4A00000000000), 0, reinterpret(0xBFD0402594B4D000), reinterpret(0xBCF036B89EF42D7F),\n reinterpret(0x3FF4A00000000000), 0, reinterpret(0xBFD0402594B4D000), reinterpret(0xBCF036B89EF42D7F),\n reinterpret(0x3FF4800000000000), 0, reinterpret(0xBFCFB9186D5E4000), reinterpret(0x3D0D572AAB993C87),\n reinterpret(0x3FF4600000000000), 0, reinterpret(0xBFCEF0ADCBDC6000), reinterpret(0x3D2B26B79C86AF24),\n reinterpret(0x3FF4400000000000), 0, reinterpret(0xBFCE27076E2AF000), reinterpret(0xBD172F4F543FFF10),\n reinterpret(0x3FF4200000000000), 0, reinterpret(0xBFCD5C216B4FC000), reinterpret(0x3D21BA91BBCA681B),\n reinterpret(0x3FF4000000000000), 0, reinterpret(0xBFCC8FF7C79AA000), reinterpret(0x3D27794F689F8434),\n reinterpret(0x3FF4000000000000), 0, reinterpret(0xBFCC8FF7C79AA000), reinterpret(0x3D27794F689F8434),\n reinterpret(0x3FF3E00000000000), 0, reinterpret(0xBFCBC286742D9000), reinterpret(0x3D194EB0318BB78F),\n reinterpret(0x3FF3C00000000000), 0, reinterpret(0xBFCAF3C94E80C000), reinterpret(0x3CBA4E633FCD9066),\n reinterpret(0x3FF3A00000000000), 0, reinterpret(0xBFCA23BC1FE2B000), reinterpret(0xBD258C64DC46C1EA),\n reinterpret(0x3FF3A00000000000), 0, reinterpret(0xBFCA23BC1FE2B000), reinterpret(0xBD258C64DC46C1EA),\n reinterpret(0x3FF3800000000000), 0, reinterpret(0xBFC9525A9CF45000), reinterpret(0xBD2AD1D904C1D4E3),\n reinterpret(0x3FF3600000000000), 0, reinterpret(0xBFC87FA06520D000), reinterpret(0x3D2BBDBF7FDBFA09),\n reinterpret(0x3FF3400000000000), 0, reinterpret(0xBFC7AB890210E000), reinterpret(0x3D2BDB9072534A58),\n reinterpret(0x3FF3400000000000), 0, reinterpret(0xBFC7AB890210E000), reinterpret(0x3D2BDB9072534A58),\n reinterpret(0x3FF3200000000000), 0, reinterpret(0xBFC6D60FE719D000), reinterpret(0xBD10E46AA3B2E266),\n reinterpret(0x3FF3000000000000), 0, reinterpret(0xBFC5FF3070A79000), reinterpret(0xBD1E9E439F105039),\n reinterpret(0x3FF3000000000000), 0, reinterpret(0xBFC5FF3070A79000), reinterpret(0xBD1E9E439F105039),\n reinterpret(0x3FF2E00000000000), 0, reinterpret(0xBFC526E5E3A1B000), reinterpret(0xBD20DE8B90075B8F),\n reinterpret(0x3FF2C00000000000), 0, reinterpret(0xBFC44D2B6CCB8000), reinterpret(0x3D170CC16135783C),\n reinterpret(0x3FF2C00000000000), 0, reinterpret(0xBFC44D2B6CCB8000), reinterpret(0x3D170CC16135783C),\n reinterpret(0x3FF2A00000000000), 0, reinterpret(0xBFC371FC201E9000), reinterpret(0x3CF178864D27543A),\n reinterpret(0x3FF2800000000000), 0, reinterpret(0xBFC29552F81FF000), reinterpret(0xBD248D301771C408),\n reinterpret(0x3FF2600000000000), 0, reinterpret(0xBFC1B72AD52F6000), reinterpret(0xBD2E80A41811A396),\n reinterpret(0x3FF2600000000000), 0, reinterpret(0xBFC1B72AD52F6000), reinterpret(0xBD2E80A41811A396),\n reinterpret(0x3FF2400000000000), 0, reinterpret(0xBFC0D77E7CD09000), reinterpret(0x3D0A699688E85BF4),\n reinterpret(0x3FF2400000000000), 0, reinterpret(0xBFC0D77E7CD09000), reinterpret(0x3D0A699688E85BF4),\n reinterpret(0x3FF2200000000000), 0, reinterpret(0xBFBFEC9131DBE000), reinterpret(0xBD2575545CA333F2),\n reinterpret(0x3FF2000000000000), 0, reinterpret(0xBFBE27076E2B0000), reinterpret(0x3D2A342C2AF0003C),\n reinterpret(0x3FF2000000000000), 0, reinterpret(0xBFBE27076E2B0000), reinterpret(0x3D2A342C2AF0003C),\n reinterpret(0x3FF1E00000000000), 0, reinterpret(0xBFBC5E548F5BC000), reinterpret(0xBD1D0C57585FBE06),\n reinterpret(0x3FF1C00000000000), 0, reinterpret(0xBFBA926D3A4AE000), reinterpret(0x3D253935E85BAAC8),\n reinterpret(0x3FF1C00000000000), 0, reinterpret(0xBFBA926D3A4AE000), reinterpret(0x3D253935E85BAAC8),\n reinterpret(0x3FF1A00000000000), 0, reinterpret(0xBFB8C345D631A000), reinterpret(0x3D137C294D2F5668),\n reinterpret(0x3FF1A00000000000), 0, reinterpret(0xBFB8C345D631A000), reinterpret(0x3D137C294D2F5668),\n reinterpret(0x3FF1800000000000), 0, reinterpret(0xBFB6F0D28AE56000), reinterpret(0xBD269737C93373DA),\n reinterpret(0x3FF1600000000000), 0, reinterpret(0xBFB51B073F062000), reinterpret(0x3D1F025B61C65E57),\n reinterpret(0x3FF1600000000000), 0, reinterpret(0xBFB51B073F062000), reinterpret(0x3D1F025B61C65E57),\n reinterpret(0x3FF1400000000000), 0, reinterpret(0xBFB341D7961BE000), reinterpret(0x3D2C5EDACCF913DF),\n reinterpret(0x3FF1400000000000), 0, reinterpret(0xBFB341D7961BE000), reinterpret(0x3D2C5EDACCF913DF),\n reinterpret(0x3FF1200000000000), 0, reinterpret(0xBFB16536EEA38000), reinterpret(0x3D147C5E768FA309),\n reinterpret(0x3FF1000000000000), 0, reinterpret(0xBFAF0A30C0118000), reinterpret(0x3D2D599E83368E91),\n reinterpret(0x3FF1000000000000), 0, reinterpret(0xBFAF0A30C0118000), reinterpret(0x3D2D599E83368E91),\n reinterpret(0x3FF0E00000000000), 0, reinterpret(0xBFAB42DD71198000), reinterpret(0x3D1C827AE5D6704C),\n reinterpret(0x3FF0E00000000000), 0, reinterpret(0xBFAB42DD71198000), reinterpret(0x3D1C827AE5D6704C),\n reinterpret(0x3FF0C00000000000), 0, reinterpret(0xBFA77458F632C000), reinterpret(0xBD2CFC4634F2A1EE),\n reinterpret(0x3FF0C00000000000), 0, reinterpret(0xBFA77458F632C000), reinterpret(0xBD2CFC4634F2A1EE),\n reinterpret(0x3FF0A00000000000), 0, reinterpret(0xBFA39E87B9FEC000), reinterpret(0x3CF502B7F526FEAA),\n reinterpret(0x3FF0A00000000000), 0, reinterpret(0xBFA39E87B9FEC000), reinterpret(0x3CF502B7F526FEAA),\n reinterpret(0x3FF0800000000000), 0, reinterpret(0xBF9F829B0E780000), reinterpret(0xBD2980267C7E09E4),\n reinterpret(0x3FF0800000000000), 0, reinterpret(0xBF9F829B0E780000), reinterpret(0xBD2980267C7E09E4),\n reinterpret(0x3FF0600000000000), 0, reinterpret(0xBF97B91B07D58000), reinterpret(0xBD288D5493FAA639),\n reinterpret(0x3FF0400000000000), 0, reinterpret(0xBF8FC0A8B0FC0000), reinterpret(0xBCDF1E7CF6D3A69C),\n reinterpret(0x3FF0400000000000), 0, reinterpret(0xBF8FC0A8B0FC0000), reinterpret(0xBCDF1E7CF6D3A69C),\n reinterpret(0x3FF0200000000000), 0, reinterpret(0xBF7FE02A6B100000), reinterpret(0xBD19E23F0DDA40E4),\n reinterpret(0x3FF0200000000000), 0, reinterpret(0xBF7FE02A6B100000), reinterpret(0xBD19E23F0DDA40E4),\n reinterpret(0x3FF0000000000000), 0, 0, 0,\n reinterpret(0x3FF0000000000000), 0, 0, 0,\n reinterpret(0x3FEFC00000000000), 0, reinterpret(0x3F80101575890000), reinterpret(0xBD10C76B999D2BE8),\n reinterpret(0x3FEF800000000000), 0, reinterpret(0x3F90205658938000), reinterpret(0xBD23DC5B06E2F7D2),\n reinterpret(0x3FEF400000000000), 0, reinterpret(0x3F98492528C90000), reinterpret(0xBD2AA0BA325A0C34),\n reinterpret(0x3FEF000000000000), 0, reinterpret(0x3FA0415D89E74000), reinterpret(0x3D0111C05CF1D753),\n reinterpret(0x3FEEC00000000000), 0, reinterpret(0x3FA466AED42E0000), reinterpret(0xBD2C167375BDFD28),\n reinterpret(0x3FEE800000000000), 0, reinterpret(0x3FA894AA149FC000), reinterpret(0xBD197995D05A267D),\n reinterpret(0x3FEE400000000000), 0, reinterpret(0x3FACCB73CDDDC000), reinterpret(0xBD1A68F247D82807),\n reinterpret(0x3FEE200000000000), 0, reinterpret(0x3FAEEA31C006C000), reinterpret(0xBD0E113E4FC93B7B),\n reinterpret(0x3FEDE00000000000), 0, reinterpret(0x3FB1973BD1466000), reinterpret(0xBD25325D560D9E9B),\n reinterpret(0x3FEDA00000000000), 0, reinterpret(0x3FB3BDF5A7D1E000), reinterpret(0x3D2CC85EA5DB4ED7),\n reinterpret(0x3FED600000000000), 0, reinterpret(0x3FB5E95A4D97A000), reinterpret(0xBD2C69063C5D1D1E),\n reinterpret(0x3FED400000000000), 0, reinterpret(0x3FB700D30AEAC000), reinterpret(0x3CEC1E8DA99DED32),\n reinterpret(0x3FED000000000000), 0, reinterpret(0x3FB9335E5D594000), reinterpret(0x3D23115C3ABD47DA),\n reinterpret(0x3FECC00000000000), 0, reinterpret(0x3FBB6AC88DAD6000), reinterpret(0xBD1390802BF768E5),\n reinterpret(0x3FECA00000000000), 0, reinterpret(0x3FBC885801BC4000), reinterpret(0x3D2646D1C65AACD3),\n reinterpret(0x3FEC600000000000), 0, reinterpret(0x3FBEC739830A2000), reinterpret(0xBD2DC068AFE645E0),\n reinterpret(0x3FEC400000000000), 0, reinterpret(0x3FBFE89139DBE000), reinterpret(0xBD2534D64FA10AFD),\n reinterpret(0x3FEC000000000000), 0, reinterpret(0x3FC1178E8227E000), reinterpret(0x3D21EF78CE2D07F2),\n reinterpret(0x3FEBE00000000000), 0, reinterpret(0x3FC1AA2B7E23F000), reinterpret(0x3D2CA78E44389934),\n reinterpret(0x3FEBA00000000000), 0, reinterpret(0x3FC2D1610C868000), reinterpret(0x3D039D6CCB81B4A1),\n reinterpret(0x3FEB800000000000), 0, reinterpret(0x3FC365FCB0159000), reinterpret(0x3CC62FA8234B7289),\n reinterpret(0x3FEB400000000000), 0, reinterpret(0x3FC4913D8333B000), reinterpret(0x3D25837954FDB678),\n reinterpret(0x3FEB200000000000), 0, reinterpret(0x3FC527E5E4A1B000), reinterpret(0x3D2633E8E5697DC7),\n reinterpret(0x3FEAE00000000000), 0, reinterpret(0x3FC6574EBE8C1000), reinterpret(0x3D19CF8B2C3C2E78),\n reinterpret(0x3FEAC00000000000), 0, reinterpret(0x3FC6F0128B757000), reinterpret(0xBD25118DE59C21E1),\n reinterpret(0x3FEAA00000000000), 0, reinterpret(0x3FC7898D85445000), reinterpret(0xBD1C661070914305),\n reinterpret(0x3FEA600000000000), 0, reinterpret(0x3FC8BEAFEB390000), reinterpret(0xBD073D54AAE92CD1),\n reinterpret(0x3FEA400000000000), 0, reinterpret(0x3FC95A5ADCF70000), reinterpret(0x3D07F22858A0FF6F),\n reinterpret(0x3FEA000000000000), 0, reinterpret(0x3FCA93ED3C8AE000), reinterpret(0xBD28724350562169),\n reinterpret(0x3FE9E00000000000), 0, reinterpret(0x3FCB31D8575BD000), reinterpret(0xBD0C358D4EACE1AA),\n reinterpret(0x3FE9C00000000000), 0, reinterpret(0x3FCBD087383BE000), reinterpret(0xBD2D4BC4595412B6),\n reinterpret(0x3FE9A00000000000), 0, reinterpret(0x3FCC6FFBC6F01000), reinterpret(0xBCF1EC72C5962BD2),\n reinterpret(0x3FE9600000000000), 0, reinterpret(0x3FCDB13DB0D49000), reinterpret(0xBD2AFF2AF715B035),\n reinterpret(0x3FE9400000000000), 0, reinterpret(0x3FCE530EFFE71000), reinterpret(0x3CC212276041F430),\n reinterpret(0x3FE9200000000000), 0, reinterpret(0x3FCEF5ADE4DD0000), reinterpret(0xBCCA211565BB8E11),\n reinterpret(0x3FE9000000000000), 0, reinterpret(0x3FCF991C6CB3B000), reinterpret(0x3D1BCBECCA0CDF30),\n reinterpret(0x3FE8C00000000000), 0, reinterpret(0x3FD07138604D5800), reinterpret(0x3CF89CDB16ED4E91),\n reinterpret(0x3FE8A00000000000), 0, reinterpret(0x3FD0C42D67616000), reinterpret(0x3D27188B163CEAE9),\n reinterpret(0x3FE8800000000000), 0, reinterpret(0x3FD1178E8227E800), reinterpret(0xBD2C210E63A5F01C),\n reinterpret(0x3FE8600000000000), 0, reinterpret(0x3FD16B5CCBACF800), reinterpret(0x3D2B9ACDF7A51681),\n reinterpret(0x3FE8400000000000), 0, reinterpret(0x3FD1BF99635A6800), reinterpret(0x3D2CA6ED5147BDB7),\n reinterpret(0x3FE8200000000000), 0, reinterpret(0x3FD214456D0EB800), reinterpret(0x3D0A87DEBA46BAEA),\n reinterpret(0x3FE7E00000000000), 0, reinterpret(0x3FD2BEF07CDC9000), reinterpret(0x3D2A9CFA4A5004F4),\n reinterpret(0x3FE7C00000000000), 0, reinterpret(0x3FD314F1E1D36000), reinterpret(0xBD28E27AD3213CB8),\n reinterpret(0x3FE7A00000000000), 0, reinterpret(0x3FD36B6776BE1000), reinterpret(0x3D116ECDB0F177C8),\n reinterpret(0x3FE7800000000000), 0, reinterpret(0x3FD3C25277333000), reinterpret(0x3D183B54B606BD5C),\n reinterpret(0x3FE7600000000000), 0, reinterpret(0x3FD419B423D5E800), reinterpret(0x3D08E436EC90E09D),\n reinterpret(0x3FE7400000000000), 0, reinterpret(0x3FD4718DC271C800), reinterpret(0xBD2F27CE0967D675),\n reinterpret(0x3FE7200000000000), 0, reinterpret(0x3FD4C9E09E173000), reinterpret(0xBD2E20891B0AD8A4),\n reinterpret(0x3FE7000000000000), 0, reinterpret(0x3FD522AE0738A000), reinterpret(0x3D2EBE708164C759),\n reinterpret(0x3FE6E00000000000), 0, reinterpret(0x3FD57BF753C8D000), reinterpret(0x3D1FADEDEE5D40EF),\n reinterpret(0x3FE6C00000000000), 0, reinterpret(0x3FD5D5BDDF596000), reinterpret(0xBD0A0B2A08A465DC)\n]);\n\n// Returns 0 if not int, 1 if odd int, 2 if even int. The argument is\n// the bit representation of a non-zero finite floating-point value.\n// @ts-ignore: decorator\n@inline\nfunction checkint(iy: u64): i32 {\n var e = iy >> 52 & 0x7FF;\n if (e < 0x3FF ) return 0;\n if (e > 0x3FF + 52) return 2;\n e = u64(1) << (0x3FF + 52 - e);\n if (iy & (e - 1)) return 0;\n if (iy & e ) return 1;\n return 2;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction xflow(sign: u32, y: f64): f64 {\n return select(-y, y, sign) * y;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction uflow(sign: u32): f64 {\n return xflow(sign, reinterpret(0x1000000000000000)); // 0x1p-767\n}\n\n// @ts-ignore: decorator\n@inline\nfunction oflow(sign: u32): f64 {\n return xflow(sign, reinterpret(0x7000000000000000)); // 0x1p769\n}\n\n// Returns 1 if input is the bit representation of 0, infinity or nan.\n// @ts-ignore: decorator\n@inline\nfunction zeroinfnan(u: u64): bool {\n return (u << 1) - 1 >= 0xFFE0000000000000 - 1;\n}\n\n// @ts-ignore: decorator\n@lazy var log_tail: f64 = 0;\n\n// Compute y+TAIL = log(x) where the rounded result is y and TAIL has about\n// additional 15 bits precision. IX is the bit representation of x, but\n// normalized in the subnormal range using the sign bit for the exponent.\n// @ts-ignore: decorator\n@inline\nfunction log_inline(ix: u64): f64 {\n const N = 1 << POW_LOG_TABLE_BITS;\n const N_MASK = N - 1;\n\n const\n Ln2hi = reinterpret(0x3FE62E42FEFA3800),\n Ln2lo = reinterpret(0x3D2EF35793C76730);\n\n const\n A0 = reinterpret(0xBFE0000000000000),\n A1 = reinterpret(0xBFE5555555555560),\n A2 = reinterpret(0x3FE0000000000006),\n A3 = reinterpret(0x3FE999999959554E),\n A4 = reinterpret(0xBFE555555529A47A),\n A5 = reinterpret(0xBFF2495B9B4845E9),\n A6 = reinterpret(0x3FF0002B8B263FC3);\n\n // x = 2^k z; where z is in range [OFF,2*OFF) and exact.\n // The range is split into N subintervals.\n // The ith subinterval contains z and c is near its center.\n var tmp = ix - 0x3fE6955500000000;\n var i = ((tmp >> (52 - POW_LOG_TABLE_BITS)) & N_MASK);\n var k = tmp >> 52;\n var iz = ix - (tmp & u64(0xFFF) << 52);\n var z = reinterpret(iz);\n var kd = k;\n\n // log(x) = k*Ln2 + log(c) + log1p(z/c-1).\n var invc = load(POW_LOG_DATA_TAB + (i << (2 + alignof())), 0 << alignof()); // tab[i].invc\n var logc = load(POW_LOG_DATA_TAB + (i << (2 + alignof())), 2 << alignof()); // tab[i].logc\n var logctail = load(POW_LOG_DATA_TAB + (i << (2 + alignof())), 3 << alignof()); // tab[i].logctail\n\n // Note: 1/c is j/N or j/N/2 where j is an integer in [N,2N) and\n // |z/c - 1| < 1/N, so r = z/c - 1 is exactly representible.\n // Split z such that rhi, rlo and rhi*rhi are exact and |rlo| <= |r|.\n var zhi = reinterpret((iz + u64(0x80000000)) & 0xFFFFFFFF00000000);\n var zlo = z - zhi;\n var rhi = zhi * invc - 1.0;\n var rlo = zlo * invc;\n var r = rhi + rlo;\n\n // k * Ln2 + log(c) + r.\n var t1 = kd * Ln2hi + logc;\n var t2 = t1 + r;\n var lo1 = kd * Ln2lo + logctail;\n var lo2 = t1 - t2 + r;\n\n // Evaluation is optimized assuming superscalar pipelined execution.\n var ar = A0 * r; // A[0] = -0.5\n var ar2 = r * ar;\n var ar3 = r * ar2;\n // k * Ln2 + log(c) + r + A[0] * r * r.\n var arhi = A0 * rhi;\n var arhi2 = rhi * arhi;\n var hi = t2 + arhi2;\n var lo3 = rlo * (ar + arhi);\n var lo4 = t2 - hi + arhi2;\n\n // p = log1p(r) - r - A[0] * r * r.\n var p = ar3 * (A1 + r * A2 + ar2 * (A3 + r * A4 + ar2 * (A5 + r * A6)));\n var lo = lo1 + lo2 + lo3 + lo4 + p;\n var y = hi + lo;\n log_tail = hi - y + lo;\n\n return y;\n}\n\n// @ts-ignore: decorator\n@inline const SIGN_BIAS = 0x800 << EXP_TABLE_BITS;\n\n// Computes sign*exp(x+xtail) where |xtail| < 2^-8/N and |xtail| <= |x|.\n// The sign_bias argument is SIGN_BIAS or 0 and sets the sign to -1 or 1.\n// @ts-ignore: decorator\n@inline\nfunction exp_inline(x: f64, xtail: f64, sign_bias: u32): f64 {\n const N = 1 << EXP_TABLE_BITS;\n const N_MASK = N - 1;\n\n const\n InvLn2N = reinterpret(0x3FF71547652B82FE) * N, // 0x1.71547652b82fep0\n NegLn2hiN = reinterpret(0xBF762E42FEFA0000), // -0x1.62e42fefa0000p-8\n NegLn2loN = reinterpret(0xBD0CF79ABC9E3B3A), // -0x1.cf79abc9e3b3ap-47\n shift = reinterpret(0x4338000000000000); // 0x1.8p52\n\n const\n C2 = reinterpret(0x3FDFFFFFFFFFFDBD), // __exp_data.poly[0] (0x1.ffffffffffdbdp-2)\n C3 = reinterpret(0x3FC555555555543C), // __exp_data.poly[1] (0x1.555555555543cp-3)\n C4 = reinterpret(0x3FA55555CF172B91), // __exp_data.poly[2] (0x1.55555cf172b91p-5)\n C5 = reinterpret(0x3F81111167A4D017); // __exp_data.poly[3] (0x1.1111167a4d017p-7)\n\n var abstop: u32;\n var ki: u64, top: u64, sbits: u64;\n var idx: usize;\n // double_t for better performance on targets with FLT_EVAL_METHOD==2.\n var kd: f64, z: f64, r: f64, r2: f64, scale: f64, tail: f64, tmp: f64;\n\n var ux = reinterpret(x);\n abstop = (ux >> 52) & 0x7FF;\n if (abstop - 0x3C9 >= 0x03F) {\n if (abstop - 0x3C9 >= 0x80000000) {\n // Avoid spurious underflow for tiny x.\n // Note: 0 is common input.\n return select(-1.0, 1.0, sign_bias);\n }\n if (abstop >= 0x409) { // top12(1024.0)\n // Note: inf and nan are already handled.\n return ux >> 63 ? uflow(sign_bias) : oflow(sign_bias);\n }\n // Large x is special cased below.\n abstop = 0;\n }\n\n // exp(x) = 2^(k/N) * exp(r), with exp(r) in [2^(-1/2N),2^(1/2N)].\n // x = ln2/N*k + r, with int k and r in [-ln2/2N, ln2/2N].\n z = InvLn2N * x;\n\n // #if TOINT_INTRINSICS\n // kd = roundtoint(z);\n // ki = converttoint(z);\n // #elif EXP_USE_TOINT_NARROW\n // // z - kd is in [-0.5-2^-16, 0.5] in all rounding modes.\n // kd = eval_as_double(z + shift);\n // ki = asuint64(kd) >> 16;\n // kd = (double_t)(int32_t)ki;\n // #else\n // z - kd is in [-1, 1] in non-nearest rounding modes\n kd = z + shift;\n ki = reinterpret(kd);\n kd -= shift;\n // #endif\n r = x + kd * NegLn2hiN + kd * NegLn2loN;\n // The code assumes 2^-200 < |xtail| < 2^-8/N\n r += xtail;\n // 2^(k/N) ~= scale * (1 + tail)\n idx = ((ki & N_MASK) << 1);\n top = (ki + sign_bias) << (52 - EXP_TABLE_BITS);\n\n tail = reinterpret(load(EXP_DATA_TAB + (idx << alignof())));\n // This is only a valid scale when -1023*N < k < 1024*N\n sbits = load(EXP_DATA_TAB + (idx << alignof()), 1 << alignof()) + top;\n // exp(x) = 2^(k/N) * exp(r) ~= scale + scale * (tail + exp(r) - 1).\n // Evaluation is optimized assuming superscalar pipelined execution.\n r2 = r * r;\n // Without fma the worst case error is 0.25/N ulp larger.\n // Worst case error is less than 0.5+1.11/N+(abs poly error * 2^53) ulp\n tmp = tail + r + r2 * (C2 + r * C3) + r2 * r2 * (C4 + r * C5);\n if (abstop == 0) return specialcase(tmp, sbits, ki);\n scale = reinterpret(sbits);\n // Note: tmp == 0 or |tmp| > 2^-200 and scale > 2^-739, so there\n // is no spurious underflow here even without fma.\n return scale + scale * tmp;\n}\n\n// @ts-ignore: decorator\n@inline\nexport function pow_lut(x: f64, y: f64): f64 {\n const Ox1p52 = reinterpret(0x4330000000000000); // 0x1p52\n\n var sign_bias: u32 = 0;\n var ix = reinterpret(x);\n var iy = reinterpret(y);\n var topx = ix >> 52;\n var topy = iy >> 52;\n\n if (topx - 0x001 >= 0x7FF - 0x001 || (topy & 0x7FF) - 0x3BE >= 0x43e - 0x3BE) {\n // Note: if |y| > 1075 * ln2 * 2^53 ~= 0x1.749p62 then pow(x,y) = inf/0\n // and if |y| < 2^-54 / 1075 ~= 0x1.e7b6p-65 then pow(x,y) = +-1.\n // Special cases: (x < 0x1p-126 or inf or nan) or\n // (|y| < 0x1p-65 or |y| >= 0x1p63 or nan).\n if (zeroinfnan(iy)) {\n if ((iy << 1) == 0) return 1.0;\n if (ix == 0x3FF0000000000000) return NaN; // original: 1.0\n if ((ix << 1) > 0xFFE0000000000000 || (iy << 1) > 0xFFE0000000000000) return x + y;\n if ((ix << 1) == 0x7FE0000000000000) return NaN; // original: 1.0\n if (((ix << 1) < 0x7FE0000000000000) == !(iy >> 63)) return 0; // |x|<1 && y==inf or |x|>1 && y==-inf.\n return y * y;\n }\n if (zeroinfnan(ix)) {\n let x2 = x * x;\n if (i32(ix >> 63) && checkint(iy) == 1) x2 = -x2;\n return iy >> 63 ? 1 / x2 : x2;\n }\n // Here x and y are non-zero finite\n if (ix >> 63) {\n // Finite x < 0\n let yint = checkint(iy);\n if (yint == 0) return (x - x) / (x - x);\n if (yint == 1) sign_bias = SIGN_BIAS;\n ix &= 0x7FFFFFFFFFFFFFFF;\n topx &= 0x7FF;\n }\n if ((topy & 0x7FF) - 0x3BE >= 0x43E - 0x3BE) {\n // Note: sign_bias == 0 here because y is not odd.\n if (ix == 0x3FF0000000000000) return 1;\n if ((topy & 0x7FF) < 0x3BE) return 1; // |y| < 2^-65, x^y ~= 1 + y*log(x).\n return (ix > 0x3FF0000000000000) == (topy < 0x800) ? Infinity : 0;\n }\n if (topx == 0) {\n // Normalize subnormal x so exponent becomes negative.\n ix = reinterpret(x * Ox1p52);\n ix &= 0x7FFFFFFFFFFFFFFF;\n ix -= u64(52) << 52;\n }\n }\n\n var hi = log_inline(ix);\n var lo = log_tail;\n var ehi: f64, elo: f64;\n // #if __FP_FAST_FMA\n // ehi = y * hi;\n // elo = y * lo + __builtin_fma(y, hi, -ehi);\n // #else\n var yhi = reinterpret(iy & 0xFFFFFFFFF8000000);\n var ylo = y - yhi;\n var lhi = reinterpret(reinterpret(hi) & 0xFFFFFFFFF8000000);\n var llo = hi - lhi + lo;\n ehi = yhi * lhi;\n elo = ylo * lhi + y * llo; // |elo| < |ehi| * 2^-25.\n // #endif\n return exp_inline(ehi, elo, sign_bias);\n}\n","import { itoa32, utoa32, itoa64, utoa64, dtoa, itoa_buffered, dtoa_buffered, MAX_DOUBLE_LENGTH } from \"./number\";\nimport { ipow32 } from \"../math\";\n\n// All tables are stored as two staged lookup tables (static tries)\n// because the full range of Unicode symbols can't be efficiently\n// represented as-is in memory (see Unicode spec ch 5, p.196):\n// https://www.unicode.org/versions/Unicode12.0.0/ch05.pdf\n// Tables have been generated using these forked musl tools:\n// https://github.com/MaxGraey/musl-chartable-tools/tree/case-ignorable\n\n// Lookup table to check if a character is alphanumeric or not\n// See: https://git.musl-libc.org/cgit/musl/tree/src/ctype/alpha.h\n// size: 3904 bytes\n// @ts-ignore\n@inline @lazy const ALPHA_TABLE = memory.data([\n 18,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,17,34,35,36,17,37,38,39,40,\n 41,42,43,44,17,45,46,47,16,16,48,16,16,16,16,16,16,16,49,50,51,16,52,53,16,16,\n 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,54,\n 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,\n 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,\n 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,\n 17,17,17,55,17,17,17,17,56,17,57,58,59,60,61,62,17,17,17,17,17,17,17,17,17,17,\n 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,\n 17,17,17,17,17,17,17,63,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,64,65,17,66,67,\n 68,69,70,71,72,73,74,17,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,\n 93,94,16,95,96,97,98,17,17,17,99,100,101,16,16,16,16,16,16,16,16,16,16,17,17,\n 17,17,102,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,103,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,17,17,104,105,16,16,106,107,17,17,17,17,17,17,17,17,17,17,17,17,17,\n 17,17,17,17,17,17,17,17,17,17,108,17,17,17,17,109,110,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 17,111,112,16,16,16,16,16,16,16,16,16,113,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,114,115,116,117,16,16,16,16,16,16,16,16,118,\n 119,120,16,16,16,16,16,121,122,16,16,16,16,123,16,16,124,16,16,16,16,16,16,16,\n 16,16,125,16,16,16,\n 16,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,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,254,255,255,7,254,\n 255,255,7,0,0,0,0,0,4,32,4,255,255,127,255,255,255,127,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,195,255,3,0,31,80,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,223,188,64,215,255,255,\n 251,255,255,255,255,255,255,255,255,255,191,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,3,252,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,254,255,255,255,127,2,255,255,255,\n 255,255,1,0,0,0,0,255,191,182,0,255,255,255,135,7,0,0,0,255,7,255,255,255,255,\n 255,255,255,254,255,195,255,255,255,255,255,255,255,255,255,255,255,255,239,\n 31,254,225,255,\n 159,0,0,255,255,255,255,255,255,0,224,255,255,255,255,255,255,255,255,255,255,\n 255,255,3,0,255,255,255,255,255,7,48,4,255,255,255,252,255,31,0,0,255,255,255,\n 1,255,7,0,0,0,0,0,0,255,255,223,255,255,0,240,255,248,3,255,255,255,255,255,\n 255,255,255,255,239,255,223,225,255,207,255,254,255,239,159,249,255,255,253,\n 197,227,159,89,128,176,207,255,3,16,238,135,249,255,255,253,109,195,135,25,2,\n 94,192,255,63,0,238,191,251,255,255,253,237,227,191,27,1,0,207,255,0,30,238,\n 159,249,255,255,253,237,227,159,25,192,176,207,255,2,0,236,199,61,214,24,199,\n 255,195,199,29,129,0,192,255,0,0,239,223,253,255,255,253,255,227,223,29,96,7,\n 207,255,0,0,239,223,253,255,255,253,239,227,223,29,96,64,207,255,6,0,255,223,\n 253,255,255,255,255,231,223,93,240,128,207,255,0,252,238,255,127,252,255,255,\n 251,47,127,128,95,255,192,255,12,0,254,255,255,255,255,127,255,7,63,32,255,3,\n 0,0,0,0,214,247,255,255,175,255,255,59,95,32,255,243,0,0,0,\n 0,1,0,0,0,255,3,0,0,255,254,255,255,255,31,254,255,3,255,255,254,255,255,255,\n 31,0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,249,255,3,255,255,255,255,255,\n 255,255,255,255,63,255,255,255,255,191,32,255,255,255,255,255,247,255,255,255,\n 255,255,255,255,255,255,61,127,61,255,255,255,255,255,61,255,255,255,255,61,\n 127,61,255,127,255,255,255,255,255,255,255,61,255,255,255,255,255,255,255,255,\n 7,0,0,0,0,255,255,0,0,255,255,255,255,255,255,255,255,255,255,63,63,254,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,159,255,255,254,255,255,7,255,255,255,255,255,255,255,255,\n 255,199,255,1,255,223,15,0,255,255,15,0,255,255,15,0,255,223,13,0,255,255,255,\n 255,255,255,207,255,255,1,128,16,255,3,0,0,0,0,255,3,255,255,255,255,255,255,\n 255,255,255,255,255,1,255,255,255,255,255,7,255,255,255,255,255,255,255,255,\n 63,\n 0,255,255,255,127,255,15,255,1,192,255,255,255,255,63,31,0,255,255,255,255,\n 255,15,255,255,255,3,255,3,0,0,0,0,255,255,255,15,255,255,255,255,255,255,255,\n 127,254,255,31,0,255,3,255,3,128,0,0,128,1,0,0,0,0,0,0,0,255,255,255,255,255,\n 255,239,255,239,15,255,3,0,0,0,0,255,255,255,255,255,243,255,255,255,255,255,\n 255,191,255,3,0,255,255,255,255,255,255,127,0,255,227,255,255,255,255,255,63,\n 255,1,255,255,255,255,255,231,0,0,0,0,0,222,111,4,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,\n 128,255,31,0,255,255,63,63,255,255,255,255,63,63,255,170,255,255,255,63,255,\n 255,255,255,255,255,223,95,220,31,207,15,255,31,220,31,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,2,128,0,0,255,31,0,0,0,0,0,0,0,0,0,0,0,0,132,252,47,62,80,189,255,243,\n 224,67,0,0,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,255,255,255,255,255,255,3,0,\n 0,255,255,255,255,255,127,255,255,255,255,255,127,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,31,120,12,0,255,255,255,255,191,32,255,\n 255,255,255,255,255,255,128,0,0,255,255,127,0,127,127,127,127,127,127,127,127,\n 255,255,255,255,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,224,0,0,0,254,3,62,31,254,255,255,255,255,255,255,255,255,255,127,224,254,\n 255,255,255,255,255,255,255,255,255,255,247,224,255,255,255,255,255,254,255,\n 255,255,255,255,255,255,255,255,255,127,0,0,255,255,255,255,0,0,0,0,0,0,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,\n 31,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0,\n 0,0,0,0,0,0,255,255,255,255,255,63,255,31,255,255,255,15,0,0,255,255,255,255,\n 255,127,240,143,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,\n 0,128,255,252,255,255,255,255,255,255,255,255,255,255,255,255,249,255,255,255,\n 255,255,255,252,7,0,0,0,0,224,255,191,255,255,255,255,0,0,0,255,255,255,255,\n 255,255,15,0,255,255,255,255,255,255,255,255,47,0,255,3,0,0,252,232,255,255,\n 255,255,255,7,255,255,255,255,7,0,255,255,255,31,255,255,255,255,255,255,247,\n 255,0,128,255,3,255,255,255,127,255,255,255,255,255,255,127,0,255,63,255,3,\n 255,255,127,252,255,255,255,255,255,255,255,127,5,0,0,56,255,255,60,0,126,126,\n 126,0,127,127,255,255,255,255,255,247,255,3,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,7,255,3,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,15,0,255,255,127,248,255,255,255,255,\n 255,\n 15,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,3,0,0,0,0,127,0,248,224,255,253,127,95,219,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,3,0,0,0,248,255,255,255,\n 255,255,255,255,255,255,255,255,255,63,0,0,255,255,255,255,255,255,255,255,\n 252,255,255,255,255,255,255,0,0,0,0,0,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,223,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0,255,3,\n 254,255,255,7,254,255,255,7,192,255,255,255,255,255,255,255,255,255,255,127,\n 252,252,252,28,0,0,0,0,255,239,255,255,127,255,255,183,255,63,255,63,0,0,0,0,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,7,0,0,0,0,0,0,0,0,\n 255,255,255,255,255,255,31,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,\n 0,0,0,0,0,0,0,0,255,255,255,31,255,255,255,255,255,255,1,0,0,0,0,\n 0,255,255,255,255,0,224,255,255,255,7,255,255,255,255,255,7,255,255,255,63,\n 255,255,255,255,15,255,62,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,63,255,3,255,255,255,255,15,255,255,255,\n 255,15,255,255,255,255,255,0,255,255,255,255,255,255,15,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,0,255,255,63,0,255,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,63,253,255,255,255,255,191,145,255,255,63,0,255,255,\n 127,0,255,255,255,127,0,0,0,0,0,0,0,0,255,255,55,0,255,255,63,0,255,255,255,3,\n 0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,192,0,0,0,0,0,0,0,0,111,240,239,\n 254,255,255,63,0,0,0,0,0,255,255,255,31,255,255,255,31,0,0,0,0,255,254,255,\n 255,31,0,0,0,255,255,255,255,255,255,63,0,255,255,63,0,255,255,7,0,255,255,3,\n 0,0,0,0,0,0,0,0,0,0,0,0,\n 0,255,255,255,255,255,255,255,255,255,1,0,0,0,0,0,0,255,255,255,255,255,255,7,\n 0,255,255,255,255,255,255,7,0,255,255,255,255,255,0,255,3,0,0,0,0,0,0,0,0,0,0,\n 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,255,255,255,255,\n 255,27,3,0,0,0,0,0,0,0,0,0,255,255,255,31,128,0,255,255,63,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,255,255,31,0,0,0,255,255,127,0,255,255,255,255,255,255,255,255,63,0,0,\n 0,192,255,0,0,252,255,255,255,255,255,255,1,0,0,255,255,255,1,255,3,255,255,\n 255,255,255,255,199,255,240,0,255,255,255,255,71,0,255,255,255,255,255,255,\n 255,255,30,192,255,23,0,0,0,0,255,255,251,255,255,255,159,64,0,0,0,0,0,0,0,0,\n 127,189,255,191,255,1,255,255,255,255,255,255,255,1,255,3,239,159,249,255,255,\n 253,237,227,159,25,129,224,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,255,255,255,255,255,255,255,255,187,7,255,131,3,0,0,0,255,255,255,255,255,\n 255,255,255,179,0,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,\n 255,255,255,63,127,0,0,0,63,0,0,0,0,255,255,255,255,255,255,255,127,17,0,255,\n 3,0,0,0,0,255,255,255,255,255,255,63,1,255,3,0,0,0,0,0,0,255,255,255,231,255,\n 7,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,\n 255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,3,0,128,\n 127,242,111,255,255,255,191,153,7,0,255,3,0,0,0,0,0,0,0,0,255,252,255,255,255,\n 255,255,252,26,0,0,0,255,255,255,255,255,255,231,127,0,0,255,255,255,255,255,\n 255,255,255,255,32,0,0,0,0,255,255,255,255,255,255,255,1,255,253,255,255,255,\n 255,127,127,1,0,255,3,0,0,252,255,255,255,252,255,255,254,127,0,0,0,0,0,0,0,0,\n 0,127,251,255,255,255,255,127,180,203,0,255,3,191,253,255,255,255,127,123,1,\n 255,3,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,\n 0,0,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,\n 0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,3,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,127,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,255,255,255,255,255,127,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,\n 0,255,255,255,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,\n 0,255,255,255,255,255,255,255,1,255,255,255,127,255,3,0,0,0,0,0,0,0,0,0,0,0,0,\n 255,255,255,63,0,0,255,255,255,255,255,255,0,0,15,0,255,3,248,255,255,224,255,\n 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,\n 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,135,\n 255,255,255,255,255,255,255,128,255,255,0,0,0,0,0,0,0,0,11,0,3,0,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,0,0,0,0,0,\n 255,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,255,255,255,\n 127,0,0,0,0,0,0,7,0,240,0,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,15,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,7,255,31,255,1,255,67,0,0,0,0,0,0,0,0,0,0,0,0,\n 255,255,255,255,255,255,255,255,255,255,223,255,255,255,255,255,255,255,255,\n 223,100,222,255,235,239,255,255,255,255,255,255,255,191,231,223,223,255,255,\n 255,123,95,252,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,63,255,255,255,253,255,255,247,255,255,255,\n 247,255,255,223,255,255,255,223,255,255,127,255,255,255,127,255,255,255,253,\n 255,255,255,253,255,255,247,207,255,255,255,255,255,255,127,255,255,249,219,7,\n 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,255,255,255,255,255,31,\n 128,63,255,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 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,255,255,255,255,255,15,255,\n 3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,31,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,143,8,\n 255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,239,255,255,255,150,254,247,10,\n 132,234,150,170,150,247,247,94,255,251,255,15,238,251,255,15,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,255,255,255,3,255,255,255,3,255,255,255,3,0,0,0,0,0,0,0,0,0,0,0,0,\n 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,255,3\n]);\n\n// size: 1568 bytes (compressed to ~1380 bytes after binaryen)\n// @ts-ignore: decorator\n@lazy @inline const CASED = memory.data([\n 18,19,20,21,22,23,16,16,16,16,16,16,16,16,16,16,\n 24,16,16,25,16,16,16,16,16,16,16,16,26,27,17,28,\n 29,30,16,16,31,16,16,16,16,16,16,16,32,33,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,34,35,16,16,16,36,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,37,16,16,16,38,\n 16,16,16,16,39,16,16,16,16,16,16,16,40,16,16,16,\n 16,16,16,16,16,16,16,16,41,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,42,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,43,44,45,46,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,47,16,16,16,16,16,16,\n 16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 0,0,0,0,0,0,0,0,254,255,255,7,254,255,255,7,0,0,0,0,0,4,32,4,\n 255,255,127,255,255,255,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,247,240,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,239,255,255,255,255,1,3,0,0,0,31,0,0,0,\n 0,0,0,0,0,0,0,0,32,0,0,0,0,0,207,188,64,215,255,255,251,255,255,255,\n 255,255,255,255,255,255,191,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 3,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,\n 255,255,127,0,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,\n 191,32,255,255,255,255,255,231,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,255,255,255,255,255,255,255,255,255,255,63,63,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,255,1,255,255,255,255,255,231,0,0,0,0,0,0,0,0,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 0,0,0,0,0,0,0,0,255,255,63,63,255,255,255,255,63,63,255,170,255,255,255,63,\n 255,255,255,255,255,255,223,95,220,31,207,15,255,31,220,31,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,2,128,0,0,255,31,0,0,0,0,0,0,0,0,0,0,0,0,\n 132,252,47,62,80,189,31,242,224,67,0,0,255,255,255,255,24,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,192,255,255,255,255,255,255,3,0,0,255,255,255,255,255,127,255,255,\n 255,255,255,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,120,12,0,\n 255,255,255,255,191,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,63,0,0,\n 255,255,255,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,255,255,255,\n 255,255,255,255,255,255,255,255,255,120,255,255,255,255,255,255,252,7,0,0,0,0,96,7,\n 0,0,0,0,0,0,255,255,255,255,255,247,255,1,255,255,255,255,255,255,255,255,255,255,\n 0,0,0,0,0,0,0,0,127,0,248,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,255,255,7,\n 254,255,255,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,\n 255,255,15,255,255,255,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 255,255,255,255,255,255,7,0,255,255,255,255,255,255,7,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,0,0,\n 0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,223,255,255,255,255,255,\n 255,255,255,223,100,222,255,235,239,255,255,255,255,255,255,255,191,231,223,223,255,255,255,123,\n 95,252,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,255,255,\n 253,255,255,247,255,255,255,247,255,255,223,255,255,255,223,255,255,127,255,255,255,127,255,255,\n 255,253,255,255,255,253,255,255,247,15,0,0,0,0,0,0,255,255,255,255,255,255,255,255,\n 15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,255,255,255,3,255,255,255,3,255,255,255,3,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0\n]);\n\n// size: 2976 bytes (compressed to ~2050 bytes after binaryen)\n// @ts-ignore: decorator\n@lazy @inline const CASE_IGNORABLES = memory.data([\n 18,16,19,20,21,22,23,24,25,26,27,28,29,30,31,32,\n 33,16,16,34,16,16,16,35,36,37,38,39,40,41,16,42,\n 43,16,16,16,16,16,16,16,16,16,16,16,44,45,46,16,\n 47,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 48,16,16,16,49,16,50,51,52,53,54,55,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,56,16,16,57,58,\n 16,59,60,61,16,16,16,16,16,16,62,16,16,63,64,65,\n 66,67,68,69,70,71,72,73,74,75,76,16,77,78,79,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,80,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,81,82,16,16,16,83,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,84,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,85,86,16,16,16,16,16,16,16,87,16,16,16,16,16,\n 88,89,90,16,16,16,16,16,91,92,16,16,16,16,16,16,\n 16,16,16,93,16,16,16,16,16,16,16,16,16,16,16,16,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 0,0,0,0,128,64,0,4,0,0,0,64,1,0,0,0,0,0,0,0,0,161,144,1,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,48,4,176,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,3,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,130,0,0,0,0,\n 0,0,254,255,255,255,255,191,182,0,0,0,0,0,16,0,63,0,255,23,0,0,0,0,\n 1,248,255,255,0,0,1,0,0,0,0,0,0,0,0,0,0,0,192,191,255,61,0,0,\n 0,128,2,0,0,0,255,255,255,7,0,0,0,0,0,0,0,0,0,0,192,255,1,0,\n 0,0,0,0,0,248,63,36,0,0,192,255,255,63,0,0,0,0,0,14,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,248,255,255,255,255,255,7,0,0,0,0,0,0,20,\n 254,33,254,0,12,0,2,0,2,0,0,0,0,0,0,16,30,32,0,0,12,0,0,64,\n 6,0,0,0,0,0,0,16,134,57,2,0,0,0,35,0,6,0,0,0,0,0,0,16,\n 190,33,0,0,12,0,0,252,2,0,0,0,0,0,0,144,30,32,96,0,12,0,0,0,\n 4,0,0,0,0,0,0,0,1,32,0,0,0,0,0,0,17,0,0,0,0,0,0,192,\n 193,61,96,0,12,0,0,0,2,0,0,0,0,0,0,144,64,48,0,0,12,0,0,0,\n 3,0,0,0,0,0,0,24,30,32,0,0,12,0,0,0,2,0,0,0,0,0,0,0,\n 0,4,92,0,0,0,0,0,0,0,0,0,0,0,242,7,192,127,0,0,0,0,0,0,\n 0,0,0,0,0,0,242,31,64,63,0,0,0,0,0,0,0,0,0,3,0,0,160,2,\n 0,0,0,0,0,0,254,127,223,224,255,254,255,255,255,31,64,0,0,0,0,0,0,0,\n 0,0,0,0,0,224,253,102,0,0,0,195,1,0,30,0,100,32,0,32,0,0,0,0,\n 0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,224,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,0,0,0,28,0,\n 0,0,12,0,0,0,12,0,0,0,0,0,0,0,176,63,64,254,143,32,0,0,0,0,\n 0,120,0,0,0,0,0,0,8,0,0,0,0,0,0,0,96,0,0,0,0,2,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,135,1,4,14,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,9,0,0,0,0,\n 0,0,64,127,229,31,248,159,0,0,0,0,128,0,255,255,1,0,0,0,0,0,0,0,\n 15,0,0,0,0,0,208,23,4,0,0,0,0,248,15,0,3,0,0,0,60,59,0,0,\n 0,0,0,0,64,163,3,0,0,0,0,0,0,240,207,0,0,0,0,0,0,0,0,63,\n 0,0,0,0,0,0,0,0,0,0,247,255,253,33,16,3,0,0,0,0,0,240,255,255,\n 255,255,255,255,255,7,0,1,0,0,0,248,255,255,255,255,255,255,255,255,255,255,255,251,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,\n 3,224,0,224,0,224,0,96,0,248,0,3,144,124,0,0,0,0,0,0,223,255,2,128,\n 0,0,255,31,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,0,0,0,128,3,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,128,0,0,0,0,0,0,0,0,\n 0,0,0,0,255,255,255,255,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,60,62,8,\n 0,0,0,0,0,0,0,0,0,0,0,126,0,0,0,0,0,0,0,0,0,0,0,112,\n 0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,0,16,0,0,0,0,0,0,\n 0,0,0,0,0,128,247,191,0,0,0,240,0,0,0,0,0,0,0,0,0,0,3,0,\n 255,255,255,255,3,0,0,0,0,0,0,0,0,0,1,0,0,7,0,0,0,0,0,0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0,0,0,0,31,0,0,0,0,0,0,0,127,0,15,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,128,0,0,0,0,0,0,0,128,255,255,0,0,0,0,0,0,0,0,27,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,15,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,3,248,255,\n 231,15,0,0,0,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 255,255,255,255,255,255,127,248,255,255,255,255,255,31,32,0,16,0,0,248,254,255,0,0,\n 0,0,0,0,0,0,0,0,127,255,255,249,219,7,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,63,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 240,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,248\n]);\n\n// @ts-ignore: decorator\n@lazy @inline const LOWER127 = memory.data([\n 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,\n 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,\n 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,\n 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,\n 64,\n 97,98,99,100,101,102,103,104,105,106,107,108,109,\n 110,111,112,113,114,115,116,117,118,119,120,121,122,\n 91,92,93,94,95,96,\n 97,98,99,100,101,102,103,104,105,106,107,108,109,\n 110,111,112,113,114,115,116,117,118,119,120,121,122,\n 123,124,125,126,127\n]);\n\n// @ts-ignore: decorator\n@lazy @inline const UPPER127 = memory.data([\n 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,\n 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,\n 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,\n 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,\n 64,\n 65,66,67,68,69,70,71,72,73,74,75,76,77,\n 78,79,80,81,82,83,84,85,86,87,88,89,90,\n 91,92,93,94,95,96,\n 65,66,67,68,69,70,71,72,73,74,75,76,77,\n 78,79,80,81,82,83,84,85,86,87,88,89,90,\n 123,124,125,126,127\n]);\n\n// 23 * 8 = 184 bytes\n// @ts-ignore: decorator\n@lazy @inline const POWERS10 = memory.data([\n 1e00, 1e01, 1e02, 1e03, 1e04, 1e05, 1e06, 1e07, 1e08, 1e09,\n 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,\n 1e20, 1e21, 1e22\n]);\n\n// @ts-ignore: decorator\n@inline\nexport const enum CharCode {\n PERCENT = 0x25,\n PLUS = 0x2B,\n MINUS = 0x2D,\n DOT = 0x2E,\n _0 = 0x30,\n _1 = 0x31,\n _2 = 0x32,\n _3 = 0x33,\n _4 = 0x34,\n _5 = 0x35,\n _6 = 0x36,\n _7 = 0x37,\n _8 = 0x38,\n _9 = 0x39,\n A = 0x41,\n B = 0x42,\n E = 0x45,\n I = 0x49,\n N = 0x4E,\n O = 0x4F,\n X = 0x58,\n Z = 0x5A,\n a = 0x61,\n b = 0x62,\n e = 0x65,\n n = 0x6E,\n o = 0x6F,\n u = 0x75,\n x = 0x78,\n z = 0x7A\n}\n\n// @ts-ignore: decorator\n@inline\nexport function isAscii(c: u32): bool {\n return !(c >> 7);\n}\n\n// @ts-ignore: decorator\n@inline\nexport function isLower8(c: u32): bool {\n return c - CharCode.a < 26;\n}\n\n// @ts-ignore: decorator\n@inline\nexport function isUpper8(c: u32): bool {\n return c - CharCode.A < 26;\n}\n\nexport function isSpace(c: u32): bool {\n if (c < 0x1680) { // < (1)\n // , , , , , and \n // (c == 0x20 || c == 0xA0) was optimized to (c | 0x80) == 0xA0\n // @ts-ignore: cast\n return ((c | 0x80) == 0xA0) | (c - 0x09 <= 0x0D - 0x09);\n }\n if (c - 0x2000 <= 0x200A - 0x2000) return true;\n switch (c) {\n case 0x1680: // (1)\n case 0x2028: // (2)\n case 0x2029: // \n case 0x202F: // \n case 0x205F: // \n case 0x3000: // \n case 0xFEFF: return true; // \n }\n return false;\n}\n\nexport function isAlpha(c: u32): bool {\n if (isAscii(c)) return (c | 32) - CharCode.a < 26;\n if (c < 0x20000) {\n // @ts-ignore: cast\n return stagedBinaryLookup(ALPHA_TABLE, c);\n }\n return c < 0x2FFFE;\n}\n\n// @ts-ignore: decorator\n@inline\nexport function isCased(c: u32): bool {\n // @ts-ignore: cast\n return c < 0x1F18A && stagedBinaryLookup(CASED, c);\n}\n\n// @ts-ignore: decorator\n@inline\nexport function isCaseIgnorable(c: u32): bool {\n // @ts-ignore: cast\n return c < 0xE01F0 && stagedBinaryLookup(CASE_IGNORABLES, c);\n}\n\n// @ts-ignore: decorator\n@inline\nexport function isFinalSigma(buffer: usize, index: isize, len: isize): bool {\n const lookaheadLimit = 30; // max lookahead limit\n var found = false;\n var pos = index;\n var minPos = max(0, pos - lookaheadLimit);\n while (pos > minPos) {\n let c = codePointBefore(buffer, pos);\n if (!isCaseIgnorable(c)) {\n if (isCased(c)) {\n found = true;\n } else {\n return false;\n }\n }\n pos -= isize(c >= 0x10000) + 1;\n }\n if (!found) return false;\n pos = index + 1;\n var maxPos = min(pos + lookaheadLimit, len);\n while (pos < maxPos) {\n let c = load(buffer + (pos << 1));\n if (u32((c & 0xFC00) == 0xD800) & u32(pos + 1 != len)) {\n let c1 = load(buffer + (pos << 1), 2);\n if ((c1 & 0xFC00) == 0xDC00) {\n c = (c - 0xD800 << 10) + (c1 - 0xDC00) + 0x10000;\n }\n }\n if (!isCaseIgnorable(c)) {\n return !isCased(c);\n }\n pos += isize(c >= 0x10000) + 1;\n }\n return true;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction codePointBefore(buffer: usize, index: isize): i32 {\n if (index <= 0) return -1;\n var c = load(buffer + (index - 1 << 1));\n if (u32((c & 0xFC00) == 0xDC00) & u32(index - 2 >= 0)) {\n let c1 = load(buffer + (index - 2 << 1));\n if ((c1 & 0xFC00) == 0xD800) {\n return ((c1 & 0x3FF) << 10) + (c & 0x3FF) + 0x10000;\n }\n }\n return (c & 0xF800) == 0xD800 ? 0xFFFD : c;\n}\n\n// Search routine for two-staged lookup tables\nfunction stagedBinaryLookup(table: usize, c: u32): bool {\n return ((load(table + (load(table + (c >>> 8)) << 5) + ((c & 255) >> 3)) >>> (c & 7)) & 1);\n}\n\nexport function compareImpl(str1: string, index1: usize, str2: string, index2: usize, len: usize): i32 {\n var ptr1 = changetype(str1) + (index1 << 1);\n var ptr2 = changetype(str2) + (index2 << 1);\n if (ASC_SHRINK_LEVEL < 2) {\n if (len >= 4 && !((ptr1 & 7) | (ptr2 & 7))) {\n do {\n if (load(ptr1) != load(ptr2)) break;\n ptr1 += 8;\n ptr2 += 8;\n len -= 4;\n } while (len >= 4);\n }\n }\n while (len--) {\n let a = load(ptr1);\n let b = load(ptr2);\n if (a != b) return a - b;\n ptr1 += 2;\n ptr2 += 2;\n }\n return 0;\n}\n\n// @ts-ignore: decorator\n@inline\nexport function toLower8(c: u32): u32 {\n if (ASC_SHRINK_LEVEL > 0) {\n return c | u32(isUpper8(c)) << 5;\n } else {\n return load(LOWER127 + c);\n }\n}\n\n// @ts-ignore: decorator\n@inline\nexport function toUpper8(c: u32): u32 {\n if (ASC_SHRINK_LEVEL > 0) {\n return c & ~(u32(isLower8(c)) << 5);\n } else {\n return load(UPPER127 + c);\n }\n}\n\n/** Parses a string to an integer (usually), using the specified radix. */\nexport function strtol(str: string, radix: i32 = 0): T {\n var len = str.length;\n if (!len) {\n if (isFloat()) {\n // @ts-ignore: cast\n return NaN;\n } else {\n // @ts-ignore: cast\n return 0;\n }\n }\n\n var ptr = changetype(str) /* + HEAD -> offset */;\n var code = load(ptr);\n\n // trim white spaces\n while (isSpace(code)) {\n code = load(ptr += 2);\n --len;\n }\n // determine sign\n // @ts-ignore\n var sign: T = 1;\n if (code == CharCode.MINUS || code == CharCode.PLUS) {\n if (!--len) {\n if (isFloat()) {\n // @ts-ignore: cast\n return NaN;\n } else {\n // @ts-ignore: cast\n return 0;\n }\n }\n if (code == CharCode.MINUS) {\n // @ts-ignore: type\n sign = -1;\n }\n code = load(ptr += 2);\n }\n\n // See https://tc39.es/ecma262/#sec-parseint-string-radix\n if (radix) {\n if (radix < 2 || radix > 36) {\n if (isFloat()) {\n // @ts-ignore: cast\n return NaN;\n } else {\n // @ts-ignore: cast\n return 0;\n }\n }\n // handle case as parseInt(\"0xFF\", 16) by spec\n if (radix == 16) {\n if (\n len > 2 &&\n code == CharCode._0 &&\n (load(ptr, 2) | 32) == CharCode.x\n ) {\n ptr += 4; len -= 2;\n }\n }\n } else {\n // determine radix by literal prefix\n if (code == CharCode._0 && len > 2) {\n switch (load(ptr, 2) | 32) {\n case CharCode.b: {\n ptr += 4; len -= 2;\n radix = 2;\n break;\n }\n case CharCode.o: {\n ptr += 4; len -= 2;\n radix = 8;\n break;\n }\n case CharCode.x: {\n ptr += 4; len -= 2;\n radix = 16;\n break;\n }\n }\n }\n if (!radix) radix = 10;\n }\n\n // calculate value\n // @ts-ignore: type\n var num: T = 0;\n while (len--) {\n code = load(ptr);\n if (code - CharCode._0 < 10) {\n code -= CharCode._0;\n } else if (code - CharCode.A <= (CharCode.Z - CharCode.A)) {\n code -= CharCode.A - 10;\n } else if (code - CharCode.a <= (CharCode.z - CharCode.a)) {\n code -= CharCode.a - 10;\n }\n if (code >= radix) {\n if (!num) {\n if (isFloat()) {\n // @ts-ignore: cast\n return NaN;\n } else {\n // @ts-ignore: cast\n return 0;\n }\n }\n break;\n }\n // @ts-ignore: type\n num = num * radix + code;\n ptr += 2;\n }\n // @ts-ignore: type\n return sign * num;\n}\n\nexport function strtod(str: string): f64 {\n var len = str.length;\n if (!len) return NaN;\n\n var ptr = changetype(str);\n var code = load(ptr);\n\n var sign = 1.0;\n // skip white spaces\n while (len && isSpace(code)) {\n code = load(ptr += 2);\n --len;\n }\n if (!len) return NaN;\n\n // try parse '-' or '+'\n if (code == CharCode.MINUS) {\n if (!--len) return NaN;\n code = load(ptr += 2);\n sign = -1;\n } else if (code == CharCode.PLUS) {\n if (!--len) return NaN;\n code = load(ptr += 2);\n }\n\n // try parse Infinity\n if (len >= 8 && code == CharCode.I) {\n if (\n load(ptr, 0) == 0x690066006E0049 && // ifnI\n load(ptr, 8) == 0x7900740069006E // ytin\n ) {\n return Infinity * sign;\n }\n return NaN;\n }\n // validate next symbol\n if (code != CharCode.DOT && (code - CharCode._0) >= 10) {\n return NaN;\n }\n var savedPtr = ptr;\n // skip zeros\n while (code == CharCode._0) {\n code = load(ptr += 2);\n --len;\n }\n if (len <= 0) return 0;\n const capacity = 19; // int(64 * 0.3010)\n var pointed = false;\n var consumed = 0;\n var position = 0;\n var x: u64 = 0;\n if (code == CharCode.DOT) {\n let noDigits = !(savedPtr - ptr);\n ptr += 2; --len;\n if (!len && noDigits) return NaN;\n for (pointed = true; (code = load(ptr)) == CharCode._0; --position, ptr += 2) --len;\n if (len <= 0) return 0;\n if (!position && noDigits && code - CharCode._0 >= 10) return NaN;\n }\n for (let digit = code - CharCode._0; digit < 10 || (code == CharCode.DOT && !pointed); digit = code - CharCode._0) {\n if (digit < 10) {\n x = consumed < capacity ? 10 * x + digit : x | u64(!!digit);\n ++consumed;\n } else {\n position = consumed;\n pointed = true;\n }\n if (!--len) break;\n code = load(ptr += 2);\n }\n\n if (!pointed) position = consumed;\n return copysign(scientific(x, position - min(capacity, consumed) + parseExp(ptr, len)), sign);\n}\n\nexport function joinBooleanArray(dataStart: usize, length: i32, separator: string): string {\n var lastIndex = length - 1;\n if (lastIndex < 0) return \"\";\n if (!lastIndex) return select(\"true\", \"false\", load(dataStart));\n\n var sepLen = separator.length;\n var valueLen = 5; // max possible length of element len(\"false\")\n var estLen = (valueLen + sepLen) * lastIndex + valueLen;\n var result = changetype(__new(estLen << 1, idof()));\n var offset = 0;\n var value: bool;\n for (let i = 0; i < lastIndex; ++i) {\n value = load(dataStart + i);\n valueLen = 4 + i32(!value);\n memory.copy(\n changetype(result) + (offset << 1),\n changetype(select(\"true\", \"false\", value)),\n valueLen << 1\n );\n offset += valueLen;\n if (sepLen) {\n memory.copy(\n changetype(result) + (offset << 1),\n changetype(separator),\n sepLen << 1\n );\n offset += sepLen;\n }\n }\n value = load(dataStart + lastIndex);\n valueLen = 4 + i32(!value);\n memory.copy(\n changetype(result) + (offset << 1),\n changetype(select(\"true\", \"false\", value)),\n valueLen << 1\n );\n offset += valueLen;\n\n if (estLen > offset) return result.substring(0, offset);\n return result;\n}\n\nexport function joinIntegerArray(dataStart: usize, length: i32, separator: string): string {\n var lastIndex = length - 1;\n if (lastIndex < 0) return \"\";\n if (!lastIndex) {\n let value = load(dataStart);\n if (isSigned()) {\n if (sizeof() <= 4) {\n // @ts-ignore: type\n return changetype(itoa32(value, 10));\n } else {\n // @ts-ignore: type\n return changetype(itoa64(value, 10));\n }\n } else {\n if (sizeof() <= 4) {\n // @ts-ignore: type\n return changetype(utoa32(value, 10));\n } else {\n // @ts-ignore: type\n return changetype(utoa64(value, 10));\n }\n }\n }\n\n var sepLen = separator.length;\n const valueLen = (sizeof() <= 4 ? 10 : 20) + i32(isSigned());\n var estLen = (valueLen + sepLen) * lastIndex + valueLen;\n var result = changetype(__new(estLen << 1, idof()));\n var offset = 0;\n var value: T;\n for (let i = 0; i < lastIndex; ++i) {\n value = load(dataStart + (i << alignof()));\n // @ts-ignore: type\n offset += itoa_buffered(changetype(result) + (offset << 1), value);\n if (sepLen) {\n memory.copy(\n changetype(result) + (offset << 1),\n changetype(separator),\n sepLen << 1\n );\n offset += sepLen;\n }\n }\n value = load(dataStart + (lastIndex << alignof()));\n // @ts-ignore: type\n offset += itoa_buffered(changetype(result) + (offset << 1), value);\n if (estLen > offset) return result.substring(0, offset);\n return result;\n}\n\nexport function joinFloatArray(dataStart: usize, length: i32, separator: string): string {\n var lastIndex = length - 1;\n if (lastIndex < 0) return \"\";\n if (!lastIndex) {\n return changetype(dtoa(\n // @ts-ignore: type\n load(dataStart))\n );\n }\n\n const valueLen = MAX_DOUBLE_LENGTH;\n var sepLen = separator.length;\n var estLen = (valueLen + sepLen) * lastIndex + valueLen;\n var result = changetype(__new(estLen << 1, idof()));\n var offset = 0;\n var value: T;\n for (let i = 0; i < lastIndex; ++i) {\n value = load(dataStart + (i << alignof()));\n // @ts-ignore: type\n offset += dtoa_buffered(changetype(result) + (offset << 1), value);\n if (sepLen) {\n memory.copy(\n changetype(result) + (offset << 1),\n changetype(separator),\n sepLen << 1\n );\n offset += sepLen;\n }\n }\n value = load(dataStart + (lastIndex << alignof()));\n // @ts-ignore: type\n offset += dtoa_buffered(changetype(result) + (offset << 1), value);\n if (estLen > offset) return result.substring(0, offset);\n return result;\n}\n\nexport function joinStringArray(dataStart: usize, length: i32, separator: string): string {\n var lastIndex = length - 1;\n if (lastIndex < 0) return \"\";\n if (!lastIndex) {\n // @ts-ignore: type\n return load(dataStart) || \"\";\n }\n var estLen = 0;\n var value: string;\n for (let i = 0; i < length; ++i) {\n value = load(dataStart + (i << alignof()));\n // @ts-ignore: type\n if (value !== null) estLen += value.length;\n }\n var offset = 0;\n var sepLen = separator.length;\n var result = changetype(__new((estLen + sepLen * lastIndex) << 1, idof()));\n for (let i = 0; i < lastIndex; ++i) {\n value = load(dataStart + (i << alignof()));\n if (value !== null) {\n let valueLen = value.length;\n memory.copy(\n changetype(result) + (offset << 1),\n changetype(value),\n valueLen << 1\n );\n offset += valueLen;\n }\n if (sepLen) {\n memory.copy(\n changetype(result) + (offset << 1),\n changetype(separator),\n sepLen << 1\n );\n offset += sepLen;\n }\n }\n value = load(dataStart + (lastIndex << alignof()));\n if (value !== null) {\n memory.copy(\n changetype(result) + (offset << 1),\n changetype(value),\n value.length << 1\n );\n }\n return result;\n}\n\nexport function joinReferenceArray(dataStart: usize, length: i32, separator: string): string {\n var lastIndex = length - 1;\n if (lastIndex < 0) return \"\";\n var value: T;\n if (!lastIndex) {\n value = load(dataStart);\n // @ts-ignore: type\n return value !== null ? value.toString() : \"\";\n }\n var result = \"\";\n var sepLen = separator.length;\n for (let i = 0; i < lastIndex; ++i) {\n value = load(dataStart + (i << alignof()));\n // @ts-ignore: type\n if (value !== null) result += value.toString();\n if (sepLen) result += separator;\n }\n value = load(dataStart + (lastIndex << alignof()));\n // @ts-ignore: type\n if (value !== null) result += value.toString();\n return result;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction scientific(significand: u64, exp: i32): f64 {\n if (!significand || exp < -342) return 0;\n if (exp > 308) return Infinity;\n // Try use fast path\n // Use fast path for string-to-double conversion if possible\n // see http://www.exploringbinary.com/fast-path-decimal-to-floating-point-conversion\n // Simple integer\n var significandf = significand;\n if (!exp) return significandf;\n if (exp > 22 && exp <= 22 + 15) {\n significandf *= pow10(exp - 22);\n exp = 22;\n }\n if (significand <= 9007199254740991 && abs(exp) <= 22) {\n if (exp > 0) return significandf * pow10(exp);\n return significandf / pow10(-exp);\n } else if (exp < 0) {\n return scaledown(significand, exp);\n } else {\n return scaleup(significand, exp);\n }\n}\n\n// Adopted from metallic lib:\n// https://github.com/jdh8/metallic/blob/master/src/stdlib/parse/scientific.h\n// @ts-ignore: decorator\n@inline\nfunction scaledown(significand: u64, exp: i32): f64 {\n const denom: u64 = 6103515625; // 1e14 * 0x1p-14\n const scale = reinterpret(0x3F06849B86A12B9B); // 1e-14 * 0x1p32\n\n var shift = clz(significand);\n significand <<= shift;\n shift = exp - shift;\n\n for (; exp <= -14; exp += 14) {\n let q = significand / denom;\n let r = significand % denom;\n let s = clz(q);\n significand = (q << s) + nearest(scale * (r << (s - 18)));\n shift -= s;\n }\n var b = ipow32(5, -exp);\n var q = significand / b;\n var r = significand % b;\n var s = clz(q);\n significand = (q << s) + (reinterpret(reinterpret(r) + (s << 52)) / b);\n shift -= s;\n\n return NativeMath.scalbn(significand, shift);\n}\n\n// Adopted from metallic lib:\n// https://github.com/jdh8/metallic/blob/master/src/stdlib/parse/scientific.h\n// @ts-ignore: decorator\n@inline\nfunction scaleup(significand: u64, exp: i32): f64 {\n const coeff: u32 = 1220703125; // 1e13 * 0x1p-13;\n var shift = ctz(significand);\n significand >>= shift;\n shift += exp;\n\n __fixmulShift = shift;\n for (; exp >= 13; exp -= 13) {\n significand = fixmul(significand, coeff);\n }\n significand = fixmul(significand, ipow32(5, exp));\n shift = __fixmulShift;\n return NativeMath.scalbn(significand, shift);\n}\n\n// Adopted from metallic lib:\n// https://github.com/jdh8/metallic/blob/master/src/stdlib/parse/scientific.h\n// @ts-ignore: decorator\n@inline\nfunction parseExp(ptr: usize, len: i32): i32 {\n var sign = 1, magnitude = 0;\n var code = load(ptr);\n // check code is 'e' or 'E'\n if ((code | 32) != CharCode.e) return 0;\n\n if (!--len) return 0;\n code = load(ptr += 2);\n if (code == CharCode.MINUS) {\n if (!--len) return 0;\n code = load(ptr += 2);\n sign = -1;\n } else if (code == CharCode.PLUS) {\n if (!--len) return 0;\n code = load(ptr += 2);\n }\n // skip zeros\n while (code == CharCode._0) {\n if (!--len) return 0;\n code = load(ptr += 2);\n }\n for (let digit: u32 = code - CharCode._0; len && digit < 10; digit = code - CharCode._0) {\n if (magnitude >= 3200) return sign * 3200;\n magnitude = 10 * magnitude + digit;\n code = load(ptr += 2);\n --len;\n }\n return sign * magnitude;\n}\n\n// @ts-ignore: decorator\n@lazy var __fixmulShift: u64 = 0;\n\n// Adopted from metallic lib:\n// https://github.com/jdh8/metallic/blob/master/src/stdlib/parse/scientific.h\n// @ts-ignore: decorator\n@inline\nfunction fixmul(a: u64, b: u32): u64 {\n var low = (a & 0xFFFFFFFF) * b;\n var high = (a >> 32) * b + (low >> 32);\n var overflow = (high >> 32);\n var space = clz(overflow);\n var revspace: u64 = 32 - space;\n __fixmulShift += revspace;\n return (high << space | (low & 0xFFFFFFFF) >> revspace) + (low << space >> 31 & 1);\n}\n\n// @ts-ignore: decorator\n@inline\nfunction pow10(n: i32): f64 {\n // argument `n` should bounds in [0, 22] range\n return load(POWERS10 + (n << alignof()));\n}\n","import { AL_MASK, OBJECT, OBJECT_OVERHEAD, BLOCK_MAXSIZE, BLOCK_OVERHEAD, BLOCK, OBJECT_MAXSIZE } from \"./common\";\nimport { E_ALLOCATION_TOO_LARGE } from \"../util/error\";\n\n// === A minimal runtime stub ===\n\n// @ts-ignore: decorator\n@lazy var startOffset: usize = ((__heap_base + BLOCK_OVERHEAD + AL_MASK) & ~AL_MASK) - BLOCK_OVERHEAD;\n// @ts-ignore: decorator\n@lazy var offset: usize = startOffset;\n\nfunction maybeGrowMemory(newOffset: usize): void {\n // assumes newOffset is aligned\n var pagesBefore = memory.size();\n var maxOffset = ((pagesBefore << 16) + AL_MASK) & ~AL_MASK;\n if (newOffset > maxOffset) {\n let pagesNeeded = (((newOffset - maxOffset + 0xffff) & ~0xffff) >>> 16);\n let pagesWanted = max(pagesBefore, pagesNeeded); // double memory\n if (memory.grow(pagesWanted) < 0) {\n if (memory.grow(pagesNeeded) < 0) unreachable(); // out of memory\n }\n }\n offset = newOffset;\n}\n\n// @ts-ignore: decorator\n@inline function computeSize(size: usize): usize {\n return ((size + BLOCK_OVERHEAD + AL_MASK) & ~AL_MASK) - BLOCK_OVERHEAD;\n}\n\n// @ts-ignore: decorator\n@unsafe @global\nexport function __alloc(size: usize): usize {\n if (size > BLOCK_MAXSIZE) throw new Error(E_ALLOCATION_TOO_LARGE);\n var block = changetype(offset);\n var ptr = offset + BLOCK_OVERHEAD;\n var payloadSize = computeSize(size);\n maybeGrowMemory(ptr + payloadSize);\n block.mmInfo = payloadSize;\n return ptr;\n}\n\n// @ts-ignore: decorator\n@unsafe @global\nexport function __realloc(ptr: usize, size: usize): usize {\n assert(ptr != 0 && !(ptr & AL_MASK)); // must exist and be aligned\n var block = changetype(ptr - BLOCK_OVERHEAD);\n var actualSize = block.mmInfo;\n var isLast = ptr + actualSize == offset;\n var payloadSize = computeSize(size);\n if (size > actualSize) {\n if (isLast) { // last block: grow\n if (size > BLOCK_MAXSIZE) throw new Error(E_ALLOCATION_TOO_LARGE);\n maybeGrowMemory(ptr + payloadSize);\n block.mmInfo = payloadSize;\n } else { // copy to new block at least double the size\n let newPtr = __alloc(max(payloadSize, actualSize << 1));\n memory.copy(newPtr, ptr, actualSize);\n block = changetype((ptr = newPtr) - BLOCK_OVERHEAD);\n }\n } else if (isLast) { // last block: shrink\n offset = ptr + payloadSize;\n block.mmInfo = payloadSize;\n }\n return ptr;\n}\n\n// @ts-ignore: decorator\n@unsafe @global\nexport function __free(ptr: usize): void {\n assert(ptr != 0 && !(ptr & AL_MASK)); // must exist and be aligned\n var block = changetype(ptr - BLOCK_OVERHEAD);\n if (ptr + block.mmInfo == offset) { // last block: discard\n offset = changetype(block);\n }\n}\n\n// @ts-ignore: decorator\n@unsafe @global\nexport function __reset(): void { // special\n offset = startOffset;\n}\n\n// @ts-ignore: decorator\n@unsafe @global\nexport function __new(size: usize, id: u32): usize {\n if (size > OBJECT_MAXSIZE) throw new Error(E_ALLOCATION_TOO_LARGE);\n var ptr = __alloc(OBJECT_OVERHEAD + size);\n var object = changetype(ptr - BLOCK_OVERHEAD);\n object.gcInfo = 0;\n object.gcInfo2 = 0;\n object.rtId = id;\n object.rtSize = size;\n return ptr + OBJECT_OVERHEAD;\n}\n\n// @ts-ignore: decorator\n@unsafe @global\nexport function __renew(oldPtr: usize, size: usize): usize {\n if (size > OBJECT_MAXSIZE) throw new Error(E_ALLOCATION_TOO_LARGE);\n var newPtr = __realloc(oldPtr - OBJECT_OVERHEAD, OBJECT_OVERHEAD + size);\n changetype(newPtr - BLOCK_OVERHEAD).rtSize = size;\n return newPtr + OBJECT_OVERHEAD;\n}\n\n// @ts-ignore: decorator\n@global @unsafe\nexport function __link(parentPtr: usize, childPtr: usize, expectMultiple: bool): void {\n // nop\n}\n\n// @ts-ignore: decorator\n@global @unsafe\nexport function __pin(ptr: usize): usize {\n return ptr;\n}\n\n// @ts-ignore: decorator\n@global @unsafe\nexport function __unpin(ptr: usize): void {\n // nop\n}\n\n// @ts-ignore: decorator\n@global @unsafe\nfunction __visit(ptr: usize, cookie: u32): void { // eslint-disable-line @typescript-eslint/no-unused-vars\n // nop\n}\n\n// @ts-ignore: decorator\n@global @unsafe\nexport function __collect(): void {\n // nop\n}\n","// Common error messages for use across the standard library. Keeping error messages compact\n// and reusing them where possible ensures minimal static data in binaries.\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_INDEXOUTOFRANGE: string = \"Index out of range\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_VALUEOUTOFRANGE: string = \"Value out of range\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_INVALIDLENGTH: string = \"Invalid length\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_ILLEGALGENTYPE: string = \"Illegal generic type\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_EMPTYARRAY: string = \"Array is empty\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_HOLEYARRAY: string = \"Element type must be nullable if array is holey\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_NOTIMPLEMENTED: string = \"Not implemented\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_KEYNOTFOUND: string = \"Key does not exist\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_ALLOCATION_TOO_LARGE: string = \"Allocation too large\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_ALREADY_PINNED: string = \"Object already pinned\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_NOT_PINNED: string = \"Object is not pinned\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_URI_MALFORMED: string = \"URI malformed\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_INVALIDDATE: string = \"Invalid Date\";\n","import { u128 } from './u128';\nimport { i256 } from './i256';\nimport { u256 } from './u256';\n\nimport {\n __clz128,\n __ctz128,\n __floatuntidf,\n\n __udivmod128,\n __divmod_quot_hi,\n __divmod_rem_lo,\n __divmod_rem_hi,\n} from '../globals';\n\nimport { atou128 } from '../utils';\n\nexport class i128 {\n\n @inline static get Zero(): i128 { return new i128(); }\n @inline static get One(): i128 { return new i128(1); }\n @inline static get Min(): i128 { return new i128(0, 0x8000000000000000); }\n @inline static get Max(): i128 { return new i128(u64.MAX_VALUE, 0x7FFFFFFFFFFFFFFF); }\n\n @inline\n static fromString(value: string, radix: i32 = 10): i128 {\n return changetype(atou128(value, radix));\n }\n\n @inline\n static fromI256(value: i256): i128 {\n return new i128(value.lo1, value.lo2);\n }\n\n @inline\n static fromU256(value: u256): i128 {\n return new i128(value.lo1, value.lo2);\n }\n\n @inline\n static fromI128(value: i128): i128 {\n return new i128(value.lo, value.hi);\n }\n\n @inline\n static fromU128(value: u128): i128 {\n return new i128(value.lo, value.hi);\n }\n\n @inline\n static fromI64(value: i64): i128 {\n return new i128(value, value >> 63);\n }\n\n @inline\n static fromU64(value: u64): i128 {\n return new i128(value);\n }\n\n // TODO need improvement\n // max safe uint for f64 actually 53-bits\n @inline\n static fromF64(value: f64): i128 {\n return new i128(value, reinterpret(value) >> 63);\n }\n\n // TODO need improvement\n // max safe int for f32 actually 23-bits\n @inline\n static fromF32(value: f32): i128 {\n return new i128(value, (reinterpret(value) >> 31));\n }\n\n @inline\n static fromI32(value: i32): i128 {\n return new i128(value, (value >> 31));\n }\n\n @inline\n static fromU32(value: u32): i128 {\n return new i128(value);\n }\n\n @inline\n static fromBits(lo1: i32, lo2: i32, hi1: i32, hi2: i32): i128 {\n return new i128(\n lo1 | ((lo2) << 32),\n hi1 | ((hi2) << 32),\n );\n }\n\n @inline\n static fromBytes(array: T, bigEndian: bool = false): i128 {\n if (array instanceof u8[]) {\n return bigEndian\n // @ts-ignore\n ? i128.fromBytesBE(array)\n // @ts-ignore\n : i128.fromBytesLE(array);\n } else if (array instanceof Uint8Array) {\n return bigEndian\n ? i128.fromUint8ArrayBE(array)\n : i128.fromUint8ArrayLE(array);\n } else {\n throw new TypeError(\"Unsupported generic type\");\n }\n }\n\n @inline\n static fromBytesLE(array: u8[]): i128 {\n return i128.fromUint8ArrayLE(changetype(array));\n }\n\n @inline\n static fromBytesBE(array: u8[]): i128 {\n return i128.fromUint8ArrayBE(changetype(array));\n }\n\n @inline\n static fromUint8ArrayLE(array: Uint8Array): i128 {\n assert(array.length && (array.length & 15) == 0);\n var buffer = array.dataStart;\n return new i128(\n load(buffer, 0 * sizeof()),\n load(buffer, 1 * sizeof())\n );\n }\n\n static fromUint8ArrayBE(array: Uint8Array): i128 {\n assert(array.length && (array.length & 15) == 0);\n var buffer = array.dataStart;\n return new i128(\n bswap(load(buffer, 1 * sizeof())),\n bswap(load(buffer, 0 * sizeof()))\n );\n }\n\n /**\n * Create 128-bit signed integer from generic type T\n * @param value\n * @return 128-bit signed integer\n */\n @inline\n static from(value: T): i128 {\n if (value instanceof bool) { return i128.fromU64(value); }\n else if (value instanceof i8) { return i128.fromI64(value); }\n else if (value instanceof u8) { return i128.fromU64(value); }\n else if (value instanceof i16) { return i128.fromI64(value); }\n else if (value instanceof u16) { return i128.fromU64(value); }\n else if (value instanceof i32) { return i128.fromI64(value); }\n else if (value instanceof u32) { return i128.fromU64(value); }\n else if (value instanceof i64) { return i128.fromI64(value); }\n else if (value instanceof u64) { return i128.fromU64(value); }\n else if (value instanceof f32) { return i128.fromF64(value); }\n else if (value instanceof f64) { return i128.fromF64(value); }\n else if (value instanceof i128) { return i128.fromI128(value); }\n else if (value instanceof u128) { return i128.fromU128(value); }\n else if (value instanceof i256) { return i128.fromI256(value); }\n else if (value instanceof u256) { return i128.fromU256(value); }\n else if (value instanceof u8[]) { return i128.fromBytes(value); }\n else { throw new TypeError(\"Unsupported generic type\"); }\n }\n\n constructor(\n public lo: u64 = 0,\n public hi: i64 = 0,\n ) {}\n\n @inline\n isPos(): bool {\n return this.hi >= 0;\n }\n\n @inline\n isNeg(): bool {\n return this.hi < 0;\n }\n\n @inline\n isZero(): bool {\n return !(this.lo | this.hi);\n }\n\n @inline @operator.prefix('~')\n not(): i128 {\n return new i128(~this.lo, ~this.hi);\n }\n\n @inline @operator.prefix('+')\n pos(): i128 {\n return this;\n }\n\n @inline @operator.prefix('-')\n neg(): i128 {\n var lo = ~this.lo;\n var hi = ~this.hi;\n var lo1 = lo + 1;\n return new i128(lo1, hi + i64(lo1 < 0));\n }\n\n @inline @operator.prefix('!')\n static isEmpty(value: i128): bool {\n return value === null || value.isZero();\n }\n\n @inline @operator('|')\n static or(a: i128, b: i128): i128 {\n return new i128(a.lo | b.lo, a.hi | b.hi);\n }\n\n @inline @operator('^')\n static xor(a: i128, b: u128): i128 {\n return new i128(a.lo ^ b.lo, a.hi ^ b.hi);\n }\n\n @inline @operator('&')\n static and(a: i128, b: i128): i128 {\n return new i128(a.lo & b.lo, a.hi & b.hi);\n }\n\n @inline @operator('<<')\n static shl(value: i128, shift: i32): i128 {\n shift &= 127;\n\n // need for preventing redundant i32 -> u64 extends\n var shift64: i64 = shift;\n\n var mod1: i64 = ((((shift64 + 127) | shift64) & 64) >>> 6) - 1;\n var mod2: i64 = (shift64 >>> 6) - 1;\n\n shift64 &= 63;\n\n var vl = value.lo;\n var lo = vl << shift64;\n var hi = lo & ~mod2;\n\n hi |= ((value.hi << shift64) | ((vl >>> (64 - shift64)) & mod1)) & mod2;\n\n return new i128(lo & mod2, hi);\n }\n\n @inline @operator('>>>')\n static shr_u(value: i128, shift: i32): i128 {\n shift &= 127;\n\n // need for preventing redundant i32 -> u64 extends\n var shift64: i64 = shift;\n\n var mod1: i64 = ((((shift64 + 127) | shift64) & 64) >>> 6) - 1;\n var mod2: i64 = (shift64 >>> 6) - 1;\n\n shift64 &= 63;\n\n var vh = value.hi;\n var hi = vh >>> shift64;\n var lo = hi & ~mod2;\n\n lo |= ((value.lo >>> shift64) | ((vh << (64 - shift64)) & mod1)) & mod2;\n\n return new i128(lo, hi & mod2);\n }\n\n @inline @operator('+')\n static add(a: i128, b: i128): i128 {\n var blo = b.lo;\n var bhi = b.hi;\n var lo = a.lo + blo - (bhi >>> 63);\n var hi = a.hi + bhi + i64(lo < blo);\n return new i128(lo, hi);\n }\n\n @inline @operator('-')\n static sub(a: i128, b: i128): i128 {\n var alo = a.lo;\n var bhi = b.hi;\n var lo = alo - b.lo + (bhi >>> 63);\n var hi = a.hi - bhi - i64(lo > alo);\n return new i128(lo, hi);\n }\n\n @inline @operator('==')\n static eq(a: i128, b: i128): bool {\n return a.hi == b.hi && a.lo == b.lo;\n }\n\n @inline @operator('!=')\n static ne(a: i128, b: i128): bool {\n return !i128.eq(a, b);\n }\n\n @inline @operator('<')\n static lt(a: i128, b: i128): bool {\n var ah = a.hi, bh = b.hi;\n return ah == bh ? a.lo < b.lo : ah < bh;\n }\n\n @inline @operator('>')\n static gt(a: i128, b: i128): bool {\n var ah = a.hi, bh = b.hi;\n return ah == bh ? a.lo > b.lo : ah > bh;\n }\n\n @inline @operator('<=')\n static le(a: i128, b: i128): bool {\n return !i128.gt(a, b);\n }\n\n @inline @operator('>=')\n static ge(a: i128, b: i128): bool {\n return !i128.lt(a, b);\n }\n\n @inline\n static ord(a: i128, b: i128): i32 {\n var dlo = a.lo - b.lo;\n var dhi = a.hi - b.hi;\n var cmp = select(dhi, dlo, dhi != 0);\n // normalize to [-1, 0, 1]\n return i32(cmp > 0) - i32(cmp < 0);\n }\n\n @inline\n static popcnt(value: i128): i32 {\n return (popcnt(value.lo) + popcnt(value.hi));\n }\n\n @inline\n static clz(value: i128): i32 {\n return __clz128(value.lo, value.hi);\n }\n\n @inline\n static ctz(value: i128): i32 {\n return __ctz128(value.lo, value.hi);\n }\n\n @inline\n static abs(value: i128): i128 {\n var lo = value.lo;\n var hi = value.hi;\n if (hi >>> 63) {\n lo = -lo;\n hi = ~hi + i64(lo == 0);\n }\n return new i128(lo, hi);\n }\n\n @inline\n private toArrayBufferLE(buffer: usize): void {\n store(buffer, this.lo, 0 * sizeof());\n store(buffer, this.hi, 1 * sizeof());\n }\n\n @inline\n private toArrayBufferBE(buffer: usize): void {\n store(buffer, bswap(this.hi), 0 * sizeof());\n store(buffer, bswap(this.lo), 1 * sizeof());\n }\n\n @inline\n private toArrayBuffer(buffer: usize, bigEndian: bool = false): void {\n if (bigEndian) {\n this.toArrayBufferBE(buffer);\n } else {\n this.toArrayBufferLE(buffer);\n }\n }\n\n /**\n * Convert to byte array\n * @param le Little or Big Endian? Default: true\n * @returns Array of bytes\n */\n @inline\n toBytes(bigEndian: bool = false): u8[] {\n var result = new Array(16);\n this.toArrayBuffer(result.dataStart, bigEndian);\n return result;\n }\n\n /**\n * Convert to Uint8Array\n * @param le Little or Big Endian? Default: true\n * @returns Uint8Array\n */\n @inline\n toUint8Array(bigEndian: bool = false): Uint8Array {\n var result = new Uint8Array(16);\n this.toArrayBuffer(result.dataStart, bigEndian);\n return result;\n }\n\n // TODO\n}\n","type auto = i32;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isInteger(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isFloat(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isBoolean(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isSigned(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isReference(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isString(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isArray(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isArrayLike(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isFunction(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isNullable(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isDefined(expression: auto): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isConstant(expression: auto): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isManaged(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isVoid(): bool;\n\n// @ts-ignore\n@builtin\nexport declare function lengthof(func?: T): i32;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function clz(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function ctz(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function popcnt(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function rotl(value: T, shift: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function rotr(value: T, shift: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function abs(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function max(left: T, right: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function min(left: T, right: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function ceil(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function floor(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function copysign(left: T, right: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function nearest(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function reinterpret(value: number): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function sqrt(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function trunc(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function add(left: T, right: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function sub(left: T, right: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function mul(left: T, right: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function div(left: T, right: T): T;\n\n// @ts-ignore: decorator\n@unsafe @builtin\nexport declare function load(ptr: usize, immOffset?: usize, immAlign?: usize): T;\n\n// @ts-ignore: decorator\n@unsafe @builtin\nexport declare function store(ptr: usize, value: auto, immOffset?: usize, immAlign?: usize): void;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function sizeof(): usize; // | u32 / u64\n\n// @ts-ignore: decorator\n@builtin\nexport declare function alignof(): usize; // | u32 / u64\n\n// @ts-ignore: decorator\n@builtin\nexport declare function offsetof(fieldName?: string): usize; // | u32 / u64\n\n// @ts-ignore: decorator\n@builtin\nexport declare function idof(): u32;\n\n// @ts-ignore\n@builtin\nexport declare function nameof(): string;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function select(ifTrue: T, ifFalse: T, condition: bool): T;\n\n// @ts-ignore: decorator\n@unsafe @builtin\nexport declare function unreachable(): void;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function changetype(value: auto): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function assert(isTrueish: T, message?: string): T;\n\n// @ts-ignore: decorator\n@unsafe @builtin\nexport declare function unchecked(expr: T): T;\n\n// @ts-ignore: decorator\n@unsafe @builtin\nexport declare function call_indirect(index: u32, ...args: auto[]): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function instantiate(...args: auto[]): T;\n\nexport namespace atomic {\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load(ptr: usize, immOffset?: usize): T;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store(ptr: usize, value: T, immOffset?: usize): void;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(ptr: usize, value: T, immOffset?: usize): T;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(ptr: usize, value: T, immOffset?: usize): T;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and(ptr: usize, value: T, immOffset?: usize): T;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or(ptr: usize, value: T, immOffset?: usize): T;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor(ptr: usize, value: T, immOffset?: usize): T;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function xchg(ptr: usize, value: T, immOffset?: usize): T;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function cmpxchg(ptr: usize, expected: T, replacement: T, immOffset?: usize): T;\n\n // @ts-ignore: decorator\n @builtin\n export declare function wait(ptr: usize, expected: T, timeout: i64): AtomicWaitResult;\n\n // @ts-ignore: decorator\n @builtin\n export declare function notify(ptr: usize, count: i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function fence(): void;\n}\n\n// @ts-ignore: decorator\n@lazy\nexport const enum AtomicWaitResult {\n OK = 0,\n NOT_EQUAL = 1,\n TIMED_OUT = 2\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function i8(value: auto): i8;\n\nexport namespace i8 {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: i8 = -128;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: i8 = 127;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function i16(value: auto): i16;\n\nexport namespace i16 {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: i16 = -32768;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: i16 = 32767;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function i32(value: auto): i32;\n\nexport namespace i32 {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: i32 = -2147483648;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: i32 = 2147483647;\n\n // @ts-ignore: decorator\n @builtin\n export declare function clz(value: i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ctz(value: i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function popcnt(value: i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(left: i32, right:i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(left: i32, right:i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(left: i32, right:i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div_s(left: i32, right:i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div_u(left: i32, right:i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function rotl(value: i32, shift: i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function rotr(value: i32, shift: i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function reinterpret_f32(value: f32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load8_s(ptr: usize, immOffset?: usize, immAlign?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load8_u(ptr: usize, immOffset?: usize, immAlign?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load16_s(ptr: usize, immOffset?: usize, immAlign?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load16_u(ptr: usize, immOffset?: usize, immAlign?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load(ptr: usize, immOffset?: usize, immAlign?: usize): i32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store8(ptr: usize, value: i32, immOffset?: usize, immAlign?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store16(ptr: usize, value: i32, immOffset?: usize, immAlign?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store(ptr: usize, value: i32, immOffset?: usize, immAlign?: usize): void;\n\n export namespace atomic {\n\n // @ts-ignore: decorator\n @builtin\n export declare function load8_u(ptr: usize, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load16_u(ptr: usize, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load(ptr: usize, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store8(ptr: usize, value: i32, immOffset?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store16(ptr: usize, value: i32, immOffset?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store(ptr: usize, value: i32, immOffset?: usize): void;\n\n // @ts-ignore: decorator\n @builtin\n export declare function wait(ptr: usize, expected: i32, timeout: i64): AtomicWaitResult;\n\n export namespace rmw8 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function xchg_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function cmpxchg_u(ptr: usize, expected: i32, replacement: i32, immOffset?: usize): i32;\n }\n\n export namespace rmw16 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function xchg_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function cmpxchg_u(ptr: usize, expected: i32, replacement: i32, immOffset?: usize): i32;\n }\n\n export namespace rmw {\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function xchg(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function cmpxchg(ptr: usize, expected: i32, replacement: i32, immOffset?: usize): i32;\n }\n }\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function i64(value: auto): i64;\n\nexport namespace i64 {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: i64 = -9223372036854775808;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: i64 = 9223372036854775807;\n\n // @ts-ignore: decorator\n @builtin\n export declare function clz(value: i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ctz(value: i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(left: i64, right:i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(left: i64, right:i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(left: i64, right:i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div_s(left: i64, right:i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div_u(left: i64, right:i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load8_s(ptr: usize, immOffset?: usize, immAlign?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load8_u(ptr: usize, immOffset?: usize, immAlign?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load16_s(ptr: usize, immOffset?: usize, immAlign?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load16_u(ptr: usize, immOffset?: usize, immAlign?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load32_s(ptr: usize, immOffset?: usize, immAlign?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load32_u(ptr: usize, immOffset?: usize, immAlign?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load(ptr: usize, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function popcnt(value: i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function rotl(value: i64, shift: i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function rotr(value: i64, shift: i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function reinterpret_f64(value: f64): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store8(ptr: usize, value: i64, immOffset?: usize, immAlign?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store16(ptr: usize, value: i64, immOffset?: usize, immAlign?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store32(ptr: usize, value: i64, immOffset?: usize, immAlign?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store(ptr: usize, value: i64, immOffset?: usize, immAlign?: usize): void;\n\n export namespace atomic {\n\n // @ts-ignore: decorator\n @builtin\n export declare function load8_u(ptr: usize, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load16_u(ptr: usize, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load32_u(ptr: usize, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load(ptr: usize, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store8(ptr: usize, value: i64, immOffset?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store16(ptr: usize, value: i64, immOffset?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store32(ptr: usize, value: i64, immOffset?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store(ptr: usize, value: i64, immOffset?: usize): void;\n\n // @ts-ignore: decorator\n @builtin\n export declare function wait(ptr: usize, expected: i64, timeout: i64): AtomicWaitResult;\n\n export namespace rmw8 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function xchg_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function cmpxchg_u(ptr: usize, expected: i64, replacement: i64, immOffset?: usize): i64;\n }\n\n export namespace rmw16 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function xchg_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function cmpxchg_u(ptr: usize, expected: i64, replacement: i64, immOffset?: usize): i64;\n }\n\n export namespace rmw32 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function xchg_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function cmpxchg_u(ptr: usize, expected: i64, replacement: i64, immOffset?: usize): i64;\n }\n\n export namespace rmw {\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function xchg(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function cmpxchg(ptr: usize, expected: i64, replacement: i64, immOffset?: usize): i64;\n }\n }\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isize(value: auto): isize;\n\nexport namespace isize {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: isize = sizeof() == sizeof()\n ? -2147483648\n : -9223372036854775808;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: isize = sizeof() == sizeof()\n ? 2147483647\n : 9223372036854775807;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function u8(value: auto): u8;\n\nexport namespace u8 {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: u8 = 0;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: u8 = 255;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function u16(value: auto): u16;\n\nexport namespace u16 {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: u16 = 0;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: u16 = 65535;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function u32(value: auto): u32;\n\nexport namespace u32 {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: u32 = 0;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: u32 = 4294967295;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function u64(value: auto): u64;\n\nexport namespace u64 {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: u64 = 0;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: u64 = 18446744073709551615;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function usize(value: auto): usize;\n\nexport namespace usize {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: usize = 0;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: usize = sizeof() == sizeof()\n ? 4294967295\n : 18446744073709551615;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function bool(value: auto): bool;\n\nexport namespace bool {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: bool = false;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: bool = true;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function f32(value: auto): f32;\n\nexport namespace f32 {\n\n // @ts-ignore: decorator\n @lazy\n export const EPSILON = reinterpret(0x34000000); // 0x1p-23f\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE = reinterpret(0x00000001); // 0x0.000001p+0f\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE = reinterpret(0x7F7FFFFF); // 0x1.fffffep+127f\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_NORMAL_VALUE = reinterpret(0x00800000); // 0x1p-126f\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_SAFE_INTEGER: f32 = -16777215;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_SAFE_INTEGER: f32 = 16777215;\n\n // @ts-ignore: decorator\n @lazy\n export const POSITIVE_INFINITY: f32 = Infinity;\n\n // @ts-ignore: decorator\n @lazy\n export const NEGATIVE_INFINITY: f32 = -Infinity;\n\n // @ts-ignore: decorator\n @lazy\n export const NaN: f32 = 0.0 / 0.0;\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(value: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ceil(value: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function copysign(x: f32, y: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function floor(value: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load(ptr: usize, immOffset?: usize, immAlign?: usize): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max(left: f32, right: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min(left: f32, right: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function nearest(value: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function reinterpret_i32(value: i32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sqrt(value: f32): f32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store(ptr: usize, value: f32, immOffset?: usize, immAlign?: usize): void;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc(value: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(left: f32, right: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(left: f32, right: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(left: f32, right: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div(left: f32, right: f32): f32;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function f64(value: auto): f64;\n\nexport namespace f64 {\n\n // @ts-ignore: decorator\n @lazy\n export const EPSILON = reinterpret(0x3CB0000000000000); // 0x1p-52\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE = reinterpret(0x0000000000000001); // 0x0.0000000000001p+0\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE = reinterpret(0x7FEFFFFFFFFFFFFF); // 0x1.fffffffffffffp+1023\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_NORMAL_VALUE = reinterpret(0x0010000000000000); // 0x1p-1022\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_SAFE_INTEGER: f64 = -9007199254740991;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_SAFE_INTEGER: f64 = 9007199254740991;\n\n // @ts-ignore: decorator\n @lazy\n export const POSITIVE_INFINITY: f64 = Infinity;\n\n // @ts-ignore: decorator\n @lazy\n export const NEGATIVE_INFINITY: f64 = -Infinity;\n\n // @ts-ignore: decorator\n @lazy\n export const NaN: f64 = 0.0 / 0.0;\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(value: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ceil(value: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function copysign(x: f64, y: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function floor(value: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load(ptr: usize, immOffset?: usize, immAlign?: usize): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max(left: f64, right: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min(left: f64, right: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function nearest(value: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function reinterpret_i64(value: i64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sqrt(value: f64): f64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store(ptr: usize, value: f64, immOffset?: usize, immAlign?: usize): void;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc(value: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(left: f64, right: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(left: f64, right: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(left: f64, right: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div(left: f64, right: f64): f64;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function v128(\n a: i8, b: i8, c: i8, d: i8, e: i8, f: i8, g: i8, h: i8,\n i: i8, j: i8, k: i8, l: i8, m: i8, n: i8, o: i8, p: i8\n): v128;\n\nexport namespace v128 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function splat(x: T): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane(x: v128, idx: u8): T;\n\n // @ts-ignore: decorator\n @builtin\n export declare function replace_lane(x: v128, idx: u8, value: T): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shuffle(a: v128, b: v128, ...lanes: u8[]): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function swizzle(a: v128, s: v128): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load(ptr: usize, immOffset?: usize, immAlign?: usize): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load_ext(ptr: usize, immOffset?: usize, immAlign?: usize): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load8x8_s(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load8x8_u(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load16x4_s(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load16x4_u(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load32x2_s(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load32x2_u(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load_splat(ptr: usize, immOffset?: usize, immAlign?: usize): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load8_splat(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load16_splat(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load32_splat(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load64_splat(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store(ptr: usize, value: v128, immOffset?: usize, immAlign?: usize): void;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div(a: v128, b: v128): v128; // f32, f64 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function neg(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_sat(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_sat(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shl(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function andnot(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function not(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function bitselect(v1: v128, v2: v128, c: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function any_true(a: v128): bool;\n\n // @ts-ignore: decorator\n @builtin\n export declare function all_true(a: v128): bool;\n\n // @ts-ignore: decorator\n @builtin\n export declare function bitmask(a: v128): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function popcnt(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function pmin(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function pmax(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function dot(a: v128, b: v128): v128; // i16 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function avgr(a: v128, b: v128): v128; // u8, u16 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(a: v128): v128; // f32, f64 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function sqrt(a: v128): v128; // f32, f64 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function ceil(a: v128): v128; // f32, f64 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function floor(a: v128): v128; // f32, f64 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc(a: v128): v128; // f32, f64 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function nearest(a: v128): v128; // f32, f64 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function eq(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ne(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function convert(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc_sat(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function narrow(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_low(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_high(a: v128): v128;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function i8x16(\n a: i8, b: i8, c: i8, d: i8, e: i8, f: i8, g: i8, h: i8,\n i: i8, j: i8, k: i8, l: i8, m: i8, n: i8, o: i8, p: i8\n): v128;\n\nexport namespace i8x16 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function splat(x: i8): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane_s(x: v128, idx: u8): i8;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane_u(x: v128, idx: u8): u8;\n\n // @ts-ignore: decorator\n @builtin\n export declare function replace_lane(x: v128, idx: u8, value: i8): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function avgr_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function neg(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_sat_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_sat_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_sat_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_sat_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shl(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr_s(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr_u(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function all_true(a: v128): bool;\n\n // @ts-ignore: decorator\n @builtin\n export declare function bitmask(a: v128): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function popcnt(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function eq(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ne(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function narrow_i16x8_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function narrow_i16x8_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shuffle(\n a: v128, b: v128,\n l0: u8, l1: u8, l2: u8, l3: u8, l4: u8, l5: u8, l6: u8, l7: u8,\n l8: u8, l9: u8, l10: u8, l11: u8, l12: u8, l13: u8, l14: u8, l15: u8\n ): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function swizzle(a: v128, s: v128): v128;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function i16x8(a: i16, b: i16, c: i16, d: i16, e: i16, f: i16, g: i16, h: i16): v128;\n\nexport namespace i16x8 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function splat(x: i16): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane_s(x: v128, idx: u8): i16;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane_u(x: v128, idx: u8): u16;\n\n // @ts-ignore: decorator\n @builtin\n export declare function replace_lane(x: v128, idx: u8, value: i16): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function avgr_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function neg(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_sat_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_sat_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_sat_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_sat_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shl(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr_s(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr_u(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function all_true(a: v128): bool;\n\n // @ts-ignore: decorator\n @builtin\n export declare function bitmask(a: v128): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function eq(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ne(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function narrow_i32x4_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function narrow_i32x4_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_low_i8x16_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_low_i8x16_u(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_high_i8x16_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_high_i8x16_u(a: v128): v128;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function i32x4(a: i32, b: i32, c: i32, d: i32): v128;\n\nexport namespace i32x4 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function splat(x: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane(x: v128, idx: u8): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function replace_lane(x: v128, idx: u8, value: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function dot_i16x8_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function neg(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shl(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr_s(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr_u(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function all_true(a: v128): bool;\n\n // @ts-ignore: decorator\n @builtin\n export declare function bitmask(a: v128): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function eq(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ne(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc_sat_f32x4_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc_sat_f32x4_u(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_low_i16x8_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_low_i16x8_u(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_high_i16x8_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_high_i16x8_u(a: v128): v128;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function i64x2(a: i64, b: i64): v128;\n\nexport namespace i64x2 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function splat(x: i64): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane(x: v128, idx: u8): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function replace_lane(x: v128, idx: u8, value: i64): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function neg(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shl(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr_s(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr_u(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function all_true(a: v128): bool;\n\n // @ts-ignore: decorator\n @builtin\n export declare function bitmask(a: v128): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function eq(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ne(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_low_i32x4_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_low_i32x4_u(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_high_i32x4_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_high_i32x4_u(a: v128): v128;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function f32x4(a: f32, b: f32, c: f32, d: f32): v128;\n\nexport namespace f32x4 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function splat(x: f32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane(x: v128, idx: u8): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function replace_lane(x: v128, idx: u8, value: f32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function neg(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function pmin(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function pmax(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sqrt(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ceil(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function floor(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function nearest(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function eq(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ne(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function convert_i32x4_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function convert_i32x4_u(a: v128): v128;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function f64x2(a: f64, b: f64): v128;\n\nexport namespace f64x2 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function splat(x: f64): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane(x: v128, idx: u8): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function replace_lane(x: v128, idx: u8, value: f64): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function neg(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function pmin(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function pmax(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sqrt(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ceil(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function floor(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function nearest(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function eq(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ne(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge(a: v128, b: v128): v128;\n}\n\n@final\nexport abstract class i31 { // FIXME: usage of 'new' requires a class :(\n\n // @ts-ignore: decorator\n @builtin\n static new(value: i32): i31ref { return unreachable(); }\n\n // @ts-ignore: decorator\n @builtin\n static get(i31expr: i31ref): i32 { return unreachable(); }\n}\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n// @ts-ignore: decorator\n@external(\"env\", \"abort\")\ndeclare function abort(\n message?: string | null,\n fileName?: string | null,\n lineNumber?: u32,\n columnNumber?: u32\n): void;\n\n// @ts-ignore: decorator\n@external(\"env\", \"trace\")\ndeclare function trace(\n message: string,\n n?: i32,\n a0?: f64,\n a1?: f64,\n a2?: f64,\n a3?: f64,\n a4?: f64\n): void;\n\n// @ts-ignore: decorator\n@external(\"env\", \"seed\")\ndeclare function seed(): f64;\n\n/* eslint-enable @typescript-eslint/no-unused-vars */\n","import { CharCode } from \"util/string\";\nimport { u128 } from \"./integer/u128\";\nimport { u256 } from \"./integer/u256\";\n\n// @ts-ignore: decorator\n@lazy const HEX_CHARS = '0123456789abcdef';\n\n// @ts-ignore: decorator\n@lazy const MaxBaseForExponent128: u64[] = [\n u64.MAX_VALUE, // 0\n u64.MAX_VALUE, // 1\n u64.MAX_VALUE, // 2\n 0x000006597FA94F5B, // 3\n 0x00000000FFFFFFFF, // 4\n 0x0000000003080C00, // 5\n 0x0000000000285145, // 6\n 0x000000000004E045, // 7\n 0x000000000000FFFF, // 8\n 0x0000000000004AA8, // 9\n 0x0000000000001BDB, // 10\n 0x0000000000000C6F, // 11\n 0x0000000000000659, // 12\n 0x0000000000000398, // 13\n 0x0000000000000235, // 14\n 0x0000000000000172, // 15\n 0x00000000000000FF, // 16\n 0x00000000000000B8, // 17\n 0x000000000000008A, // 18\n 0x000000000000006A, // 19\n 0x0000000000000054, // 20\n 0x0000000000000044, // 21\n 0x0000000000000038, // 22\n 0x000000000000002F, // 23\n 0x0000000000000028, // 24\n 0x0000000000000022, // 25\n 0x000000000000001E, // 26\n 0x000000000000001A, // 27\n 0x0000000000000017, // 28\n 0x0000000000000015, // 29\n 0x0000000000000013, // 30\n 0x0000000000000011, // 31\n 0x000000000000000F, // 32\n 0x000000000000000E, // 33\n 0x000000000000000D, // 34\n 0x000000000000000C, // 35\n 0x000000000000000B, // 36\n 0x000000000000000B, // 37\n 0x000000000000000A, // 38\n];\n\n// Use LUT wrapped by function for lazy compilation\n// @ts-ignore: decorator\n@lazy const RadixCharsTable: u8[] = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 36, 36, 36, 36, 36, 36,\n 36, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,\n 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 36, 36, 36, 36,\n 36, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,\n 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35\n];\n\n@inline\nexport function isPowerOverflow128(base: u128, exponent: i32): bool {\n if (!(exponent > 1 && base > u128.One)) return false;\n if (base.hi != 0 || exponent >= 128) return true;\n\n var low = base.lo;\n if (low <= 9) {\n switch (low) {\n case 2: return exponent > 127;\n case 3: return exponent > 80;\n case 4: return exponent > 63;\n case 5: return exponent > 55;\n case 6: return exponent > 49;\n case 7: return exponent > 45;\n case 8: return exponent > 42;\n case 9: return exponent > 40;\n }\n }\n return low > MaxBaseForExponent128[exponent];\n}\n\n// helper function for utoa\nfunction processU64(digits: Int8Array, value: u64): void {\n var length = digits.length - 1;\n for (let i = 63; i != -1; i--) {\n for (let j = 0; j <= length; j++) {\n digits[j] = digits[j] + (i8(digits[j] >= 5) * 3);\n }\n for (let j = length; j != -1; j--) {\n digits[j] = digits[j] << 1;\n if (j < length) digits[j + 1] = (digits[j+1] | i8(digits[j] > 15));\n digits[j] = digits[j] & 15;\n }\n digits[0] = digits[0] + i8((value & (1 << i)) != 0);\n }\n}\n\nexport function u128toa10(value: u128): string {\n var length = 40;\n var digits = new Int8Array(length);\n\n processU64(digits, value.hi);\n processU64(digits, value.lo);\n\n var result = \"\";\n var start = false;\n for (let i = length - 1; i != -1; i--) {\n if (!start && digits[i] > 0) start = true;\n if (start) result = result.concat(HEX_CHARS.charAt(digits[i]));\n }\n return result;\n}\n\nexport function u256toa10(value: u256): string {\n var length = 78;\n var digits = new Int8Array(length);\n\n processU64(digits, value.hi2);\n processU64(digits, value.hi1);\n processU64(digits, value.lo2);\n processU64(digits, value.lo1);\n\n var result = \"\";\n var start = false;\n for (let i = length - 1; i != -1; i--) {\n if (!start && digits[i] > 0) start = true;\n if (start) result = result.concat(HEX_CHARS.charAt(digits[i]));\n }\n return result;\n}\n\nexport function atou128(str: string, radix: i32 = 10): u128 {\n if (radix < 2 || radix > 36) {\n throw new Error(\"Invalid radix\");\n }\n var len = str.length;\n if (!len) return u128.Zero;\n\n var first = str.charCodeAt(0);\n if (len == 1 && first == CharCode._0) {\n return u128.Zero;\n }\n var isNeg = first == CharCode.MINUS;\n // @ts-ignore\n var index = (isNeg | (first == CharCode.PLUS));\n\n if (str.charCodeAt(index) == CharCode._0) {\n let second = str.charCodeAt(++index);\n if (second == CharCode.x || second == CharCode.X) {\n radix = 16; ++index;\n } else if (second == CharCode.o || second == CharCode.O) {\n radix = 8; ++index;\n } else if (second == CharCode.b || second == CharCode.B) {\n radix = 2; ++index;\n }\n }\n var result = u128.Zero;\n var table = RadixCharsTable;\n\n if (ASC_SHRINK_LEVEL >= 1) {\n let radix128 = u128.fromU64(radix);\n do {\n let n: u32 = str.charCodeAt(index) - CharCode._0;\n if (n > (CharCode.z - CharCode._0)) break;\n\n let num = unchecked(table[n]);\n if (num >= radix) break;\n\n // @ts-ignore\n result *= radix128;\n // @ts-ignore\n result += u128.fromU64(num);\n } while (++index < len);\n } else {\n switch (radix) {\n case 2: {\n do {\n let num: u32 = str.charCodeAt(index) - CharCode._0;\n if (num >= 2) break;\n // @ts-ignore\n result <<= 1;\n // @ts-ignore\n result |= u128.fromU64(num);\n } while (++index < len);\n break;\n }\n case 10: {\n do {\n let num: u32 = str.charCodeAt(index) - CharCode._0;\n if (num >= 10) break;\n // @ts-ignore\n result = (result << 3) + (result << 1);\n // @ts-ignore\n result += u128.fromU64(num);\n } while (++index < len);\n break;\n }\n case 16: {\n do {\n let n: u32 = str.charCodeAt(index) - CharCode._0;\n if (n > (CharCode.z - CharCode._0)) break;\n\n let num = unchecked(table[n]);\n if (num >= 16) break;\n\n // @ts-ignore\n result <<= 4;\n // @ts-ignore\n result |= u128.fromU64(num);\n } while (++index < len);\n break;\n }\n default: {\n let radix128 = u128.fromU64(radix);\n do {\n let n: u32 = str.charCodeAt(index) - CharCode._0;\n if (n > (CharCode.z - CharCode._0)) break;\n\n let num = unchecked(table[n]);\n if (num >= radix) break;\n\n // @ts-ignore\n result *= radix128;\n // @ts-ignore\n result += u128.fromU64(num);\n } while (++index < len);\n break;\n }\n }\n }\n // @ts-ignore\n return isNeg ? -result : result;\n}\n","/// \n\nimport { OBJECT, BLOCK_MAXSIZE, TOTAL_OVERHEAD } from \"./rt/common\";\nimport { compareImpl, strtol, strtod, isSpace, isAscii, isFinalSigma, toLower8, toUpper8 } from \"./util/string\";\nimport { SPECIALS_UPPER, casemap, bsearch } from \"./util/casemap\";\nimport { E_INDEXOUTOFRANGE, E_INVALIDLENGTH } from \"./util/error\";\nimport { idof } from \"./builtins\";\nimport { Array } from \"./array\";\n\n@final export abstract class String {\n\n @lazy static readonly MAX_LENGTH: i32 = (BLOCK_MAXSIZE >>> alignof());\n\n static fromCharCode(unit: i32, surr: i32 = -1): String {\n var hasSur = surr > 0;\n var out = changetype(__new(2 << i32(hasSur), idof()));\n store(changetype(out), unit);\n if (hasSur) store(changetype(out), surr, 2);\n return out;\n }\n\n static fromCharCodes(units: Array): String {\n var length = units.length;\n var out = changetype(__new(length << 1, idof()));\n var ptr = units.dataStart;\n for (let i = 0; i < length; ++i) {\n store(changetype(out) + (i << 1), load(ptr + (i << 2)));\n }\n return out;\n }\n\n static fromCodePoint(code: i32): String {\n assert(code <= 0x10FFFF);\n var hasSur = code > 0xFFFF;\n var out = changetype(__new(2 << i32(hasSur), idof()));\n if (!hasSur) {\n store(changetype(out), code);\n } else {\n code -= 0x10000;\n let hi = (code & 0x03FF) | 0xDC00;\n let lo = (code >>> 10) | 0xD800;\n store(changetype(out), lo | (hi << 16));\n }\n return out;\n }\n\n @builtin static raw(parts: TemplateStringsArray, ...args: unknown[]): string { return unreachable(); }\n\n get length(): i32 {\n return changetype(changetype(this) - TOTAL_OVERHEAD).rtSize >> 1;\n }\n\n at(pos: i32): String {\n var len = this.length;\n pos += select(0, len, pos >= 0);\n if (pos >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n var out = __new(2, idof());\n store(out, load(changetype(this) + (pos << 1)));\n return changetype(out); // retains\n }\n\n @operator(\"[]\") charAt(pos: i32): String {\n if (pos >= this.length) return changetype(\"\");\n var out = changetype(__new(2, idof()));\n store(changetype(out), load(changetype(this) + (pos << 1)));\n return out;\n }\n\n charCodeAt(pos: i32): i32 {\n if (pos >= this.length) return -1; // (NaN)\n return load(changetype(this) + (pos << 1));\n }\n\n codePointAt(pos: i32): i32 {\n var len = this.length;\n if (pos >= len) return -1; // (undefined)\n var first = load(changetype(this) + (pos << 1));\n if ((first & 0xFC00) != 0xD800 || pos + 1 == len) return first;\n var second = load(changetype(this) + (pos << 1), 2);\n if ((second & 0xFC00) != 0xDC00) return first;\n return (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;\n }\n\n @operator(\"+\") private static __concat(left: String, right: String): String {\n return left.concat(right);\n }\n\n concat(other: String): String {\n var thisSize: isize = this.length << 1;\n var otherSize: isize = other.length << 1;\n var outSize: usize = thisSize + otherSize;\n if (outSize == 0) return changetype(\"\");\n var out = changetype(__new(outSize, idof()));\n memory.copy(changetype(out), changetype(this), thisSize);\n memory.copy(changetype(out) + thisSize, changetype(other), otherSize);\n return out;\n }\n\n endsWith(search: String, end: i32 = String.MAX_LENGTH): bool {\n end = min(max(end, 0), this.length);\n var searchLength = search.length;\n var searchStart = end - searchLength;\n if (searchStart < 0) return false;\n // @ts-ignore: string <-> String\n return !compareImpl(this, searchStart, search, 0, searchLength);\n }\n\n @operator(\"==\") private static __eq(left: String | null, right: String | null): bool {\n if (left === right) return true;\n if (left === null || right === null) return false;\n var leftLength = left.length;\n if (leftLength != right.length) return false;\n // @ts-ignore: string <-> String\n return !compareImpl(left, 0, right, 0, leftLength);\n }\n\n @operator.prefix(\"!\")\n private static __not(str: String | null): bool {\n return str === null || !str.length;\n }\n\n @operator(\"!=\")\n private static __ne(left: String | null, right: String | null): bool {\n return !this.__eq(left, right);\n }\n\n @operator(\">\") private static __gt(left: String, right: String): bool {\n if (left === right) return false;\n var leftLength = left.length;\n if (!leftLength) return false;\n var rightLength = right.length;\n if (!rightLength) return true;\n // @ts-ignore: string <-> String\n var res = compareImpl(left, 0, right, 0, min(leftLength, rightLength));\n return res ? res > 0 : leftLength > rightLength;\n }\n\n @operator(\">=\") private static __gte(left: String, right: String): bool {\n return !this.__lt(left, right);\n }\n\n @operator(\"<\") private static __lt(left: String, right: String): bool {\n if (left === right) return false;\n var rightLength = right.length;\n if (!rightLength) return false;\n var leftLength = left.length;\n if (!leftLength) return true;\n // @ts-ignore: string <-> String\n var res = compareImpl(left, 0, right, 0, min(leftLength, rightLength));\n return res ? res < 0 : leftLength < rightLength;\n }\n\n @operator(\"<=\") private static __lte(left: String, right: String): bool {\n return !this.__gt(left, right);\n }\n\n includes(search: String, start: i32 = 0): bool {\n return this.indexOf(search, start) != -1;\n }\n\n indexOf(search: String, start: i32 = 0): i32 {\n var searchLen = search.length;\n if (!searchLen) return 0;\n var len = this.length;\n if (!len) return -1;\n var searchStart = min(max(start, 0), len);\n for (len -= searchLen; searchStart <= len; ++searchStart) {\n // @ts-ignore: string <-> String\n if (!compareImpl(this, searchStart, search, 0, searchLen)) return searchStart;\n }\n return -1;\n }\n\n lastIndexOf(search: String, start: i32 = i32.MAX_VALUE): i32 {\n var searchLen = search.length;\n if (!searchLen) return this.length;\n var len = this.length;\n if (!len) return -1;\n var searchStart = min(max(start, 0), len - searchLen);\n for (; searchStart >= 0; --searchStart) {\n // @ts-ignore: string <-> String\n if (!compareImpl(this, searchStart, search, 0, searchLen)) return searchStart;\n }\n return -1;\n }\n\n // TODO: implement full locale comparison with locales and Collator options\n localeCompare(other: String): i32 {\n if (other === this) return 0; // compare pointers\n var len: isize = this.length;\n var otherLen: isize = other.length;\n if (otherLen != len) return select(1, -1, len > otherLen);\n if (!otherLen) return 0; // \"\" == \"\"\n // @ts-ignore: string <-> String\n return compareImpl(this, 0, other, 0, otherLen);\n }\n\n startsWith(search: String, start: i32 = 0): bool {\n var len = this.length;\n var searchStart = min(max(start, 0), len);\n var searchLength = search.length;\n if (searchLength + searchStart > len) return false;\n // @ts-ignore: string <-> String\n return !compareImpl(this, searchStart, search, 0, searchLength);\n }\n\n substr(start: i32, length: i32 = i32.MAX_VALUE): String { // legacy\n var intStart: isize = start;\n var end: isize = length;\n var len: isize = this.length;\n if (intStart < 0) intStart = max(len + intStart, 0);\n var size = min(max(end, 0), len - intStart) << 1;\n if (size <= 0) return changetype(\"\");\n var out = changetype(__new(size, idof()));\n memory.copy(changetype(out), changetype(this) + (intStart << 1), size);\n return out;\n }\n\n substring(start: i32, end: i32 = i32.MAX_VALUE): String {\n var len: isize = this.length;\n var finalStart = min(max(start, 0), len);\n var finalEnd = min(max(end, 0), len);\n var fromPos = min(finalStart, finalEnd) << 1;\n var toPos = max(finalStart, finalEnd) << 1;\n var size = toPos - fromPos;\n if (!size) return changetype(\"\");\n if (!fromPos && toPos == len << 1) return this;\n var out = changetype(__new(size, idof()));\n memory.copy(changetype(out), changetype(this) + fromPos, size);\n return out;\n }\n\n trim(): String {\n var len = this.length;\n var size: usize = len << 1;\n while (size && isSpace(load(changetype(this) + size - 2))) {\n size -= 2;\n }\n var offset: usize = 0;\n while (offset < size && isSpace(load(changetype(this) + offset))) {\n offset += 2; size -= 2;\n }\n if (!size) return changetype(\"\");\n if (!offset && size == len << 1) return this;\n var out = changetype(__new(size, idof()));\n memory.copy(changetype(out), changetype(this) + offset, size);\n return out;\n }\n\n @inline\n trimLeft(): String {\n return this.trimStart();\n }\n\n @inline\n trimRight(): String {\n return this.trimEnd();\n }\n\n trimStart(): String {\n var size = this.length << 1;\n var offset: usize = 0;\n while (offset < size && isSpace(load(changetype(this) + offset))) {\n offset += 2;\n }\n if (!offset) return this;\n size -= offset;\n if (!size) return changetype(\"\");\n var out = changetype(__new(size, idof()));\n memory.copy(changetype(out), changetype(this) + offset, size);\n return out;\n }\n\n trimEnd(): String {\n var originalSize = this.length << 1;\n var size = originalSize;\n while (size && isSpace(load(changetype(this) + size - 2))) {\n size -= 2;\n }\n if (!size) return changetype(\"\");\n if (size == originalSize) return this;\n var out = changetype(__new(size, idof()));\n memory.copy(changetype(out), changetype(this), size);\n return out;\n }\n\n padStart(length: i32, pad: string = \" \"): String {\n var thisSize = this.length << 1;\n var targetSize = length << 1;\n var padSize = pad.length << 1;\n if (targetSize < thisSize || !padSize) return this;\n var prependSize = targetSize - thisSize;\n var out = changetype(__new(targetSize, idof()));\n if (prependSize > padSize) {\n let repeatCount = (prependSize - 2) / padSize;\n let restBase = repeatCount * padSize;\n let restSize = prependSize - restBase;\n memory.repeat(changetype(out), changetype(pad), padSize, repeatCount);\n memory.copy(changetype(out) + restBase, changetype(pad), restSize);\n } else {\n memory.copy(changetype(out), changetype(pad), prependSize);\n }\n memory.copy(changetype(out) + prependSize, changetype(this), thisSize);\n return out;\n }\n\n padEnd(length: i32, pad: string = \" \"): String {\n var thisSize = this.length << 1;\n var targetSize = length << 1;\n var padSize = pad.length << 1;\n if (targetSize < thisSize || !padSize) return this;\n var appendSize = targetSize - thisSize;\n var out = changetype(__new(targetSize, idof()));\n memory.copy(changetype(out), changetype(this), thisSize);\n if (appendSize > padSize) {\n let repeatCount = (appendSize - 2) / padSize;\n let restBase = repeatCount * padSize;\n let restSize = appendSize - restBase;\n memory.repeat(changetype(out) + thisSize, changetype(pad), padSize, repeatCount);\n memory.copy(changetype(out) + thisSize + restBase, changetype(pad), restSize);\n } else {\n memory.copy(changetype(out) + thisSize, changetype(pad), appendSize);\n }\n return out;\n }\n\n repeat(count: i32 = 0): String {\n var length = this.length;\n\n // Most browsers can't handle strings 1 << 28 chars or longer\n if (count < 0 || length * count > (1 << 28)) {\n throw new RangeError(E_INVALIDLENGTH);\n }\n\n if (count == 0 || !length) return changetype(\"\");\n if (count == 1) return this;\n var out = changetype(__new((length * count) << 1, idof()));\n memory.repeat(changetype(out), changetype(this), length << 1, count);\n return out;\n }\n\n replace(search: String, replacement: String): String {\n var len: usize = this.length;\n var slen: usize = search.length;\n if (len <= slen) {\n return len < slen ? this : select(replacement, this, search == this);\n }\n var index: isize = this.indexOf(search);\n if (~index) {\n let rlen: usize = replacement.length;\n len -= slen;\n let olen = len + rlen;\n if (olen) {\n let out = changetype(__new(olen << 1, idof()));\n memory.copy(changetype(out), changetype(this), index << 1);\n memory.copy(\n changetype(out) + (index << 1),\n changetype(replacement),\n rlen << 1\n );\n memory.copy(\n changetype(out) + ((index + rlen) << 1),\n changetype(this) + ((index + slen) << 1),\n (len - index) << 1\n );\n return out;\n }\n }\n return this;\n }\n\n replaceAll(search: String, replacement: String): String {\n var thisLen: usize = this.length;\n var searchLen: usize = search.length;\n if (thisLen <= searchLen) {\n return thisLen < searchLen\n ? this\n : select(replacement, this, search == this);\n }\n var replaceLen: usize = replacement.length;\n if (!searchLen) {\n if (!replaceLen) return this;\n // Special case: 'abc'.replaceAll('', '-') -> '-a-b-c-'\n let out = changetype(__new((thisLen + (thisLen + 1) * replaceLen) << 1, idof()));\n memory.copy(changetype(out), changetype(replacement), replaceLen << 1);\n let offset = replaceLen;\n for (let i: usize = 0; i < thisLen; ++i) {\n store(\n changetype(out) + (offset++ << 1),\n load(changetype(this) + (i << 1))\n );\n memory.copy(\n changetype(out) + (offset << 1),\n changetype(replacement),\n replaceLen << 1\n );\n offset += replaceLen;\n }\n return out;\n }\n var prev: isize = 0, next: isize = 0;\n if (searchLen == replaceLen) {\n // Fast path when search and replacement have same length\n let outSize = thisLen << 1;\n let out = changetype(__new(outSize, idof()));\n memory.copy(changetype(out), changetype(this), outSize);\n while (~(next = this.indexOf(search, prev))) {\n memory.copy(changetype(out) + (next << 1), changetype(replacement), replaceLen << 1);\n prev = next + searchLen;\n }\n return out;\n }\n var out: String | null = null, offset: usize = 0, outSize = thisLen;\n while (~(next = this.indexOf(search, prev))) {\n if (!out) out = changetype(__new(thisLen << 1, idof()));\n let chunk = next - prev;\n if (offset + chunk + replaceLen > outSize) {\n outSize <<= 1;\n out = changetype(__renew(changetype(out), outSize << 1));\n }\n memory.copy(\n changetype(out) + (offset << 1),\n changetype(this) + (prev << 1),\n chunk << 1\n );\n offset += chunk;\n memory.copy(\n changetype(out) + (offset << 1),\n changetype(replacement),\n replaceLen << 1\n );\n offset += replaceLen;\n prev = next + searchLen;\n }\n if (out) {\n let rest = thisLen - prev;\n if (offset + rest > outSize) {\n outSize <<= 1;\n out = changetype(__renew(changetype(out), outSize << 1));\n }\n if (rest) {\n memory.copy(\n changetype(out) + (offset << 1),\n changetype(this) + (prev << 1),\n rest << 1\n );\n }\n rest += offset;\n if (outSize > rest) {\n out = changetype(__renew(changetype(out), rest << 1));\n }\n return out;\n }\n return this;\n }\n\n slice(start: i32, end: i32 = i32.MAX_VALUE): String {\n var len = this.length;\n start = start < 0 ? max(start + len, 0) : min(start, len);\n end = end < 0 ? max(end + len, 0) : min(end, len);\n len = end - start;\n if (len <= 0) return changetype(\"\");\n var out = changetype(__new(len << 1, idof()));\n memory.copy(changetype(out), changetype(this) + (start << 1), len << 1);\n return out;\n }\n\n split(separator: String | null = null, limit: i32 = i32.MAX_VALUE): String[] {\n if (!limit) return changetype(__newArray(0, alignof(), idof>()));\n if (separator === null) return [this];\n var length: isize = this.length;\n var sepLen = separator.length;\n if (limit < 0) limit = i32.MAX_VALUE;\n if (!sepLen) {\n if (!length) return changetype(__newArray(0, alignof(), idof>()));\n // split by chars\n length = min(length, limit);\n let result = changetype(__newArray(length, alignof(), idof>()));\n // @ts-ignore: cast\n let resultStart = result.dataStart as usize;\n for (let i: isize = 0; i < length; ++i) {\n let charStr = changetype(__new(2, idof()));\n store(changetype(charStr), load(changetype(this) + (i << 1)));\n store(resultStart + (i << alignof()), changetype(charStr)); // result[i] = charStr\n __link(changetype(result), changetype(charStr), true);\n }\n return result;\n } else if (!length) {\n let result = changetype(__newArray(1, alignof(), idof>()));\n // @ts-ignore: cast\n store(result.dataStart as usize, changetype(\"\")); // static \"\"\n return result;\n }\n var result = changetype(__newArray(0, alignof(), idof>()));\n var end = 0, start = 0, i = 0;\n while (~(end = this.indexOf(separator, start))) {\n let len = end - start;\n if (len > 0) {\n let out = changetype(__new(len << 1, idof()));\n memory.copy(changetype(out), changetype(this) + (start << 1), len << 1);\n result.push(out);\n } else {\n result.push(changetype(\"\"));\n }\n if (++i == limit) return result;\n start = end + sepLen;\n }\n if (!start) { // also means: loop above didn't do anything\n result.push(this);\n return result;\n }\n var len = length - start;\n if (len > 0) {\n let out = changetype(__new(len << 1, idof()));\n memory.copy(changetype(out), changetype(this) + (start << 1), len << 1);\n result.push(out);\n } else {\n result.push(changetype(\"\")); // static \"\"\n }\n return result;\n }\n\n toLowerCase(): String {\n var len = this.length;\n if (!len) return this;\n var codes = changetype(__new(len * 2 * 2, idof()));\n var j: usize = 0;\n for (let i: usize = 0; i < len; ++i, ++j) {\n let c = load(changetype(this) + (i << 1));\n if (isAscii(c)) {\n store(changetype(codes) + (j << 1), toLower8(c));\n } else {\n // check and read surrogate pair\n if ((c - 0xD7FF < 0xDC00 - 0xD7FF) && i < len - 1) {\n let c1 = load(changetype(this) + (i << 1), 2);\n if (c1 - 0xDBFF < 0xE000 - 0xDBFF) {\n let c0 = c;\n c = (((c & 0x03FF) << 10) | (c1 & 0x03FF)) + 0x10000;\n ++i;\n if (c >= 0x20000) {\n store(changetype(codes) + (j << 1), c0 | (c1 << 16));\n ++j;\n continue;\n }\n }\n }\n // check special casing for lower table. It has one ently so instead lookup we just inline this.\n if (c == 0x0130) {\n // 0x0130 -> [0x0069, 0x0307]\n store(changetype(codes) + (j << 1), (0x0307 << 16) | 0x0069);\n ++j;\n } else if (c == 0x03A3) { // 'Σ'\n // Σ maps to σ but except at the end of a word where it maps to ς\n let sigma = 0x03C3; // σ\n if (len > 1 && isFinalSigma(changetype(this), i, len)) {\n sigma = 0x03C2; // ς\n }\n store(changetype(codes) + (j << 1), sigma);\n } else if (c - 0x24B6 <= 0x24CF - 0x24B6) {\n // Range 0x24B6 <= c <= 0x24CF not covered by casemap and require special early handling\n store(changetype(codes) + (j << 1), c + 26);\n } else {\n let code = casemap(c, 0) & 0x1FFFFF;\n if (code < 0x10000) {\n store(changetype(codes) + (j << 1), code);\n } else {\n // store as surrogare pair\n code -= 0x10000;\n let lo = (code >>> 10) | 0xD800;\n let hi = (code & 0x03FF) | 0xDC00;\n store(changetype(codes) + (j << 1), lo | (hi << 16));\n ++j;\n }\n }\n }\n }\n return changetype(__renew(changetype(codes), j << 1));\n }\n\n toUpperCase(): String {\n var len = this.length;\n if (!len) return this;\n var codes = changetype(__new(len * 3 * 2, idof()));\n var specialsPtr = changetype(SPECIALS_UPPER);\n var specialsLen = SPECIALS_UPPER.length;\n var j: usize = 0;\n for (let i: usize = 0; i < len; ++i, ++j) {\n let c = load(changetype(this) + (i << 1));\n if (isAscii(c)) {\n store(changetype(codes) + (j << 1), toUpper8(c));\n } else {\n // check and read surrogate pair\n if ((c - 0xD7FF < 0xDC00 - 0xD7FF) && i < len - 1) {\n let c1 = load(changetype(this) + (i << 1), 2);\n if (c1 - 0xDBFF < 0xE000 - 0xDBFF) {\n let c0 = c;\n c = (((c & 0x03FF) << 10) | (c1 & 0x03FF)) + 0x10000;\n ++i;\n if (c >= 0x20000) {\n store(changetype(codes) + (j << 1), c0 | (c1 << 16));\n ++j;\n continue;\n }\n }\n }\n // Range 0x24D0 <= c <= 0x24E9 not covered by casemap and require special early handling\n if (c - 0x24D0 <= 0x24E9 - 0x24D0) {\n // monkey patch\n store(changetype(codes) + (j << 1), c - 26);\n } else {\n let index: usize = -1;\n // Fast range check. See first and last rows in specialsUpper table\n if (c - 0x00DF <= 0xFB17 - 0x00DF) {\n index = bsearch(c, specialsPtr, specialsLen);\n }\n if (~index) {\n // load next 3 code points from row with `index` offset for specialsUpper table\n let ab = load(specialsPtr + (index << 1), 2);\n let cc = load(specialsPtr + (index << 1), 6);\n store(changetype(codes) + (j << 1), ab, 0);\n store(changetype(codes) + (j << 1), cc, 4);\n j += 1 + usize(cc != 0);\n } else {\n let code = casemap(c, 1) & 0x1FFFFF;\n if (code < 0x10000) {\n store(changetype(codes) + (j << 1), code);\n } else {\n // store as surrogare pair\n code -= 0x10000;\n let lo = (code >>> 10) | 0xD800;\n let hi = (code & 0x03FF) | 0xDC00;\n store(changetype(codes) + (j << 1), lo | (hi << 16));\n ++j;\n }\n }\n }\n }\n }\n return changetype(__renew(changetype(codes), j << 1));\n }\n\n toString(): String {\n return this;\n }\n}\n\n// @ts-ignore: nolib\nexport type string = String;\n\nexport function parseInt(str: string, radix: i32 = 0): f64 {\n return strtol(str, radix);\n}\n\nexport function parseFloat(str: string): f64 {\n return strtod(str);\n}\n\n// Encoding helpers\nexport namespace String {\n\n export namespace UTF8 {\n\n export function byteLength(str: string, nullTerminated: bool = false): i32 {\n var strOff = changetype(str);\n var strEnd = strOff + changetype(changetype(str) - TOTAL_OVERHEAD).rtSize;\n var bufLen = i32(nullTerminated);\n while (strOff < strEnd) {\n let c1 = load(strOff);\n if (c1 < 128) {\n // @ts-ignore: cast\n if (nullTerminated & !c1) break;\n bufLen += 1;\n } else if (c1 < 2048) {\n bufLen += 2;\n } else {\n if ((c1 & 0xFC00) == 0xD800 && strOff + 2 < strEnd) {\n if ((load(strOff, 2) & 0xFC00) == 0xDC00) {\n bufLen += 4; strOff += 4;\n continue;\n }\n }\n bufLen += 3;\n }\n strOff += 2;\n }\n return bufLen;\n }\n\n export function encode(str: string, nullTerminated: bool = false): ArrayBuffer {\n var buf = changetype(__new(byteLength(str, nullTerminated), idof()));\n encodeUnsafe(changetype(str), str.length, changetype(buf), nullTerminated);\n return buf;\n }\n\n // @ts-ignore: decorator\n @unsafe\n export function encodeUnsafe(str: usize, len: i32, buf: usize, nullTerminated: bool = false): usize {\n var strEnd = str + (len << 1);\n var bufOff = buf;\n while (str < strEnd) {\n let c1 = load(str);\n if (c1 < 128) {\n store(bufOff, c1);\n bufOff++;\n } else if (c1 < 2048) {\n let b0 = c1 >> 6 | 192;\n let b1 = c1 & 63 | 128;\n store(bufOff, b1 << 8 | b0);\n bufOff += 2;\n } else {\n if ((c1 & 0xFC00) == 0xD800 && str + 2 < strEnd) {\n let c2 = load(str, 2);\n if ((c2 & 0xFC00) == 0xDC00) {\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) | (c2 & 0x03FF);\n let b0 = c1 >> 18 | 240;\n let b1 = c1 >> 12 & 63 | 128;\n let b2 = c1 >> 6 & 63 | 128;\n let b3 = c1 & 63 | 128;\n store(bufOff, b3 << 24 | b2 << 16 | b1 << 8 | b0);\n bufOff += 4; str += 4;\n continue;\n }\n }\n let b0 = c1 >> 12 | 224;\n let b1 = c1 >> 6 & 63 | 128;\n let b2 = c1 & 63 | 128;\n store(bufOff, b1 << 8 | b0);\n store(bufOff, b2, 2);\n bufOff += 3;\n }\n str += 2;\n }\n if (nullTerminated) {\n store(bufOff++, 0);\n }\n return bufOff - buf;\n }\n\n export function decode(buf: ArrayBuffer, nullTerminated: bool = false): String {\n return decodeUnsafe(changetype(buf), buf.byteLength, nullTerminated);\n }\n\n // @ts-ignore: decorator\n @unsafe\n export function decodeUnsafe(buf: usize, len: usize, nullTerminated: bool = false): String {\n var bufOff = buf;\n var bufEnd = buf + len;\n assert(bufEnd >= bufOff); // guard wraparound\n var str = changetype(__new(len << 1, idof())); // max is one u16 char per u8 byte\n var strOff = changetype(str);\n while (bufOff < bufEnd) {\n let u0 = load(bufOff); ++bufOff;\n if (!(u0 & 128)) {\n // @ts-ignore: cast\n if (nullTerminated & !u0) break;\n store(strOff, u0);\n } else {\n if (bufEnd == bufOff) break;\n let u1 = load(bufOff) & 63; ++bufOff;\n if ((u0 & 224) == 192) {\n store(strOff, (u0 & 31) << 6 | u1);\n } else {\n if (bufEnd == bufOff) break;\n let u2 = load(bufOff) & 63; ++bufOff;\n if ((u0 & 240) == 224) {\n u0 = (u0 & 15) << 12 | u1 << 6 | u2;\n } else {\n if (bufEnd == bufOff) break;\n u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | load(bufOff) & 63;\n ++bufOff;\n }\n if (u0 < 0x10000) {\n store(strOff, u0);\n } else {\n u0 -= 0x10000;\n let lo = u0 >> 10 | 0xD800;\n let hi = (u0 & 0x03FF) | 0xDC00;\n store(strOff, lo | (hi << 16));\n strOff += 2;\n }\n }\n }\n strOff += 2;\n }\n return changetype(__renew(changetype(str), strOff - changetype(str)));\n }\n }\n\n export namespace UTF16 {\n\n export function byteLength(str: string): i32 {\n return changetype(changetype(str) - TOTAL_OVERHEAD).rtSize;\n }\n\n export function encode(str: string): ArrayBuffer {\n var buf = changetype(__new(byteLength(str), idof()));\n encodeUnsafe(changetype(str), str.length, changetype(buf));\n return buf;\n }\n\n // @ts-ignore: decorator\n @unsafe\n export function encodeUnsafe(str: usize, len: i32, buf: usize): usize {\n var size = len << 1;\n memory.copy(buf, changetype(str), size);\n return size;\n }\n\n export function decode(buf: ArrayBuffer): String {\n return decodeUnsafe(changetype(buf), buf.byteLength);\n }\n\n // @ts-ignore: decorator\n @unsafe\n export function decodeUnsafe(buf: usize, len: usize): String {\n var str = changetype(__new(len &= ~1, idof()));\n memory.copy(changetype(str), buf, len);\n return str;\n }\n }\n}\n\nexport class TemplateStringsArray extends Array {\n readonly raw: string[];\n}\n","import { i128 } from './i128';\nimport { i256 } from './i256';\nimport { u256 } from './u256';\n\n// TODO import this on top level 'index.ts'\nimport {\n __clz128,\n __ctz128,\n __floatuntidf,\n\n __multi3,\n __res128_hi,\n\n __udivmod128,\n __udivmod128_10,\n\n __divmod_quot_hi,\n __divmod_rem_lo,\n __divmod_rem_hi,\n} from '../globals';\n\nimport { atou128, u128toa10 } from '../utils';\n\n@lazy const HEX_CHARS = '0123456789abcdef';\n\nexport class u128 {\n\n @inline static get Zero(): u128 { return new u128(); }\n @inline static get One(): u128 { return new u128(1); }\n @inline static get Min(): u128 { return new u128(); }\n @inline static get Max(): u128 { return new u128(-1, -1); }\n\n @inline\n static fromString(value: string, radix: i32 = 10): u128 {\n return atou128(value, radix);\n }\n\n @inline\n static fromI256(value: i256): u128 {\n return new u128(value.lo1, value.lo2);\n }\n\n @inline\n static fromU256(value: u256): u128 {\n return new u128(value.lo1, value.lo2);\n }\n\n @inline\n static fromI128(value: i128): u128 {\n return new u128(value.lo, value.hi);\n }\n\n @inline\n static fromU128(value: u128): u128 {\n return new u128(value.lo, value.hi);\n }\n\n @inline\n static fromI64(value: i64): u128 {\n return new u128(value, value >> 63);\n }\n\n @inline\n static fromU64(value: u64): u128 {\n return new u128(value);\n }\n\n // TODO need improvement\n // max safe uint for f64 actually 53-bits\n @inline\n static fromF64(value: f64): u128 {\n return new u128(value, reinterpret(value) >> 63);\n }\n\n // TODO need improvement\n // max safe int for f32 actually 23-bits\n @inline\n static fromF32(value: f32): u128 {\n return new u128(value, (reinterpret(value) >> 31));\n }\n\n @inline\n static fromI32(value: i32): u128 {\n return new u128(value, value >> 31);\n }\n\n @inline\n static fromU32(value: u32): u128 {\n return new u128(value);\n }\n\n @inline\n static fromBool(value: bool): u128 {\n return new u128(value);\n }\n\n @inline\n static fromBits(lo1: u32, lo2: u32, hi1: u32, hi2: u32): u128 {\n return new u128(\n lo1 | ((lo2) << 32),\n hi1 | ((hi2) << 32),\n );\n }\n\n @inline\n static fromBytes(array: T, bigEndian: bool = false): u128 {\n if (array instanceof u8[]) {\n return bigEndian\n ? u128.fromBytesBE(array)\n : u128.fromBytesLE(array);\n } else if (array instanceof Uint8Array) {\n return bigEndian\n ? u128.fromUint8ArrayBE(array)\n : u128.fromUint8ArrayLE(array);\n } else {\n throw new TypeError(\"Unsupported generic type\");\n }\n }\n\n @inline\n static fromBytesLE(array: u8[]): u128 {\n return u128.fromUint8ArrayLE(changetype(array));\n }\n\n @inline\n static fromBytesBE(array: u8[]): u128 {\n return u128.fromUint8ArrayBE(changetype(array));\n }\n\n @inline\n static fromUint8ArrayLE(array: Uint8Array): u128 {\n assert(array.length && (array.length & 15) == 0);\n // @ts-ignore\n var buffer = array.dataStart;\n return new u128(\n load(buffer, 0 * sizeof()),\n load(buffer, 1 * sizeof())\n );\n }\n\n @inline\n static fromUint8ArrayBE(array: Uint8Array): u128 {\n assert(array.length && (array.length & 15) == 0);\n // @ts-ignore\n var buffer = array.dataStart;\n return new u128(\n bswap(load(buffer, 1 * sizeof())),\n bswap(load(buffer, 0 * sizeof()))\n );\n }\n\n /**\n * Create 128-bit unsigned integer from generic type T\n * @param value\n * @returns 128-bit unsigned integer\n */\n @inline\n static from(value: T): u128 {\n if (value instanceof bool) return u128.fromU64(value);\n else if (value instanceof i8) return u128.fromI64(value);\n else if (value instanceof u8) return u128.fromU64(value);\n else if (value instanceof i16) return u128.fromI64(value);\n else if (value instanceof u16) return u128.fromU64(value);\n else if (value instanceof i32) return u128.fromI64(value);\n else if (value instanceof u32) return u128.fromU64(value);\n else if (value instanceof i64) return u128.fromI64(value);\n else if (value instanceof u64) return u128.fromU64(value);\n else if (value instanceof f32) return u128.fromF64(value);\n else if (value instanceof f64) return u128.fromF64(value);\n else if (value instanceof i128) return u128.fromI128(value);\n else if (value instanceof u128) return u128.fromU128(value);\n else if (value instanceof i256) return u128.fromI256(value);\n else if (value instanceof u256) return u128.fromU256(value);\n else if (value instanceof u8[]) return u128.fromBytes(value);\n else if (value instanceof Uint8Array) return u128.fromBytes(value);\n else if (value instanceof String) return u128.fromString(value);\n else throw new TypeError(\"Unsupported generic type\");\n }\n\n /**\n * Create 128-bit unsigned integer from 64-bit parts\n * @param lo low 64-bit part of 128-bit unsigned integer\n * @param hi high 64-bit part of 128-bit unsigned integer\n */\n constructor(\n public lo: u64 = 0,\n public hi: u64 = 0,\n ) {}\n\n @inline\n set(value: u128): this {\n this.lo = value.lo;\n this.hi = value.hi;\n return this;\n }\n\n @inline\n setI64(value: i64): this {\n this.lo = value;\n this.hi = value >> 63;\n return this;\n }\n\n @inline\n setU64(value: u64): this {\n this.lo = value;\n this.hi = 0;\n return this;\n }\n\n @inline\n setI32(value: i32): this {\n this.lo = value;\n this.hi = value >> 63;\n return this;\n }\n\n @inline\n setU32(value: u32): this {\n this.lo = value;\n this.hi = 0;\n return this;\n }\n\n @inline\n isZero(): bool {\n return !(this.lo | this.hi);\n }\n\n @inline @operator.prefix('~')\n not(): u128 {\n return new u128(~this.lo, ~this.hi);\n }\n\n @inline @operator.prefix('+')\n pos(): u128 {\n return this;\n }\n\n @inline @operator.prefix('-')\n neg(): u128 {\n var lo = ~this.lo;\n var hi = ~this.hi;\n var lo1 = lo + 1;\n return new u128(lo1, hi + u64(lo1 < lo));\n }\n\n @operator.prefix('++')\n preInc(): this {\n var lo = this.lo;\n var lo1 = lo + 1;\n this.hi += u64(lo1 < lo);\n this.lo = lo1;\n return this;\n }\n\n @operator.prefix('--')\n preDec(): this {\n var lo = this.lo;\n var lo1 = lo - 1;\n this.hi -= u64(lo1 > lo);\n this.lo = lo1;\n return this;\n }\n\n @operator.postfix('++')\n postInc(): u128 {\n return this.clone().preInc();\n }\n\n @operator.postfix('--')\n postDec(): u128 {\n return this.clone().preDec();\n }\n\n @inline @operator.prefix('!')\n static isEmpty(value: u128): bool {\n return value === null || !(value.lo | value.hi);\n }\n\n @inline @operator('|')\n static or(a: u128, b: u128): u128 {\n return new u128(a.lo | b.lo, a.hi | b.hi);\n }\n\n @inline @operator('^')\n static xor(a: u128, b: u128): u128 {\n return new u128(a.lo ^ b.lo, a.hi ^ b.hi);\n }\n\n @inline @operator('&')\n static and(a: u128, b: u128): u128 {\n return new u128(a.lo & b.lo, a.hi & b.hi);\n }\n\n @inline @operator('<<')\n static shl(value: u128, shift: i32): u128 {\n shift &= 127;\n\n // need for preventing redundant i32 -> u64 extends\n var shift64 = shift as u64;\n\n var mod1 = ((((shift64 + 127) | shift64) & 64) >> 6) - 1;\n var mod2 = (shift64 >> 6) - 1;\n\n shift64 &= 63;\n\n var vl = value.lo;\n var lo = vl << shift64;\n var hi = lo & ~mod2;\n\n hi |= ((value.hi << shift64) | ((vl >> (64 - shift64)) & mod1)) & mod2;\n\n return new u128(lo & mod2, hi);\n }\n\n @inline @operator('>>')\n static shr(value: u128, shift: i32): u128 {\n shift &= 127;\n\n // need for preventing redundant i32 -> u64 extends\n var shift64 = shift as u64;\n\n var mod1 = ((((shift64 + 127) | shift64) & 64) >> 6) - 1;\n var mod2 = (shift64 >> 6) - 1;\n\n shift64 &= 63;\n\n var vh = value.hi;\n var hi = vh >> shift64;\n var lo = hi & ~mod2;\n\n lo |= ((value.lo >> shift64) | ((vh << (64 - shift64)) & mod1)) & mod2;\n\n return new u128(lo, hi & mod2);\n }\n\n @inline @operator('>>>')\n static shr_u(value: u128, shift: i32): u128 {\n return u128.shr(value, shift);\n }\n\n @inline\n static rotl(value: u128, shift: i32): u128 {\n let n = shift & 127;\n if (n == 0) return value.clone();\n\n let lo = value.lo;\n let hi = value.hi;\n if (n == 64) {\n return new u128(hi, lo);\n }\n if (n & 64) {\n let t = lo; lo = hi; hi = t;\n }\n let slo = lo << n;\n let shi = hi << n;\n let rlo = lo >> (64 - n);\n let rhi = hi >> (64 - n);\n return new u128(slo | rhi, shi | rlo);\n }\n\n @inline\n static rotr(value: u128, shift: i32): u128 {\n let n = shift & 127;\n if (n == 0) return value.clone();\n\n let lo = value.lo;\n let hi = value.hi;\n if (n == 64) {\n return new u128(hi, lo);\n }\n if (n & 64) {\n let t = lo; lo = hi; hi = t;\n }\n let slo = lo >> n;\n let shi = hi >> n;\n let rlo = lo << (64 - n);\n let rhi = hi << (64 - n);\n return new u128(slo | rhi, shi | rlo);\n }\n\n @inline @operator('+')\n static add(a: u128, b: u128): u128 {\n var alo = a.lo;\n var lo = alo + b.lo;\n var hi = a.hi + b.hi + u64(lo < alo);\n return new u128(lo, hi);\n }\n\n @inline @operator('-')\n static sub(a: u128, b: u128): u128 {\n var alo = a.lo;\n var lo = alo - b.lo;\n var hi = a.hi - b.hi - u64(lo > alo);\n return new u128(lo, hi);\n }\n\n // mul: u128 x u128 = u128\n @inline @operator('*')\n static mul(a: u128, b: u128): u128 {\n return new u128(\n __multi3(a.lo, a.hi, b.lo, b.hi),\n __res128_hi\n );\n }\n\n @inline @operator('/')\n static div(a: u128, b: u128): u128 {\n return new u128(\n __udivmod128(a.lo, a.hi, b.lo, b.hi),\n __divmod_quot_hi\n );\n }\n\n @inline @operator('%')\n static rem(a: u128, b: u128): u128 {\n __udivmod128(a.lo, a.hi, b.lo, b.hi);\n return new u128(__divmod_rem_lo, __divmod_rem_hi);\n }\n\n @inline\n static div10(value: u128): u128 {\n return new u128(\n __udivmod128_10(value.lo, value.hi),\n __divmod_quot_hi\n );\n }\n\n @inline\n static rem10(value: u128): u128 {\n __udivmod128_10(value.lo, value.hi);\n return new u128(__divmod_rem_lo, __divmod_rem_hi);\n }\n\n /**\n * Calculate power of base with exponent\n * @param base 128-bit unsigned integer\n * @param exponent 32-bit signed integer\n * @returns 128-bit unsigned integer\n */\n @operator('**')\n static pow(base: u128, exponent: i32): u128 {\n // any negative exponent produce zero\n\n var result = u128.One;\n\n if (base == result) return result;\n var tmp = base.clone();\n if (exponent <= 1) {\n if (exponent < 0) return u128.Zero;\n return exponent == 0 ? result : tmp;\n }\n\n if (ASC_SHRINK_LEVEL < 1) {\n var lo = base.lo;\n var hi = base.hi;\n // if base > u64::max and exp > 1 always return \"0\"\n if (!lo) return u128.Zero;\n if (!hi) {\n let lo1 = lo - 1;\n // \"1 ^ exponent\" always return \"1\"\n if (!lo1) return result;\n\n // if base is power of two do \"1 << log2(base) * exp\"\n if (!(lo & lo1)) {\n let shift = (64 - clz(lo1)) * exponent;\n // @ts-ignore\n return shift < 128 ? result << shift : u128.Zero;\n }\n }\n\n if (exponent <= 4) {\n let baseSq = tmp.sqr();\n switch (exponent) {\n case 2: return baseSq; // base ^ 2\n // @ts-ignore\n case 3: return baseSq * base; // base ^ 2 * base\n case 4: return baseSq.sqr(); // base ^ 2 * base ^ 2\n default: break;\n }\n }\n\n let log = 32 - clz(exponent);\n if (log <= 7) {\n // 128 = 2 ^ 7, so need usually only seven cases\n switch (log) {\n case 7:\n // @ts-ignore\n if (exponent & 1) result *= tmp;\n exponent >>= 1;\n tmp.sqr();\n case 6:\n // @ts-ignore\n if (exponent & 1) result *= tmp;\n exponent >>= 1;\n tmp.sqr();\n case 5:\n // @ts-ignore\n if (exponent & 1) result *= tmp;\n exponent >>= 1;\n tmp.sqr();\n case 4:\n // @ts-ignore\n if (exponent & 1) result *= tmp;\n exponent >>= 1;\n tmp.sqr();\n case 3:\n // @ts-ignore\n if (exponent & 1) result *= tmp;\n exponent >>= 1;\n tmp.sqr();\n case 2:\n // @ts-ignore\n if (exponent & 1) result *= tmp;\n exponent >>= 1;\n tmp.sqr();\n case 1:\n // @ts-ignore\n if (exponent & 1) result *= tmp;\n }\n return result;\n }\n }\n\n while (exponent > 0) {\n // @ts-ignore\n if (exponent & 1) result *= tmp;\n exponent >>= 1;\n tmp.sqr();\n }\n return result;\n }\n\n // compute floor(sqrt(x))\n static sqrt(value: u128): u128 {\n var rem = value.clone();\n if (value < new u128(2)) {\n return rem;\n }\n var res = u128.Zero;\n // @ts-ignore\n var pos = u128.One << (127 - (u128.clz(value) | 1));\n // @ts-ignore\n while (!pos.isZero()) {\n // @ts-ignore\n value = res + pos;\n if (rem >= value) {\n // @ts-ignore\n rem = rem - value;\n // @ts-ignore\n res = pos + value;\n }\n // @ts-ignore\n res >>= 1;\n pos >>= 2;\n }\n return res;\n }\n\n @inline @operator('==')\n static eq(a: u128, b: u128): bool {\n return a.hi == b.hi && a.lo == b.lo;\n }\n\n @inline @operator('!=')\n static ne(a: u128, b: u128): bool {\n return !u128.eq(a, b);\n }\n\n @inline @operator('<')\n static lt(a: u128, b: u128): bool {\n var ah = a.hi, bh = b.hi;\n return ah == bh ? a.lo < b.lo : ah < bh;\n }\n\n @inline @operator('>')\n static gt(a: u128, b: u128): bool {\n var ah = a.hi, bh = b.hi;\n return ah == bh ? a.lo > b.lo : ah > bh;\n }\n\n @inline @operator('<=')\n static le(a: u128, b: u128): bool {\n return !u128.gt(a, b);\n }\n\n @inline @operator('>=')\n static ge(a: u128, b: u128): bool {\n return !u128.lt(a, b);\n }\n\n /**\n * Get ordering\n * if a > b then result is 1\n * if a < b then result is -1\n * if a = b then result is 0\n * @param a 128-bit unsigned integer\n * @param b 128-bit unsigned integer\n * @returns 32-bit signed integer\n */\n @inline\n static ord(a: u128, b: u128): i32 {\n var dlo = a.lo - b.lo;\n var dhi = a.hi - b.hi;\n var cmp = select(dhi, dlo, dhi != 0);\n // normalize to [-1, 0, 1]\n return i32(cmp > 0) - i32(cmp < 0);\n }\n\n /**\n * Compute count of set (populated) bits\n * @param value 128-bit unsigned integer\n * @returns 32-bit signed integer\n */\n @inline\n static popcnt(value: u128): i32 {\n return (popcnt(value.lo) + popcnt(value.hi));\n }\n\n /**\n * Compute bit count of leading zeros\n * @param value 128-bit unsigned integer\n * @returns 32-bit signed integer\n */\n @inline\n static clz(value: u128): i32 {\n return __clz128(value.lo, value.hi);\n }\n\n /**\n * Compute bit count of trailing zeros\n * @param value 128-bit unsigned integer\n * @returns 32-bit signed integer\n */\n @inline\n static ctz(value: u128): i32 {\n return __ctz128(value.lo, value.hi);\n }\n\n /**\n * Calculate squared value (value ** 2)\n * @param value 128-bit unsigned integer\n * @returns 128-bit unsigned integer\n */\n @inline\n static sqr(value: u128): u128 {\n return value.clone().sqr();\n }\n\n /**\n * Calculate inplace squared 128-bit unsigned integer (this ** 2)\n * @returns 128-bit unsigned integer\n */\n sqr(): this {\n var u = this.lo,\n v = this.hi;\n\n var u1 = u & 0xFFFFFFFF;\n var t = u1 * u1;\n var w = t & 0xFFFFFFFF;\n var k = t >> 32;\n\n u >>= 32;\n var m = u * u1;\n t = m + k;\n var w1 = t >> 32;\n\n t = m + (t & 0xFFFFFFFF);\n\n var lo = (t << 32) + w;\n var hi = u * u;\n hi += w1 + (t >> 32);\n hi += u * v << 1;\n\n this.lo = lo;\n this.hi = hi;\n\n return this;\n }\n\n /**\n * Calculate multiply and division as `number * numerator / denominator`\n * without overflow in multiplication part.\n *\n * @returns 128-bit unsigned integer\n */\n static muldiv(number: u128, numerator: u128, denominator: u128): u128 {\n let a = number;\n let b = numerator;\n let c = denominator;\n\n let ql = __udivmod128(b.lo, b.hi, c.lo, c.hi);\n\n let qn = new u128(ql, __divmod_quot_hi); // b / c\n let rn = new u128(__divmod_rem_lo, __divmod_rem_hi); // b % c\n\n let q = u128.Zero;\n let r = u128.Zero;\n let n = a.clone();\n\n while (!n.isZero()) {\n if (n.lo & 1) {\n // @ts-ignore\n q += qn;\n // @ts-ignore\n r += rn;\n if (r >= c) {\n // @ts-ignore\n ++q;\n // @ts-ignore\n r -= c;\n }\n }\n // @ts-ignore\n n >>= 1;\n // @ts-ignore\n qn <<= 1;\n // @ts-ignore\n rn <<= 1;\n\n if (rn >= c) {\n // @ts-ignore\n ++qn;\n // @ts-ignore\n rn -= c;\n }\n }\n return q;\n }\n\n /**\n * Convert to 256-bit signed integer\n * @returns 256-bit signed integer\n */\n @inline\n toI256(): i256 {\n return new i256(this.lo, this.hi);\n }\n\n /**\n * Convert to 256-bit unsigned integer\n * @returns 256-bit unsigned integer\n */\n @inline\n toU256(): u256 {\n return new u256(this.lo, this.hi);\n }\n\n /**\n * Convert to 128-bit signed integer\n * @returns 128-bit signed integer\n */\n @inline\n toI128(): i128 {\n return new i128(this.lo, this.hi);\n }\n\n /**\n * Convert to 128-bit unsigned integer\n * @returns 128-bit unsigned integer\n */\n @inline\n toU128(): this {\n return this;\n }\n\n /**\n * Convert to 64-bit signed integer\n * @returns 64-bit signed integer\n */\n @inline\n toI64(): i64 {\n return (\n (this.lo & 0x7FFFFFFFFFFFFFFF) |\n (this.hi & 0x8000000000000000)\n );\n }\n\n /**\n * Convert to 64-bit unsigned integer\n * @returns 64-bit unsigned integer\n */\n @inline\n toU64(): u64 {\n return this.lo;\n }\n\n /**\n * Convert to 32-bit signed integer\n * @returns 32-bit signed integer\n */\n @inline\n toI32(): i32 {\n return this.toI64();\n }\n\n /**\n * Convert to 32-bit unsigned integer\n * @returns 32-bit unsigned integer\n */\n @inline\n toU32(): u32 {\n return this.lo;\n }\n\n /**\n * Convert to 1-bit boolean\n * @returns 1-bit boolean\n */\n @inline\n toBool(): bool {\n return (this.lo | this.hi) != 0;\n }\n\n /**\n * Convert to 64-bit float number in deteministic way\n * @returns 64-bit float\n */\n @inline\n toF64(): f64 {\n return __floatuntidf(this.lo, this.hi);\n }\n\n /**\n * Convert to 32-bit float number\n * @returns 32-bit float\n */\n @inline\n toF32(): f32 {\n return this.toF64();\n }\n\n /**\n * Convert to generic type T. Useful inside other generics methods\n * @param T is \n * @returns type of T\n */\n @inline\n as(): T {\n var dummy: T;\n if (dummy instanceof bool) return this.toBool();\n else if (dummy instanceof i8) return this.toI64();\n else if (dummy instanceof u8) return this.toU64();\n else if (dummy instanceof i16) return this.toI64();\n else if (dummy instanceof u16) return this.toU64();\n else if (dummy instanceof i32) return this.toI64();\n else if (dummy instanceof i64) return this.toI64();\n else if (dummy instanceof u32) return this.toU64();\n else if (dummy instanceof u64) return this.toU64();\n else if (dummy instanceof f32) return this.toF64();\n else if (dummy instanceof f64) return this.toF64();\n else if (dummy instanceof i128) return this.toI128();\n else if (dummy instanceof u128) return this;\n else if (dummy instanceof u256) return this.toU256();\n else if (dummy instanceof u8[]) return this.toBytes();\n else if (dummy instanceof Uint8Array) return this.toUint8Array();\n else if (dummy instanceof String) return this.toString();\n else throw new TypeError('Unsupported generic type');\n }\n\n @inline\n private toArrayBufferLE(buffer: usize): void {\n store(buffer, this.lo, 0 * sizeof());\n store(buffer, this.hi, 1 * sizeof());\n }\n\n @inline\n private toArrayBufferBE(buffer: usize): void {\n store(buffer, bswap(this.hi), 0 * sizeof());\n store(buffer, bswap(this.lo), 1 * sizeof());\n }\n\n @inline\n private toArrayBuffer(buffer: usize, bigEndian: bool = false): void {\n if (bigEndian) {\n this.toArrayBufferBE(buffer);\n } else {\n this.toArrayBufferLE(buffer);\n }\n }\n\n /**\n * Convert to byte array\n * @param le Little or Big Endian? Default: true\n * @returns Array of bytes\n */\n @inline\n toBytes(bigEndian: bool = false): u8[] {\n var result = new Array(16);\n this.toArrayBuffer(result.dataStart, bigEndian);\n return result;\n }\n\n /**\n * Convert to Uint8Array\n * @param le Little or Big Endian? Default: true\n * @returns Uint8Array\n */\n @inline\n toUint8Array(bigEndian: bool = false): Uint8Array {\n var result = new Uint8Array(16);\n this.toArrayBuffer(result.dataStart, bigEndian);\n return result;\n }\n\n /**\n * Return copy of current 128-bit value\n * @returns 128-bit unsigned integer\n */\n clone(): u128 {\n return new u128(this.lo, this.hi);\n }\n\n toString(radix: i32 = 10): string {\n assert(radix == 10 || radix == 16, 'radix argument must be between 10 or 16');\n if (this.isZero()) return '0';\n\n var result = '';\n var it = this.clone();\n if (radix == 16) {\n let shift: i32 = 124 - (u128.clz(it) & ~3);\n while (shift >= 0) {\n // @ts-ignore\n it >>= shift;\n result = result.concat(HEX_CHARS.charAt((it.lo & 15)));\n shift -= 4;\n }\n return result;\n }\n return u128toa10(this);\n }\n}\n","/// \n\nimport { BLOCK_MAXSIZE } from \"./rt/common\";\nimport { COMPARATOR, SORT } from \"./util/sort\";\nimport { joinBooleanArray, joinIntegerArray, joinFloatArray, joinStringArray, joinReferenceArray } from \"./util/string\";\nimport { idof, isArray as builtin_isArray } from \"./builtins\";\nimport { E_INDEXOUTOFRANGE, E_INVALIDLENGTH, E_ILLEGALGENTYPE, E_EMPTYARRAY, E_HOLEYARRAY } from \"./util/error\";\n\n// @ts-ignore: decorator\n@inline @lazy const MIN_SIZE: usize = 8;\n\n/** Ensures that the given array has _at least_ the specified backing size. */\nfunction ensureCapacity(array: usize, newSize: usize, alignLog2: u32, canGrow: bool = true): void {\n // Depends on the fact that Arrays mimic ArrayBufferView\n var oldCapacity = changetype(array).byteLength;\n if (newSize > oldCapacity >>> alignLog2) {\n if (newSize > BLOCK_MAXSIZE >>> alignLog2) throw new RangeError(E_INVALIDLENGTH);\n let oldData = changetype(changetype(array).buffer);\n // Grows old capacity by factor of two.\n // Make sure we don't reach BLOCK_MAXSIZE for new growed capacity.\n let newCapacity = max(newSize, MIN_SIZE) << alignLog2;\n if (canGrow) newCapacity = max(min(oldCapacity << 1, BLOCK_MAXSIZE), newCapacity);\n let newData = __renew(oldData, newCapacity);\n memory.fill(newData + oldCapacity, 0, newCapacity - oldCapacity);\n if (newData !== oldData) { // oldData has been free'd\n store(array, newData, offsetof(\"buffer\"));\n store(array, newData, offsetof(\"dataStart\"));\n __link(array, changetype(newData), false);\n }\n store(array, newCapacity, offsetof(\"byteLength\"));\n }\n}\n\nexport class Array {\n [key: number]: T;\n\n // Mimicking ArrayBufferView isn't strictly necessary here but is done to allow glue code\n // to work with typed and normal arrays interchangeably. Technically, normal arrays do not need\n // `dataStart` (equals `buffer`) and `byteLength` (equals computed `buffer.byteLength`), but the\n // block is 16 bytes anyway so it's fine to have a couple extra fields in there.\n\n private buffer: ArrayBuffer;\n @unsafe readonly dataStart: usize;\n private byteLength: i32; // Uses here as capacity\n\n // Also note that Array with non-nullable T must guard against uninitialized null values\n // whenever an element is accessed. Otherwise, the compiler wouldn't be able to guarantee\n // type-safety anymore. For lack of a better word, such an array is \"holey\".\n\n private length_: i32;\n\n static isArray(value: U): bool {\n return isReference() ? builtin_isArray(value) && value !== null : false;\n }\n\n static create(capacity: i32 = 0): Array {\n WARNING(\"'Array.create' is deprecated. Use 'new Array' instead, making sure initial elements are initialized.\");\n var array = new Array(capacity);\n array.length = 0;\n return array;\n }\n\n constructor(length: i32 = 0) {\n if (length > BLOCK_MAXSIZE >>> alignof()) throw new RangeError(E_INVALIDLENGTH);\n // reserve capacity for at least MIN_SIZE elements\n var bufferSize = max(length, MIN_SIZE) << alignof();\n var buffer = changetype(__new(bufferSize, idof()));\n memory.fill(changetype(buffer), 0, bufferSize);\n this.buffer = buffer; // links\n this.dataStart = changetype(buffer);\n this.byteLength = bufferSize;\n this.length_ = length;\n }\n\n get length(): i32 {\n return this.length_;\n }\n\n set length(newLength: i32) {\n ensureCapacity(changetype(this), newLength, alignof(), false);\n this.length_ = newLength;\n }\n\n every(fn: (value: T, index: i32, array: Array) => bool): bool {\n for (let index = 0, length = this.length_; index < min(length, this.length_); ++index) {\n if (!fn(load(this.dataStart + (index << alignof())), index, this)) return false;\n }\n return true;\n }\n\n findIndex(predicate: (value: T, index: i32, array: Array) => bool): i32 {\n for (let index = 0, length = this.length_; index < min(length, this.length_); ++index) {\n if (predicate(load(this.dataStart + (index << alignof())), index, this)) return index;\n }\n return -1;\n }\n\n @operator(\"[]\") private __get(index: i32): T {\n if (index >= this.length_) throw new RangeError(E_INDEXOUTOFRANGE);\n var value = load(this.dataStart + (index << alignof()));\n if (isReference()) {\n if (!isNullable()) {\n if (!changetype(value)) throw new Error(E_HOLEYARRAY);\n }\n }\n return value;\n }\n\n @unsafe @operator(\"{}\") private __uget(index: i32): T {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\") private __set(index: i32, value: T): void {\n if (index >= this.length_) {\n if (index < 0) throw new RangeError(E_INDEXOUTOFRANGE);\n ensureCapacity(changetype(this), index + 1, alignof());\n this.length_ = index + 1;\n }\n this.__uset(index, value);\n }\n\n @unsafe @operator(\"{}=\") private __uset(index: i32, value: T): void {\n store(this.dataStart + (index << alignof()), value);\n if (isManaged()) {\n __link(changetype(this), changetype(value), true);\n }\n }\n\n at(index: i32): T {\n var len = this.length_;\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n var value = load(this.dataStart + (index << alignof()));\n if (isReference()) {\n if (!isNullable()) {\n if (!changetype(value)) throw new Error(E_HOLEYARRAY);\n }\n }\n return value;\n }\n\n fill(value: T, start: i32 = 0, end: i32 = i32.MAX_VALUE): this {\n var dataStart = this.dataStart;\n var length = this.length_;\n start = start < 0 ? max(length + start, 0) : min(start, length);\n end = end < 0 ? max(length + end, 0) : min(end, length);\n if (isManaged()) {\n for (; start < end; ++start) {\n store(dataStart + (start << alignof()), changetype(value));\n __link(changetype(this), changetype(value), true);\n }\n } else if (sizeof() == 1) {\n if (start < end) {\n memory.fill(\n dataStart + start,\n u8(value),\n (end - start)\n );\n }\n } else {\n for (; start < end; ++start) {\n store(dataStart + (start << alignof()), value);\n }\n }\n return this;\n }\n\n includes(value: T, fromIndex: i32 = 0): bool {\n if (isFloat()) {\n let length = this.length_;\n if (length == 0 || fromIndex >= length) return false;\n if (fromIndex < 0) fromIndex = max(length + fromIndex, 0);\n let dataStart = this.dataStart;\n while (fromIndex < length) {\n let elem = load(dataStart + (fromIndex << alignof()));\n // @ts-ignore\n if (elem == value || isNaN(elem) & isNaN(value)) return true;\n ++fromIndex;\n }\n return false;\n } else {\n return this.indexOf(value, fromIndex) >= 0;\n }\n }\n\n indexOf(value: T, fromIndex: i32 = 0): i32 {\n var length = this.length_;\n if (length == 0 || fromIndex >= length) return -1;\n if (fromIndex < 0) fromIndex = max(length + fromIndex, 0);\n var dataStart = this.dataStart;\n while (fromIndex < length) {\n if (load(dataStart + (fromIndex << alignof())) == value) return fromIndex;\n ++fromIndex;\n }\n return -1;\n }\n\n lastIndexOf(value: T, fromIndex: i32 = this.length_): i32 {\n var length = this.length_;\n if (length == 0) return -1;\n if (fromIndex < 0) fromIndex = length + fromIndex;\n else if (fromIndex >= length) fromIndex = length - 1;\n var dataStart = this.dataStart;\n while (fromIndex >= 0) {\n if (load(dataStart + (fromIndex << alignof())) == value) return fromIndex;\n --fromIndex;\n }\n return -1;\n }\n\n push(value: T): i32 {\n var length = this.length_;\n var newLength = length + 1;\n ensureCapacity(changetype(this), newLength, alignof());\n if (isManaged()) {\n store(this.dataStart + (length << alignof()), changetype(value));\n __link(changetype(this), changetype(value), true);\n } else {\n store(this.dataStart + (length << alignof()), value);\n }\n this.length_ = newLength;\n return newLength;\n }\n\n concat(other: Array): Array {\n var thisLen = this.length_;\n var otherLen = select(0, other.length_, other === null);\n var outLen = thisLen + otherLen;\n if (outLen > BLOCK_MAXSIZE >>> alignof()) throw new Error(E_INVALIDLENGTH);\n var out = changetype>(__newArray(outLen, alignof(), idof>()));\n var outStart = out.dataStart;\n var thisSize = thisLen << alignof();\n if (isManaged()) {\n let thisStart = this.dataStart;\n for (let offset: usize = 0; offset < thisSize; offset += sizeof()) {\n let ref = load(thisStart + offset);\n store(outStart + offset, ref);\n __link(changetype(out), ref, true);\n }\n outStart += thisSize;\n let otherStart = other.dataStart;\n let otherSize = otherLen << alignof();\n for (let offset: usize = 0; offset < otherSize; offset += sizeof()) {\n let ref = load(otherStart + offset);\n store(outStart + offset, ref);\n __link(changetype(out), ref, true);\n }\n } else {\n memory.copy(outStart, this.dataStart, thisSize);\n memory.copy(outStart + thisSize, other.dataStart, otherLen << alignof());\n }\n return out;\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): this {\n var dataStart = this.dataStart;\n var len = this.length_;\n\n end = min(end, len);\n\n var to = target < 0 ? max(len + target, 0) : min(target, len);\n var from = start < 0 ? max(len + start, 0) : min(start, len);\n var last = end < 0 ? max(len + end, 0) : min(end, len);\n var count = min(last - from, len - to);\n\n memory.copy( // is memmove\n dataStart + (to << alignof()),\n dataStart + (from << alignof()),\n count << alignof()\n );\n return this;\n }\n\n pop(): T {\n var length = this.length_;\n if (length < 1) throw new RangeError(E_EMPTYARRAY);\n var element = load(this.dataStart + ((--length) << alignof()));\n this.length_ = length;\n return element;\n }\n\n forEach(fn: (value: T, index: i32, array: Array) => void): void {\n for (let index = 0, length = this.length_; index < min(length, this.length_); ++index) {\n fn(load(this.dataStart + (index << alignof())), index, this);\n }\n }\n\n map(fn: (value: T, index: i32, array: Array) => U): Array {\n var length = this.length_;\n var out = changetype>(__newArray(length, alignof(), idof>()));\n var outStart = out.dataStart;\n for (let index = 0; index < min(length, this.length_); ++index) {\n let result = fn(load(this.dataStart + (index << alignof())), index, this);\n store(outStart + (index << alignof()), result);\n if (isManaged()) {\n __link(changetype(out), changetype(result), true);\n }\n }\n return out;\n }\n\n filter(fn: (value: T, index: i32, array: Array) => bool): Array {\n var result = changetype>(__newArray(0, alignof(), idof>()));\n for (let index = 0, length = this.length_; index < min(length, this.length_); ++index) {\n let value = load(this.dataStart + (index << alignof()));\n if (fn(value, index, this)) result.push(value);\n }\n return result;\n }\n\n reduce(\n fn: (previousValue: U, currentValue: T, currentIndex: i32, array: Array) => U,\n initialValue: U\n ): U {\n var accum = initialValue;\n for (let index = 0, length = this.length_; index < min(length, this.length_); ++index) {\n accum = fn(accum, load(this.dataStart + (index << alignof())), index, this);\n }\n return accum;\n }\n\n reduceRight(\n fn: (previousValue: U, currentValue: T, currentIndex: i32, array: Array) => U,\n initialValue: U\n ): U {\n var accum = initialValue;\n for (let index = this.length_ - 1; index >= 0; --index) {\n accum = fn(accum, load(this.dataStart + (index << alignof())), index, this);\n }\n return accum;\n }\n\n shift(): T {\n var length = this.length_;\n if (length < 1) throw new RangeError(E_EMPTYARRAY);\n var base = this.dataStart;\n var element = load(base);\n var lastIndex = length - 1;\n memory.copy(\n base,\n base + sizeof(),\n lastIndex << alignof()\n );\n if (isReference()) {\n store(base + (lastIndex << alignof()), 0);\n } else {\n // @ts-ignore\n store(base + (lastIndex << alignof()), 0);\n }\n this.length_ = lastIndex;\n return element;\n }\n\n some(fn: (value: T, index: i32, array: Array) => bool): bool {\n for (let index = 0, length = this.length_; index < min(length, this.length_); ++index) {\n if (fn(load(this.dataStart + (index << alignof())), index, this)) return true;\n }\n return false;\n }\n\n unshift(value: T): i32 {\n var newLength = this.length_ + 1;\n ensureCapacity(changetype(this), newLength, alignof());\n var dataStart = this.dataStart;\n memory.copy(\n dataStart + sizeof(),\n dataStart,\n (newLength - 1) << alignof()\n );\n store(dataStart, value);\n if (isManaged()) {\n __link(changetype(this), changetype(value), true);\n }\n this.length_ = newLength;\n return newLength;\n }\n\n slice(start: i32 = 0, end: i32 = i32.MAX_VALUE): Array {\n var length = this.length_;\n start = start < 0 ? max(start + length, 0) : min(start, length);\n end = end < 0 ? max(end + length, 0) : min(end , length);\n length = max(end - start, 0);\n var slice = changetype>(__newArray(length, alignof(), idof>()));\n var sliceBase = slice.dataStart;\n var thisBase = this.dataStart + (start << alignof());\n if (isManaged()) {\n let off = 0;\n let end = length << alignof();\n while (off < end) {\n let ref = load(thisBase + off);\n store(sliceBase + off, ref);\n __link(changetype(slice), ref, true);\n off += sizeof();\n }\n } else {\n memory.copy(sliceBase, thisBase, length << alignof());\n }\n return slice;\n }\n\n splice(start: i32, deleteCount: i32 = i32.MAX_VALUE): Array {\n var length = this.length_;\n start = start < 0 ? max(length + start, 0) : min(start, length);\n deleteCount = max(min(deleteCount, length - start), 0);\n var result = changetype>(__newArray(deleteCount, alignof(), idof>()));\n var resultStart = result.dataStart;\n var thisStart = this.dataStart;\n var thisBase = thisStart + (start << alignof());\n memory.copy(\n resultStart,\n thisBase,\n deleteCount << alignof()\n );\n var offset = start + deleteCount;\n if (length != offset) {\n memory.copy(\n thisBase,\n thisStart + (offset << alignof()),\n (length - offset) << alignof()\n );\n }\n this.length_ = length - deleteCount;\n return result;\n }\n\n reverse(): Array {\n var length = this.length_;\n if (length) {\n let front = this.dataStart;\n let back = this.dataStart + ((length - 1) << alignof());\n while (front < back) {\n let temp = load(front);\n store(front, load(back));\n store(back, temp);\n front += sizeof();\n back -= sizeof();\n }\n }\n return this;\n }\n\n sort(comparator: (a: T, b: T) => i32 = COMPARATOR()): this {\n var length = this.length_;\n if (length <= 1) return this;\n var base = this.dataStart;\n if (length == 2) {\n let a: T = load(base, sizeof()); // a = arr[1]\n let b: T = load(base); // b = arr[0]\n if (comparator(a, b) < 0) {\n store(base, b, sizeof()); // arr[1] = b;\n store(base, a); // arr[0] = a;\n }\n return this;\n }\n SORT(base, length, comparator);\n return this;\n }\n\n join(separator: string = \",\"): string {\n var dataStart = this.dataStart;\n var length = this.length_;\n if (isBoolean()) return joinBooleanArray(dataStart, length, separator);\n if (isInteger()) return joinIntegerArray(dataStart, length, separator);\n if (isFloat()) return joinFloatArray(dataStart, length, separator);\n\n if (ASC_SHRINK_LEVEL < 1) {\n if (isString()) return joinStringArray(dataStart, length, separator);\n }\n // For rest objects and arrays use general join routine\n if (isReference()) return joinReferenceArray(dataStart, length, separator);\n ERROR(\"unspported element type\");\n return unreachable();\n }\n\n flat(): T {\n if (!isArray()) {\n throw new TypeError(E_ILLEGALGENTYPE);\n }\n // Get the length and data start values\n var length = this.length_;\n var selfDataStart = this.dataStart;\n\n // calculate the end size with an initial pass\n var size = 0;\n for (let i = 0; i < length; i++) {\n let child = load(selfDataStart + (i << alignof()));\n size += child == 0 ? 0 : load(child, offsetof(\"length_\"));\n }\n\n // calculate the byteLength of the resulting backing ArrayBuffer\n var byteLength = size << usize(alignof>());\n var outBuffer = changetype(__new(byteLength, idof()));\n\n // create the return value and initialize it\n var outArray = changetype(__new(offsetof(), idof()));\n store(changetype(outArray), size, offsetof(\"length_\"));\n\n // byteLength, dataStart, and buffer are all readonly\n store(changetype(outArray), byteLength, offsetof(\"byteLength\"));\n store(changetype(outArray), changetype(outBuffer), offsetof(\"dataStart\"));\n store(changetype(outArray), changetype(outBuffer), offsetof(\"buffer\"));\n __link(changetype(outArray), changetype(outBuffer), false);\n\n // set the elements\n var resultOffset: usize = 0;\n for (let i = 0; i < length; i++) { // for each child\n let child = load(selfDataStart + (i << alignof()));\n\n // ignore null arrays\n if (child == 0) continue;\n\n // copy the underlying buffer data to the result buffer\n let childDataLength = load(child, offsetof(\"byteLength\"));\n memory.copy(\n changetype(outBuffer) + resultOffset,\n load(child, offsetof(\"dataStart\")),\n childDataLength\n );\n\n // advance the result length\n resultOffset += childDataLength;\n }\n\n // if the `valueof` type is managed, we must link each reference\n if (isManaged>()) {\n for (let i = 0; i < size; i++) {\n let ref = load(changetype(outBuffer) + (i << usize(alignof>())));\n __link(changetype(outBuffer), ref, true);\n }\n }\n\n return outArray;\n }\n\n toString(): string {\n return this.join();\n }\n\n // RT integration\n\n @unsafe private __visit(cookie: u32): void {\n if (isManaged()) {\n let cur = this.dataStart;\n let end = cur + (this.length_ << alignof());\n while (cur < end) {\n let val = load(cur);\n if (val) __visit(val, cookie);\n cur += sizeof();\n }\n }\n __visit(changetype(this.buffer), cookie);\n }\n}\n","import { u128 } from './integer/u128';\n\n// used for returning quotient and reminder from __divmod128\n@lazy export var __divmod_quot_hi: u64 = 0;\n@lazy export var __divmod_rem_lo: u64 = 0;\n@lazy export var __divmod_rem_hi: u64 = 0;\n\n// used for returning low and high part of __mulq64, __multi3 etc\n@lazy export var __res128_hi: u64 = 0;\n\n/**\n * Convert 128-bit unsigned integer to 64-bit float\n * @param lo lower 64-bit part of unsigned 128-bit integer\n * @param hi higher 64-bit part of unsigned 128-bit integer\n * @return 64-bit float result\n */\n// @ts-ignore: decorator\n@global\nexport function __floatuntidf(lo: u64, hi: u64): f64 {\n // __floatuntidf ported from LLVM sources\n if (!(lo | hi)) return 0.0;\n\n var v = new u128(lo, hi);\n var sd = 128 - __clz128(lo, hi);\n var e = sd - 1;\n\n if (sd > 53) {\n if (sd != 55) {\n if (sd == 54) {\n v = u128.shl(v, 1);\n } else {\n v = u128.or(\n u128.shr(v, sd - 55),\n u128.fromBool(u128.and(v, u128.shr(u128.Max, 128 + 55 - sd)).toBool())\n );\n }\n }\n\n v.lo |= (v.lo & 4) >> 2;\n v.preInc();\n\n v = u128.shr(v, 2);\n\n if (v.lo & (1 << 53)) {\n v = u128.shr(v, 1);\n ++e;\n }\n\n } else {\n v = u128.shl(v, 53 - sd);\n }\n\n var w: u64 = u128.shr(v, 32).lo & 0x000FFFFF;\n var u: u64 = (((e + 1023) << 20) | w) << 32;\n return reinterpret(u | (v.lo & 0xFFFFFFFF));\n}\n\n// @ts-ignore: decorator\n@global\nexport function __umulh64(a: u64, b: u64): u64 {\n var u = a & 0xFFFFFFFF; a >>= 32;\n var v = b & 0xFFFFFFFF; b >>= 32;\n\n var uv = u * v;\n var uv = a * v + (uv >> 32);\n var w0 = u * b + (uv & 0xFFFFFFFF);\n return a * b + (uv >> 32) + (w0 >> 32);\n}\n\n// @ts-ignore: decorator\n@global\nexport function __umulq64(a: u64, b: u64): u64 {\n var u = a & 0xFFFFFFFF; a >>= 32;\n var v = b & 0xFFFFFFFF; b >>= 32;\n\n var uv = u * v;\n var w0 = uv & 0xFFFFFFFF;\n uv = a * v + (uv >> 32);\n var w1 = uv >> 32;\n uv = u * b + (uv & 0xFFFFFFFF);\n\n __res128_hi = a * b + w1 + (uv >> 32);\n return (uv << 32) | w0;\n}\n\n// @ts-ignore: decorator\n@global\nexport function __multi3(al: u64, ah: u64, bl: u64, bh: u64): u64 {\n var u = al, v = bl;\n var w: u64, k: u64;\n\n var u1 = u & 0xFFFFFFFF; u >>= 32;\n var v1 = v & 0xFFFFFFFF; v >>= 32;\n var t = u1 * v1;\n var w1 = t & 0xFFFFFFFF;\n\n t = u * v1 + (t >> 32);\n k = t & 0xFFFFFFFF;\n w = t >> 32;\n t = u1 * v + k;\n\n var lo = (t << 32) | w1;\n var hi = u * v + w;\n hi += ah * bl;\n hi += al * bh;\n hi += t >> 32;\n\n __res128_hi = hi;\n return lo;\n}\n\n// @ts-ignore: decorator\n@global\nexport function __floatuntfdi(value: f64): u64 {\n var u = reinterpret(value);\n\n // if (value < -1.7014118346046e38) { // -(2^127-1)\n if (value < reinterpret(0xC7F0000000000000)) { // -(2^128-1)\n // __float_u128_hi = -1; // for i128\n __res128_hi = 0;\n // overflow negative\n return 0;\n // } else if (value < -9.2233720368547e18) { // -2^63-1 // for i128\n } else if (value < reinterpret(0xC3F0000000000000)) { // // -(2^64-1)\n let lo: u64, hi: u64, m: u64;\n\n m = (u & 0x000FFFFFFFFFFFFF) | (1 << 52);\n u = (u & 0x7FFFFFFFFFFFFFFF) >> 52;\n\n u -= 1075;\n if (u > 64) {\n lo = 0;\n hi = m << (u - 64);\n } else {\n lo = m << u;\n hi = m >> (64 - u);\n }\n __res128_hi = ~hi;\n return ~lo;\n // } else if (value < 9.2233720368547e18) { // 2^63-1 // for i128\n } else if (value < reinterpret(0x43F0000000000000)) { // 2^64-1\n // __float_u128_hi = (value < 0) ? -1 : 0; // for int\n __res128_hi = 0;\n // fit in a u64\n return value;\n // } else if (value < 1.7014118346046e38) {\n } else if (value < reinterpret(0x47F0000000000000)) { // 2^128-1\n let lo: u64, hi: u64, m: u64;\n\n m = (u & 0x000FFFFFFFFFFFFF) | (1 << 52);\n u = (u & 0x7FFFFFFFFFFFFFFF) >> 52;\n u -= 1075;\n if (u > 64) {\n lo = 0;\n hi = m << (u - 64);\n } else {\n lo = m << u;\n hi = m >> (64 - u);\n }\n __res128_hi = hi;\n return lo;\n } else {\n // overflow positive\n __res128_hi = -1; // 0x7FFFFFFFFFFFFFFF for i128\n return -1;\n }\n}\n\n// @ts-ignore: decorator\n@global @inline\nexport function __clz128(lo: u64, hi: u64): i32 {\n var mask: u64 = (hi ^ (hi - 1)) >> 63;\n return clz((hi & ~mask) | (lo & mask)) + (mask & 64);\n}\n\n// @ts-ignore: decorator\n@global @inline\nexport function __ctz128(lo: u64, hi: u64): i32 {\n var mask: u64 = (lo ^ (lo - 1)) >> 63;\n return ctz((hi & mask) | (lo & ~mask)) + (mask & 64);\n}\n\n// @ts-ignore: decorator\n@global\nexport function __udivmod128(alo: u64, ahi: u64, blo: u64, bhi: u64): u64 {\n var bzn = __clz128(blo, bhi); // N\n\n // b == 0\n if (bzn == 128) {\n throw new RangeError(\"Division by zero\"); // division by zero\n }\n\n // var azn = __clz128(alo, ahi); // M\n var btz = __ctz128(blo, bhi); // N\n\n // a == 0\n if (!(alo | ahi)) {\n __divmod_quot_hi = 0;\n __divmod_rem_lo = 0;\n __divmod_rem_hi = 0;\n return 0;\n }\n\n // a / 1\n if (bzn == 127) {\n __divmod_quot_hi = ahi;\n __divmod_rem_lo = 0;\n __divmod_rem_hi = 0;\n return alo;\n }\n\n // a == b\n if (alo == blo && ahi == bhi) {\n __divmod_quot_hi = 0;\n __divmod_rem_lo = 0;\n __divmod_rem_hi = 0;\n return 1;\n }\n\n // if (btz + bzn == 127) {\n // // TODO\n // // __divmod_quot = a >> btz\n // // b++\n // // __divmod_rem = a & b\n // return;\n // }\n\n if (!(ahi | bhi)) {\n __divmod_quot_hi = 0;\n __divmod_rem_hi = 0;\n // if `b.lo` is power of two\n if (!(blo & (blo - 1))) {\n __divmod_rem_lo = 0;\n return alo >> btz;\n } else {\n let dlo = alo / blo;\n __divmod_rem_lo = alo - dlo * blo;\n return dlo;\n }\n }\n\n // if b.lo == 0 and `b.hi` is power of two\n // if (!blo && !(bhi & (bhi - 1))) {\n // __divmod_rem = 0;\n\n // // TODO\n\n // return 0;\n // }\n\n // var diff: i64 = ahi - bhi;\n // var cmp = (diff != 0 ? diff : alo - blo); // TODO optimize this\n\n // if (cmp <= 0) {\n // __divmod_quot_hi = 0;\n // __divmod_rem = 0;\n // return u64(cmp == 0);\n // }\n\n // if (bzn - azn <= 5) {\n // // TODO\n // // fast path\n // return __udivmod128core(alo, ahi, blo, bhi);\n // }\n return __udivmod128core(alo, ahi, blo, bhi);\n}\n\nfunction __udivmod128core(alo: u64, ahi: u64, blo: u64, bhi: u64): u64 {\n var a = new u128(alo, ahi);\n var b = new u128(blo, bhi);\n // get leading zeros for left alignment\n var alz = __clz128(alo, ahi);\n var blz = __clz128(blo, bhi);\n var off = blz - alz;\n var nb = b << off;\n var q = u128.Zero;\n var n = a.clone();\n\n // create a mask with the length of b\n var mask = u128.One;\n mask <<= 128 - blz;\n --mask;\n mask <<= off;\n\n var i = 0;\n while (n >= b) {\n ++i;\n q <<= 1;\n if ((n & mask) >= nb) {\n ++q;\n n -= nb;\n }\n\n mask |= mask >> 1;\n nb >>= 1;\n }\n q <<= (blz - alz - i + 1);\n\n __divmod_quot_hi = q.hi;\n __divmod_rem_lo = n.lo;\n __divmod_rem_hi = n.hi;\n return q.lo;\n}\n\n// @ts-ignore: decorator\n@global\nexport function __udivmod128_10(lo: u64, hi: u64): u64 {\n if (!hi) {\n __divmod_quot_hi = 0;\n if (lo < 10) {\n __divmod_rem_lo = 0;\n __divmod_rem_hi = 0;\n return 0;\n } else {\n let qlo = lo / 10;\n __divmod_rem_lo = lo - qlo * 10;\n __divmod_rem_hi = 0;\n return qlo;\n }\n }\n\n var q: u128, r: u128;\n var n = new u128(lo, hi);\n\n q = n >> 1;\n q += n >> 2;\n q += q >> 4;\n q += q >> 8;\n q += q >> 16;\n q += q >> 32;\n q += u128.fromU64(q.hi); // q >> 64\n q >>= 3;\n r = n - (((q << 2) + q) << 1);\n n = q + u128.fromBool(r.lo > 9);\n\n __divmod_quot_hi = n.hi;\n __divmod_rem_lo = r.lo;\n __divmod_rem_hi = r.hi;\n return n.lo;\n}\n","import { COMPARATOR, SORT as SORT_IMPL } from \"./util/sort\";\nimport { E_INDEXOUTOFRANGE, E_INVALIDLENGTH, E_NOTIMPLEMENTED } from \"./util/error\";\nimport { joinIntegerArray, joinFloatArray } from \"./util/string\";\nimport { idof } from \"./builtins\";\nimport { ArrayBufferView } from \"./arraybuffer\";\n\nexport class Int8Array extends ArrayBufferView {\n [key: number]: i8;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength;\n }\n\n @operator(\"[]\")\n private __get(index: i32): i8 {\n if (index >= this.byteLength) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + index);\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): i8 {\n return load(this.dataStart + index);\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: native): void {\n if (index >= this.byteLength) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + index, value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: native): void {\n store(this.dataStart + index, value);\n }\n\n at(index: i32): i8 {\n var len = this.byteLength;\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + index);\n }\n\n includes(searchElement: i8, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: i8, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: i8, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int8Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: i8, b: i8) => i32 = COMPARATOR()): Int8Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Int8Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Int8Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Int8Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: i8, index: i32, array: Int8Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: i8, index: i32, array: Int8Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: i8, index: i32, self: Int8Array) => i8): Int8Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: i8, index: i32, self: Int8Array) => bool): Int8Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: i8, index: i32, self: Int8Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: i8, index: i32, self: Int8Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: i8, index: i32, self: Int8Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: i8, index: i32, self: Int8Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n toString(): string {\n return this.join();\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Int8Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Uint8Array extends ArrayBufferView {\n [key: number]: u8;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength;\n }\n\n @operator(\"[]\")\n private __get(index: i32): u8 {\n if (index >= this.byteLength) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + index);\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): u8 {\n return load(this.dataStart + index);\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: native): void {\n if (index >= this.byteLength) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + index, value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: native): void {\n store(this.dataStart + index, value);\n }\n\n at(index: i32): u8 {\n var len = this.byteLength;\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + index);\n }\n\n includes(searchElement: u8, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: u8, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: u8, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: u8, b: u8) => i32 = COMPARATOR()): Uint8Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Uint8Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: u8, index: i32, array: Uint8Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: u8, index: i32, array: Uint8Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: u8, index: i32, self: Uint8Array) => u8): Uint8Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: u8, index: i32, self: Uint8Array) => bool): Uint8Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: u8, index: i32, self: Uint8Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: u8, index: i32, self: Uint8Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: u8, index: i32, self: Uint8Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: u8, index: i32, self: Uint8Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Uint8Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Uint8ClampedArray extends ArrayBufferView {\n [key: number]: u8;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength;\n }\n\n @operator(\"[]\")\n private __get(index: i32): u8 {\n if (index >= this.byteLength) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + index);\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): u8 {\n return load(this.dataStart + index);\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: native): void {\n if (index >= this.byteLength) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + index, ~(value >> 31) & (((255 - value) >> 31) | value));\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: native): void {\n store(this.dataStart + index, ~(value >> 31) & (((255 - value) >> 31) | value));\n }\n\n at(index: i32): u8 {\n var len = this.byteLength;\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + index);\n }\n\n includes(searchElement: u8, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: u8, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: u8, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8ClampedArray {\n return FILL(this, value, start, end);\n }\n\n sort(fn: (a: u8, b: u8) => i32 = COMPARATOR()): Uint8ClampedArray {\n return SORT(this, fn);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8ClampedArray {\n return SLICE(this, begin, end);\n }\n\n subarray(start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8ClampedArray {\n return SUBARRAY(this, start, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Uint8ClampedArray {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: u8, index: i32, array: Uint8ClampedArray) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: u8, index: i32, array: Uint8ClampedArray) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: u8, index: i32, self: Uint8ClampedArray) => u8): Uint8ClampedArray {\n return MAP(this, fn);\n }\n\n filter(fn: (value: u8, index: i32, self: Uint8ClampedArray) => bool): Uint8ClampedArray {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: u8, index: i32, self: Uint8ClampedArray) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: u8, index: i32, self: Uint8ClampedArray) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: u8, index: i32, self: Uint8ClampedArray) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: u8, index: i32, self: Uint8ClampedArray) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Uint8ClampedArray {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Int16Array extends ArrayBufferView {\n [key: number]: i16;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength >>> alignof();\n }\n\n @operator(\"[]\")\n private __get(index: i32): i16 {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): i16 {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: native): void {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + (index << alignof()), value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: native): void {\n store(this.dataStart + (index << alignof()), value);\n }\n\n at(index: i32): i16 {\n var len = this.byteLength >>> alignof();\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n includes(searchElement: i16, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: i16, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: i16, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int16Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: i16, b: i16) => i32 = COMPARATOR()): Int16Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Int16Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Int16Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Int16Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: i16, index: i32, array: Int16Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: i16, index: i32, array: Int16Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: i16, index: i32, self: Int16Array) => i16): Int16Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: i16, index: i32, self: Int16Array) => bool): Int16Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: i16, index: i32, self: Int16Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: i16, index: i32, self: Int16Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: i16, index: i32, self: Int16Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: i16, index: i32, self: Int16Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Int16Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Uint16Array extends ArrayBufferView {\n [key: number]: u16;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength >>> alignof();\n }\n\n @operator(\"[]\")\n private __get(index: i32): u16 {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): u16 {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: native): void {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + (index << alignof()), value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: native): void {\n store(this.dataStart + (index << alignof()), value);\n }\n\n at(index: i32): u16 {\n var len = this.byteLength >>> alignof();\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n includes(searchElement: u16, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: u16, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: u16, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint16Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: u16, b: u16) => i32 = COMPARATOR()): Uint16Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint16Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint16Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Uint16Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: u16, index: i32, array: Uint16Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: u16, index: i32, array: Uint16Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: u16, index: i32, self: Uint16Array) => u16): Uint16Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: u16, index: i32, self: Uint16Array) => bool): Uint16Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: u16, index: i32, self: Uint16Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: u16, index: i32, self: Uint16Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: u16, index: i32, self: Uint16Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: u16, index: i32, self: Uint16Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Uint16Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Int32Array extends ArrayBufferView {\n [key: number]: i32;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength >>> alignof();\n }\n\n @operator(\"[]\")\n private __get(index: i32): i32 {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): i32 {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: i32): void {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + (index << alignof()), value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: i32): void {\n store(this.dataStart + (index << alignof()), value);\n }\n\n at(index: i32): i32 {\n var len = this.byteLength >>> alignof();\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n includes(searchElement: i32, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: i32, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: i32, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int32Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: i32, b: i32) => i32 = COMPARATOR()): Int32Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Int32Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Int32Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Int32Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: i32, index: i32, array: Int32Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: i32, index: i32, array: Int32Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: i32, index: i32, self: Int32Array) => i32): Int32Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: i32, index: i32, self: Int32Array) => bool): Int32Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: i32, index: i32, self: Int32Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: i32, index: i32, self: Int32Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: i32, index: i32, self: Int32Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: i32, index: i32, self: Int32Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Int32Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Uint32Array extends ArrayBufferView {\n [key: number]: u32;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength >>> alignof();\n }\n\n @operator(\"[]\")\n private __get(index: i32): u32 {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): u32 {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: u32): void {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + (index << alignof()), value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: u32): void {\n store(this.dataStart + (index << alignof()), value);\n }\n\n at(index: i32): u32 {\n var len = this.byteLength >>> alignof();\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n includes(searchElement: u32, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: u32, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: u32, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint32Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: u32, b: u32) => i32 = COMPARATOR()): Uint32Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint32Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint32Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Uint32Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: u32, index: i32, array: Uint32Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: u32, index: i32, array: Uint32Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: u32, index: i32, self: Uint32Array) => u32): Uint32Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: u32, index: i32, self: Uint32Array) => bool): Uint32Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: u32, index: i32, self: Uint32Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: u32, index: i32, self: Uint32Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: u32, index: i32, self: Uint32Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: u32, index: i32, self: Uint32Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Uint32Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Int64Array extends ArrayBufferView {\n [key: number]: i64;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength >>> alignof();\n }\n\n @operator(\"[]\")\n private __get(index: i32): i64 {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): i64 {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: i64): void {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + (index << alignof()), value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: i64): void {\n store(this.dataStart + (index << alignof()), value);\n }\n\n at(index: i32): i64 {\n var len = this.byteLength >>> alignof();\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n includes(searchElement: i64, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: i64, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: i64, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: i64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int64Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: i64, b: i64) => i32 = COMPARATOR()): Int64Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Int64Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Int64Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Int64Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: i64, index: i32, array: Int64Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: i64, index: i32, array: Int64Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: i64, index: i32, self: Int64Array) => i64): Int64Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: i64, index: i32, self: Int64Array) => bool): Int64Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: i64, index: i32, self: Int64Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: i64, index: i32, self: Int64Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: i64, index: i32, self: Int64Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: i64, index: i32, self: Int64Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Int64Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Uint64Array extends ArrayBufferView {\n [key: number]: u64;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength >>> alignof();\n }\n\n @operator(\"[]\")\n private __get(index: i32): u64 {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): u64 {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: u64): void {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + (index << alignof()), value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: u64): void {\n store(this.dataStart + (index << alignof()), value);\n }\n\n at(index: i32): u64 {\n var len = this.byteLength >>> alignof();\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n includes(searchElement: u64, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: u64, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: u64, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: u64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint64Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: u64, b: u64) => i32 = COMPARATOR()): Uint64Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint64Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint64Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Uint64Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: u64, index: i32, array: Uint64Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: u64, index: i32, array: Uint64Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: u64, index: i32, self: Uint64Array) => u64): Uint64Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: u64, index: i32, self: Uint64Array) => bool): Uint64Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: u64, index: i32, self: Uint64Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: u64, index: i32, self: Uint64Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: u64, index: i32, self: Uint64Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: u64, index: i32, self: Uint64Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Uint64Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Float32Array extends ArrayBufferView {\n [key: number]: f32;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength >>> alignof();\n }\n\n @operator(\"[]\")\n private __get(index: i32): f32 {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): f32 {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: f32): void {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + (index << alignof()), value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: f32): void {\n store(this.dataStart + (index << alignof()), value);\n }\n\n at(index: i32): f32 {\n var len = this.byteLength >>> alignof();\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n includes(searchElement: f32, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: f32, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: f32, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: f32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Float32Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: f32, b: f32) => i32 = COMPARATOR()): Float32Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Float32Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Float32Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Float32Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: f32, index: i32, array: Float32Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: f32, index: i32, array: Float32Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: f32, index: i32, self: Float32Array) => f32): Float32Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: f32, index: i32, self: Float32Array) => bool): Float32Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: f32, index: i32, self: Float32Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: f32, index: i32, self: Float32Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: f32, index: i32, self: Float32Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: f32, index: i32, self: Float32Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinFloatArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Float32Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Float64Array extends ArrayBufferView {\n [key: number]: f64;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength >>> alignof();\n }\n\n @operator(\"[]\")\n private __get(index: i32): f64 {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): f64 {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: f64): void {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + (index << alignof()), value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: f64): void {\n store(this.dataStart + (index << alignof()), value);\n }\n\n at(index: i32): f64 {\n var len = this.byteLength >>> alignof();\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n includes(searchElement: f64, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: f64, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: f64, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: f64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Float64Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: f64, b: f64) => i32 = COMPARATOR()): Float64Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Float64Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Float64Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Float64Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: f64, index: i32, array: Float64Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: f64, index: i32, array: Float64Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: f64, index: i32, self: Float64Array) => f64): Float64Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: f64, index: i32, self: Float64Array) => bool): Float64Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: f64, index: i32, self: Float64Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: f64, index: i32, self: Float64Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: f64, index: i32, self: Float64Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: f64, index: i32, self: Float64Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinFloatArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Float64Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\n// @ts-ignore: decorator\n@inline\nfunction FILL(\n array: TArray,\n value: native,\n start: i32,\n end: i32\n): TArray {\n var dataStart = array.dataStart;\n var len = array.length;\n start = start < 0 ? max(len + start, 0) : min(start, len);\n end = end < 0 ? max(len + end, 0) : min(end, len);\n if (sizeof() == 1) {\n if (start < end) memory.fill(dataStart + start, value, (end - start));\n } else {\n for (; start < end; ++start) {\n store(dataStart + (start << alignof()), value);\n }\n }\n return array;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction SORT(\n array: TArray,\n comparator: (a: T, b: T) => i32\n): TArray {\n var len = array.length;\n if (len <= 1) return array;\n var base = array.dataStart;\n if (len == 2) {\n let a: T = load(base, sizeof()); // a = arr[1]\n let b: T = load(base); // b = arr[0]\n if (comparator(a, b) < 0) {\n store(base, b, sizeof()); // arr[1] = b\n store(base, a); // arr[0] = a\n }\n return array;\n }\n SORT_IMPL(base, len, comparator);\n return array;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction SLICE(\n array: TArray,\n start: i32,\n end: i32\n): TArray {\n var len = array.length;\n start = start < 0 ? max(start + len, 0) : min(start, len);\n end = end < 0 ? max(end + len, 0) : min(end , len);\n len = max(end - start, 0);\n var slice = instantiate(len);\n memory.copy(\n slice.dataStart,\n array.dataStart + (start << alignof()),\n len << alignof()\n );\n return slice;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction SUBARRAY(\n array: TArray,\n begin: i32,\n end: i32\n): TArray {\n var len = array.length;\n begin = begin < 0 ? max(len + begin, 0) : min(begin, len);\n end = end < 0 ? max(len + end, 0) : min(end, len);\n end = max(end, begin);\n\n var out = changetype(__new(offsetof(), idof()));\n var buf = changetype(array.buffer);\n store(changetype(out), buf, offsetof(\"buffer\"));\n __link(changetype(out), buf, false);\n store(changetype(out), array.dataStart + (begin << alignof()), offsetof(\"dataStart\"));\n store(changetype(out), (end - begin) << alignof(), offsetof(\"byteLength\"));\n return out;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction COPY_WITHIN(\n array: TArray,\n target: i32,\n start: i32,\n end: i32\n): TArray {\n var len = array.length;\n var dataStart = array.dataStart;\n\n end = min(end, len);\n var to = target < 0 ? max(len + target, 0) : min(target, len);\n var from = start < 0 ? max(len + start, 0) : min(start, len);\n var last = end < 0 ? max(len + end, 0) : min(end, len);\n var count = min(last - from, len - to);\n\n memory.copy(\n dataStart + (to << alignof()),\n dataStart + (from << alignof()),\n count << alignof()\n );\n return array;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction REDUCE(\n array: TArray,\n fn: (accumulator: TRet, value: T, index: i32, array: TArray) => TRet,\n initialValue: TRet\n): TRet {\n var dataStart = array.dataStart;\n for (let i = 0, k = array.length; i < k; i++) {\n initialValue = fn(initialValue, load(dataStart + (i << alignof())), i, array);\n }\n return initialValue;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction REDUCE_RIGHT(\n array: TArray,\n fn: (accumulator: TRet, value: T, index: i32, array: TArray) => TRet,\n initialValue: TRet\n): TRet {\n var dataStart = array.dataStart;\n for (let i = array.length - 1; i >= 0; i--) {\n initialValue = fn(initialValue, load(dataStart + (i << alignof())), i, array);\n }\n return initialValue;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction MAP(\n array: TArray,\n fn: (value: T, index: i32, self: TArray) => T,\n): TArray {\n var len = array.length;\n var dataStart = array.dataStart;\n\n var byteLength = len << alignof();\n var out = changetype(__new(offsetof(), idof()));\n var buf = changetype(__new(byteLength, idof()));\n for (let i = 0; i < len; i++) {\n store(\n changetype(buf) + (i << alignof()),\n fn(load(dataStart + (i << alignof())), i, array)\n );\n }\n store(changetype(out), changetype(buf), offsetof(\"buffer\"));\n __link(changetype(out), changetype(buf), false);\n store(changetype(out), changetype(buf), offsetof(\"dataStart\"));\n store(changetype(out), byteLength, offsetof(\"byteLength\"));\n return out;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction FILTER(\n array: TArray,\n fn: (value: T, index: i32, self: TArray) => bool,\n): TArray {\n var len = array.length;\n var out = changetype(__new(offsetof(), idof()));\n var buf = changetype(__new(len << alignof(), idof()));\n var dataStart = array.dataStart;\n var j: usize = 0;\n for (let i = 0; i < len; i++) {\n let value = load(dataStart + (i << alignof()));\n if (fn(value, i, array)) {\n store(\n changetype(buf) + (j++ << alignof()),\n value\n );\n }\n }\n // shrink output buffer\n var byteLength = j << alignof();\n var data = __renew(changetype(buf), byteLength);\n store(changetype(out), data, offsetof(\"buffer\"));\n __link(changetype(out), data, false);\n store(changetype(out), byteLength, offsetof(\"byteLength\"));\n store(changetype(out), data, offsetof(\"dataStart\"));\n return out;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction FIND_INDEX(\n array: TArray,\n fn: (value: T, index: i32, array: TArray) => bool,\n): i32 {\n var dataStart = array.dataStart;\n for (let i = 0, k = array.length; i < k; i++) {\n if (fn(load(dataStart + (i << alignof())), i, array)) return i;\n }\n return -1;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction INCLUDES(\n array: TArray,\n searchElement: T,\n fromIndex: i32,\n): bool {\n if (isFloat()) {\n let index: isize = fromIndex;\n let length: isize = array.length;\n if (length == 0 || index >= length) return false;\n if (index < 0) index = max(length + index, 0);\n let dataStart = array.dataStart;\n while (index < length) {\n let elem = load(dataStart + (index << alignof()));\n // @ts-ignore\n if (elem == searchElement || isNaN(elem) & isNaN(searchElement)) return true;\n ++index;\n }\n return false;\n } else {\n return INDEX_OF(array, searchElement, fromIndex) >= 0;\n }\n}\n\n// @ts-ignore: decorator\n@inline\nfunction INDEX_OF(\n array: TArray,\n searchElement: T,\n fromIndex: i32,\n): i32 {\n var index: isize = fromIndex;\n var length: isize = array.length;\n if (length == 0 || index >= length) return -1;\n if (index < 0) index = max(length + index, 0);\n var dataStart = array.dataStart;\n while (index < length) {\n if (load(dataStart + (index << alignof())) == searchElement) return index;\n ++index;\n }\n return -1;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction LAST_INDEX_OF(\n array: TArray,\n searchElement: T,\n fromIndex: i32,\n): i32 {\n var index: isize = fromIndex;\n var length: isize = array.length;\n if (length == 0) return -1;\n if (index < 0) index = length + index; // no need to clamp\n else if (index >= length) index = length - 1;\n var dataStart = array.dataStart;\n while (index >= 0) {\n if (load(dataStart + (index << alignof())) == searchElement) return index;\n --index;\n }\n return -1;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction SOME(\n array: TArray,\n fn: (value: T, index: i32, array: TArray) => bool,\n): bool {\n var dataStart = array.dataStart;\n for (let i = 0, k = array.length; i < k; i++) {\n if (fn(load(dataStart + (i << alignof())), i, array)) return true;\n }\n return false;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction EVERY(\n array: TArray,\n fn: (value: T, index: i32, array: TArray) => bool,\n): bool {\n var dataStart = array.dataStart;\n for (let i = 0, k = array.length; i < k; i++) {\n if (fn(load(dataStart + (i << alignof())), i, array)) continue;\n return false;\n }\n return true;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction FOREACH(\n array: TArray,\n fn: (value: T, index: i32, array: TArray) => void,\n): void {\n var dataStart = array.dataStart;\n for (let i = 0, k = array.length; i < k; i++) {\n fn(load(dataStart + (i << alignof())), i, array);\n }\n}\n\n// @ts-ignore: decorator\n@inline\nfunction REVERSE(array: TArray): TArray {\n var dataStart = array.dataStart;\n for (let front: usize = 0, back: usize = array.length - 1; front < back; ++front, --back) {\n let frontPtr = dataStart + (front << alignof());\n let backPtr = dataStart + (back << alignof());\n let temp = load(frontPtr);\n store(frontPtr, load(backPtr));\n store(backPtr, temp);\n }\n return array;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction WRAP(\n buffer: ArrayBuffer,\n byteOffset: i32 = 0,\n length: i32 = -1\n): TArray {\n var byteLength: i32;\n var bufferByteLength = buffer.byteLength;\n const mask: u32 = sizeof() - 1;\n if (i32(byteOffset > bufferByteLength) | (byteOffset & mask)) {\n throw new RangeError(E_INDEXOUTOFRANGE);\n }\n if (length < 0) {\n if (length == -1) {\n if (bufferByteLength & mask) {\n throw new RangeError(E_INVALIDLENGTH);\n }\n byteLength = bufferByteLength - byteOffset;\n } else {\n throw new RangeError(E_INVALIDLENGTH);\n }\n } else {\n byteLength = length << alignof();\n if (byteOffset + byteLength > bufferByteLength) {\n throw new RangeError(E_INVALIDLENGTH);\n }\n }\n var out = changetype(__new(offsetof(), idof()));\n store(changetype(out), changetype(buffer), offsetof(\"buffer\"));\n __link(changetype(out), changetype(buffer), false);\n store(changetype(out), byteLength, offsetof(\"byteLength\"));\n store(changetype(out), changetype(buffer) + byteOffset, offsetof(\"dataStart\"));\n return out;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction SET(\n target: TArray,\n source: UArray,\n offset: i32 = 0\n): void {\n // need to assert at compile time that U is not a reference or a function\n if (isReference()) {\n ERROR(E_NOTIMPLEMENTED);\n }\n\n // Uncaught RangeError: offset is out of bounds\n if (offset < 0) throw new RangeError(E_INDEXOUTOFRANGE);\n if (source.length + offset > target.length) throw new RangeError(E_INDEXOUTOFRANGE);\n\n // if the types align and match, use memory.copy() instead of manual loop\n if (isInteger() == isInteger() && alignof() == alignof() &&\n !(target instanceof Uint8ClampedArray && isSigned())) {\n memory.copy(\n target.dataStart + (offset << alignof()),\n source.dataStart,\n source.byteLength\n );\n } else {\n let targetDataStart = target.dataStart + (offset << alignof());\n let sourceDataStart = source.dataStart;\n let count = source.length;\n for (let i = 0; i < count; i++) {\n // if TArray is Uint8ClampedArray, then values must be clamped\n if (target instanceof Uint8ClampedArray) {\n if (isFloat()) {\n let value = load(sourceDataStart + (i << alignof()));\n store(\n targetDataStart + (i << alignof()),\n isFinite(value) ? max(0, min(255, value)) : 0\n );\n } else {\n let value = load(sourceDataStart + (i << alignof()));\n if (!isSigned()) {\n store(\n targetDataStart + (i << alignof()),\n // @ts-ignore: cast to T is valid for numeric types here\n min(255, value)\n );\n } else if (sizeof() <= 4) {\n store(\n targetDataStart + (i << alignof()),\n // @ts-ignore: cast to T is valid for numeric types here\n ~(value >> 31) & (((255 - value) >> 31) | value)\n );\n } else {\n store(\n targetDataStart + (i << alignof()),\n // @ts-ignore: cast to T is valid for numeric types here\n ~(value >> 63) & (((255 - value) >> 63) | value)\n );\n }\n }\n // if U is a float, then casting float to int must include a finite check\n } else if (isFloat() && !isFloat()) {\n let value = load(sourceDataStart + (i << alignof()));\n // @ts-ignore: cast to T is valid for numeric types here\n store(targetDataStart + (i << alignof()), isFinite(value) ? value : 0);\n } else if (isFloat() && !isFloat()) {\n // @ts-ignore: In this case the conversion is required\n store(targetDataStart + (i << alignof()), load(sourceDataStart + (i << alignof())));\n } else {\n store(targetDataStart + (i << alignof()), load(sourceDataStart + (i << alignof())));\n }\n }\n }\n}\n","export function bswap(value: T): T {\n if (isInteger()) {\n if (sizeof() == 2) {\n return ((value << 8) | ((value >>> 8) & 0x00FF));\n }\n if (sizeof() == 4) {\n return (\n rotl(value & 0xFF00FF00, 8) |\n rotr(value & 0x00FF00FF, 8)\n );\n }\n if (sizeof() == 8) {\n let a = (value >> 8) & 0x00FF00FF00FF00FF;\n let b = (value & 0x00FF00FF00FF00FF) << 8;\n let v = a | b;\n\n a = (v >> 16) & 0x0000FFFF0000FFFF;\n b = (v & 0x0000FFFF0000FFFF) << 16;\n\n return rotr(a | b, 32);\n }\n return value;\n }\n assert(false);\n return value;\n}\n\nexport function bswap16(value: T): T {\n if (isInteger() && sizeof() <= 4) {\n if (sizeof() == 2) {\n return ((value << 8) | ((value >>> 8) & 0x00FF));\n } else if (sizeof() == 4) {\n return (((value << 8) & 0xFF00) | ((value >>> 8) & 0x00FF) | (value & 0xFFFF0000));\n }\n return value;\n }\n assert(false);\n return value;\n}\n","import { memcmp, memmove, memset } from \"./util/memory\";\nimport { E_NOTIMPLEMENTED } from \"./util/error\";\n\n/** Memory manager interface. */\nexport namespace memory {\n\n /** Gets the size of the memory in pages. */\n // @ts-ignore: decorator\n @builtin\n export declare function size(): i32;\n\n /** Grows the memory by the given size in pages and returns the previous size in pages. */\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function grow(pages: i32): i32;\n\n /** Fills a section in memory with the specified byte value. */\n // @ts-ignore: decorator\n @unsafe @builtin\n export function fill(dst: usize, c: u8, n: usize): void {\n memset(dst, c, n); // fallback if \"bulk-memory\" isn't enabled\n }\n\n /** Copies a section of memory to another. Has move semantics. */\n // @ts-ignore: decorator\n @unsafe @builtin\n export function copy(dst: usize, src: usize, n: usize): void {\n memmove(dst, src, n); // fallback if \"bulk-memory\" isn't enabled\n }\n\n /** Initializes a memory segment. */\n // @ts-ignore: decorator\n @unsafe\n export function init(segmentIndex: u32, srcOffset: usize, dstOffset: usize, n: usize): void {\n throw new Error(E_NOTIMPLEMENTED);\n }\n\n /** Drops a memory segment. */\n // @ts-ignore: decorator\n @unsafe\n export function drop(segmentIndex: u32): void {\n throw new Error(E_NOTIMPLEMENTED);\n }\n\n /** Repeats a section of memory at a specific address. */\n // @ts-ignore: decorator\n @unsafe\n export function repeat(dst: usize, src: usize, srcLength: usize, count: usize): void {\n var index: usize = 0;\n var total = srcLength * count;\n while (index < total) {\n memory.copy(dst + index, src, srcLength);\n index += srcLength;\n }\n }\n\n /** Compares a section of memory to another. */\n // @ts-ignore: decorator\n @inline\n export function compare(vl: usize, vr: usize, n: usize): i32 {\n return memcmp(vl, vr, n);\n }\n\n /** Gets a pointer to a static chunk of memory of the given size. */\n // @ts-ignore: decorator\n @builtin\n export declare function data(size: T, align?: i32): usize;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare const __data_end: usize;\n\n// @ts-ignore: decorator\n@builtin\nexport declare var __stack_pointer: usize;\n\n// @ts-ignore: decorator\n@builtin\nexport declare const __heap_base: usize;\n\n/** Heap memory interface. */\nexport namespace heap {\n\n /** Allocates a chunk of memory of at least the specified size. */\n // @ts-ignore: decorator\n @unsafe export function alloc(size: usize): usize {\n return __alloc(size);\n }\n\n /** Reallocates a chunk of memory to have at least the specified size. */\n // @ts-ignore: decorator\n @unsafe export function realloc(ptr: usize, size: usize): usize {\n return __realloc(ptr, size);\n }\n\n /** Frees a chunk of memory. Does hardly anything (most recent block only) with the stub runtime. */\n // @ts-ignore: decorator\n @unsafe export function free(ptr: usize): void {\n __free(ptr);\n }\n\n /** Dangerously resets the entire heap. Specific to the stub runtime. */\n // @ts-ignore: decorator\n @unsafe export function reset(): void {\n if (isDefined(__reset)) {\n __reset();\n } else {\n throw new Error(E_NOTIMPLEMENTED);\n }\n }\n}\n","export function memcpy(dest: usize, src: usize, n: usize): void { // see: musl/src/string/memcpy.c\n var w: u32, x: u32;\n\n // copy 1 byte each until src is aligned to 4 bytes\n while (n && (src & 3)) {\n store(dest++, load(src++));\n n--;\n }\n\n // if dst is aligned to 4 bytes as well, copy 4 bytes each\n if ((dest & 3) == 0) {\n while (n >= 16) {\n store(dest , load(src ));\n store(dest + 4, load(src + 4));\n store(dest + 8, load(src + 8));\n store(dest + 12, load(src + 12));\n src += 16; dest += 16; n -= 16;\n }\n if (n & 8) {\n store(dest , load(src ));\n store(dest + 4, load(src + 4));\n dest += 8; src += 8;\n }\n if (n & 4) {\n store(dest, load(src));\n dest += 4; src += 4;\n }\n if (n & 2) { // drop to 2 bytes each\n store(dest, load(src));\n dest += 2; src += 2;\n }\n if (n & 1) { // drop to 1 byte\n store(dest++, load(src++));\n }\n return;\n }\n\n // if dst is not aligned to 4 bytes, use alternating shifts to copy 4 bytes each\n // doing shifts if faster when copying enough bytes (here: 32 or more)\n if (n >= 32) {\n switch (dest & 3) {\n // known to be != 0\n case 1: {\n w = load(src);\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n n -= 3;\n while (n >= 17) {\n x = load(src + 1);\n store(dest, w >> 24 | x << 8);\n w = load(src + 5);\n store(dest + 4, x >> 24 | w << 8);\n x = load(src + 9);\n store(dest + 8, w >> 24 | x << 8);\n w = load(src + 13);\n store(dest + 12, x >> 24 | w << 8);\n src += 16; dest += 16; n -= 16;\n }\n break;\n }\n case 2: {\n w = load(src);\n store(dest++, load(src++));\n store(dest++, load(src++));\n n -= 2;\n while (n >= 18) {\n x = load(src + 2);\n store(dest, w >> 16 | x << 16);\n w = load(src + 6);\n store(dest + 4, x >> 16 | w << 16);\n x = load(src + 10);\n store(dest + 8, w >> 16 | x << 16);\n w = load(src + 14);\n store(dest + 12, x >> 16 | w << 16);\n src += 16; dest += 16; n -= 16;\n }\n break;\n }\n case 3: {\n w = load(src);\n store(dest++, load(src++));\n n -= 1;\n while (n >= 19) {\n x = load(src + 3);\n store(dest, w >> 8 | x << 24);\n w = load(src + 7);\n store(dest + 4, x >> 8 | w << 24);\n x = load(src + 11);\n store(dest + 8, w >> 8 | x << 24);\n w = load(src + 15);\n store(dest + 12, x >> 8 | w << 24);\n src += 16; dest += 16; n -= 16;\n }\n break;\n }\n }\n }\n\n // copy remaining bytes one by one\n if (n & 16) {\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n }\n if (n & 8) {\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n }\n if (n & 4) {\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n }\n if (n & 2) {\n store(dest++, load(src++));\n store(dest++, load(src++));\n }\n if (n & 1) {\n store(dest++, load(src++));\n }\n}\n\n// @ts-ignore: decorator\n@inline\nexport function memmove(dest: usize, src: usize, n: usize): void { // see: musl/src/string/memmove.c\n if (dest === src) return;\n if (ASC_SHRINK_LEVEL < 1) {\n if (src - dest - n <= -(n << 1)) {\n memcpy(dest, src, n);\n return;\n }\n }\n if (dest < src) {\n if (ASC_SHRINK_LEVEL < 2) {\n if ((src & 7) == (dest & 7)) {\n while (dest & 7) {\n if (!n) return;\n --n;\n store(dest++, load(src++));\n }\n while (n >= 8) {\n store(dest, load(src));\n n -= 8;\n dest += 8;\n src += 8;\n }\n }\n }\n while (n) {\n store(dest++, load(src++));\n --n;\n }\n } else {\n if (ASC_SHRINK_LEVEL < 2) {\n if ((src & 7) == (dest & 7)) {\n while ((dest + n) & 7) {\n if (!n) return;\n store(dest + --n, load(src + n));\n }\n while (n >= 8) {\n n -= 8;\n store(dest + n, load(src + n));\n }\n }\n }\n while (n) {\n store(dest + --n, load(src + n));\n }\n }\n}\n\n// @ts-ignore: decorator\n@inline\nexport function memset(dest: usize, c: u8, n: usize): void { // see: musl/src/string/memset\n if (ASC_SHRINK_LEVEL > 1) {\n while (n) {\n store(dest++, c);\n --n;\n }\n } else {\n // fill head and tail with minimal branching\n if (!n) return;\n let dend = dest + n;\n store(dest, c);\n store(dend - 1, c);\n if (n <= 2) return;\n store(dest, c, 1);\n store(dest, c, 2);\n store(dend - 2, c);\n store(dend - 3, c);\n if (n <= 6) return;\n store(dest, c, 3);\n store(dend - 4, c);\n if (n <= 8) return;\n\n // advance pointer to align it at 4-byte boundary\n let k: usize = -dest & 3;\n dest += k;\n n -= k;\n n &= -4;\n\n let c32: u32 = -1 / 255 * c;\n\n // fill head/tail up to 28 bytes each in preparation\n dend = dest + n;\n store(dest, c32);\n store(dend - 4, c32);\n if (n <= 8) return;\n store(dest, c32, 4);\n store(dest, c32, 8);\n store(dend - 12, c32);\n store(dend - 8, c32);\n if (n <= 24) return;\n store(dest, c32, 12);\n store(dest, c32, 16);\n store(dest, c32, 20);\n store(dest, c32, 24);\n store(dend - 28, c32);\n store(dend - 24, c32);\n store(dend - 20, c32);\n store(dend - 16, c32);\n\n // align to a multiple of 8\n k = 24 + (dest & 4);\n dest += k;\n n -= k;\n\n // copy 32 bytes each\n let c64: u64 = c32 | (c32 << 32);\n while (n >= 32) {\n store(dest, c64);\n store(dest, c64, 8);\n store(dest, c64, 16);\n store(dest, c64, 24);\n n -= 32;\n dest += 32;\n }\n }\n}\n\n// @ts-ignore: decorator\n@inline\nexport function memcmp(vl: usize, vr: usize, n: usize): i32 {\n if (vl == vr) return 0;\n if (ASC_SHRINK_LEVEL < 2) {\n if ((vl & 7) == (vr & 7)) {\n while (vl & 7) {\n if (!n) return 0;\n let a = load(vl);\n let b = load(vr);\n if (a != b) return a - b;\n n--; vl++; vr++;\n }\n while (n >= 8) {\n if (load(vl) != load(vr)) break;\n vl += 8;\n vr += 8;\n n -= 8;\n }\n }\n }\n while (n--) {\n let a = load(vl);\n let b = load(vr);\n if (a != b) return a - b;\n vl++; vr++;\n }\n return 0;\n}\n","/// \n\nimport { OBJECT, BLOCK_MAXSIZE, TOTAL_OVERHEAD } from \"./rt/common\";\nimport { idof } from \"./builtins\";\nimport { E_INVALIDLENGTH } from \"./util/error\";\n\nexport abstract class ArrayBufferView {\n\n readonly buffer: ArrayBuffer;\n @unsafe readonly dataStart: usize;\n readonly byteLength: i32;\n\n get byteOffset(): i32 {\n return (this.dataStart - changetype(this.buffer));\n }\n\n protected constructor(length: i32, alignLog2: i32) {\n if (length > BLOCK_MAXSIZE >>> alignLog2) throw new RangeError(E_INVALIDLENGTH);\n var buffer = changetype(__new(length = length << alignLog2, idof()));\n memory.fill(changetype(buffer), 0, length);\n this.buffer = buffer; // links\n this.dataStart = changetype(buffer);\n this.byteLength = length;\n }\n}\n\n@final export class ArrayBuffer {\n\n static isView(value: T): bool {\n if (isNullable()) {\n if (value === null) return false;\n }\n if (value instanceof Int8Array) return true;\n if (value instanceof Uint8Array) return true;\n if (value instanceof Uint8ClampedArray) return true;\n if (value instanceof Int16Array) return true;\n if (value instanceof Uint16Array) return true;\n if (value instanceof Int32Array) return true;\n if (value instanceof Uint32Array) return true;\n if (value instanceof Int64Array) return true;\n if (value instanceof Uint64Array) return true;\n if (value instanceof Float32Array) return true;\n if (value instanceof Float64Array) return true;\n if (value instanceof DataView) return true;\n return false;\n }\n\n constructor(length: i32) {\n if (length > BLOCK_MAXSIZE) throw new RangeError(E_INVALIDLENGTH);\n var buffer = changetype(__new(length, idof()));\n memory.fill(changetype(buffer), 0, length);\n return buffer;\n }\n\n get byteLength(): i32 {\n return changetype(changetype(this) - TOTAL_OVERHEAD).rtSize;\n }\n\n slice(begin: i32 = 0, end: i32 = BLOCK_MAXSIZE): ArrayBuffer {\n var length = this.byteLength;\n begin = begin < 0 ? max(length + begin, 0) : min(begin, length);\n end = end < 0 ? max(length + end , 0) : min(end , length);\n var outSize = max(end - begin, 0);\n var out = changetype(__new(outSize, idof()));\n memory.copy(changetype(out), changetype(this) + begin, outSize);\n return out;\n }\n\n toString(): string {\n return \"[object ArrayBuffer]\";\n }\n}\n","import { u256 } from './u256';\n\nexport class i256 {\n\n @inline static get Zero(): i256 { return new i256(); }\n @inline static get One(): i256 { return new i256(1); }\n @inline static get Min(): i256 { return new i256(0, 0, 0, 0x8000000000000000); }\n @inline static get Max(): i256 { return new i256(u64.MAX_VALUE, u64.MAX_VALUE, u64.MAX_VALUE, 0x7FFFFFFFFFFFFFFF); }\n\n constructor(\n public lo1: i64 = 0,\n public lo2: i64 = 0,\n public hi1: i64 = 0,\n public hi2: i64 = 0,\n ) {}\n\n @inline\n isNeg(): bool {\n return (this.hi2 >>> 63);\n }\n\n @inline\n isZero(): bool {\n return !(this.lo1 | this.lo2 | this.hi1 | this.hi2);\n }\n\n @inline @operator.prefix('!')\n static isEmpty(value: i256): bool {\n return value === null || !value.isZero();\n }\n\n /*\n @inline\n static abs(value: i128): i128 {\n return value < 0 ? value.neg() : value;\n }\n */\n\n // TODO\n}\n","import { i128 } from './i128';\nimport { u128 } from './u128';\nimport { u256toa10 } from \"../utils\";\n\n@lazy const HEX_CHARS = '0123456789abcdef';\n\nexport class u256 {\n\n @inline static get Zero(): u256 { return new u256(); }\n @inline static get One(): u256 { return new u256(1); }\n @inline static get Min(): u256 { return new u256(); }\n @inline static get Max(): u256 { return new u256(-1, -1, -1, -1); }\n\n // TODO: fromString\n\n @inline\n static fromU256(value: u256): u256 {\n return new u256(value.lo1, value.lo2, value.hi1, value.hi2);\n }\n\n @inline\n static fromU128(value: u128): u256 {\n return new u256(value.lo, value.hi);\n }\n\n @inline\n static fromU64(value: u64): u256 {\n return new u256(value);\n }\n\n @inline\n static fromI64(value: i64): u256 {\n var mask = value >> 63;\n return new u256(value, mask, mask, mask);\n }\n\n @inline\n static fromU32(value: u32): u256 {\n return new u256(value);\n }\n\n @inline\n static fromI32(value: i32): u256 {\n var mask: u64 = value >> 63;\n return new u256(value, mask, mask, mask);\n }\n\n @inline\n static fromBits(\n l0: u32, l1: u32, l2: u32, l3: u32,\n h0: u32, h1: u32, h2: u32, h3: u32,\n ): u256 {\n return new u256(\n l0 | ((l1) << 32),\n l2 | ((l3) << 32),\n h0 | ((h1) << 32),\n h2 | ((h3) << 32),\n );\n }\n\n @inline\n static fromBytes(array: T, bigEndian: bool = false): u256 {\n // @ts-ignore\n if (array instanceof u8[]) {\n return bigEndian\n // @ts-ignore\n ? u256.fromBytesBE(array)\n // @ts-ignore\n : u256.fromBytesLE(array);\n } else if (array instanceof Uint8Array) {\n return bigEndian\n ? u256.fromUint8ArrayBE(array)\n : u256.fromUint8ArrayLE(array);\n } else {\n throw new TypeError(\"Unsupported generic type\");\n }\n }\n\n @inline\n static fromBytesLE(array: u8[]): u256 {\n assert(array.length && (array.length & 31) == 0);\n // @ts-ignore\n var buffer = array.dataStart\n return new u256(\n load(buffer, 0 * sizeof()),\n load(buffer, 1 * sizeof()),\n load(buffer, 2 * sizeof()),\n load(buffer, 3 * sizeof()),\n );\n }\n\n @inline\n static fromBytesBE(array: u8[]): u256 {\n assert(array.length && (array.length & 31) == 0);\n var buffer = array.dataStart;\n return new u256(\n bswap(load(buffer, 3 * sizeof())),\n bswap(load(buffer, 2 * sizeof())),\n bswap(load(buffer, 1 * sizeof())),\n bswap(load(buffer, 0 * sizeof()))\n );\n }\n\n @inline\n static fromUint8ArrayLE(array: Uint8Array): u256 {\n assert(array.length && (array.length & 31) == 0);\n var buffer = array.dataStart;\n return new u256(\n load(buffer, 0 * sizeof()),\n load(buffer, 1 * sizeof()),\n load(buffer, 2 * sizeof()),\n load(buffer, 3 * sizeof())\n );\n }\n\n @inline\n static fromUint8ArrayBE(array: Uint8Array): u256 {\n assert(array.length && (array.length & 31) == 0);\n var buffer = array.dataStart;\n return new u256(\n bswap(load(buffer, 3 * sizeof())),\n bswap(load(buffer, 2 * sizeof())),\n bswap(load(buffer, 1 * sizeof())),\n bswap(load(buffer, 0 * sizeof()))\n );\n }\n\n // TODO need improvement\n // max safe uint for f64 actually 52-bits\n @inline\n static fromF64(value: f64): u256 {\n var mask = u64(reinterpret(value) >> 63);\n return new u256(value, mask, mask, mask);\n }\n\n // TODO need improvement\n // max safe int for f32 actually 23-bits\n @inline\n static fromF32(value: f32): u256 {\n var mask = u64(reinterpret(value) >> 31);\n return new u256(value, mask, mask, mask);\n }\n\n // TODO\n // static fromString(str: string): u256\n\n constructor(\n public lo1: u64 = 0,\n public lo2: u64 = 0,\n public hi1: u64 = 0,\n public hi2: u64 = 0,\n ) {}\n\n @inline\n set(value: u256): this {\n this.lo1 = value.lo1;\n this.lo2 = value.lo2;\n this.hi1 = value.hi1;\n this.hi2 = value.hi2;\n return this;\n }\n\n @inline\n setU128(value: u128): this {\n this.lo1 = value.lo;\n this.lo2 = value.hi;\n this.hi1 = 0;\n this.hi2 = 0;\n return this;\n }\n\n @inline\n setI64(value: i64): this {\n var mask: u64 = value >> 63;\n this.lo1 = value;\n this.lo2 = mask;\n this.hi1 = mask;\n this.hi2 = mask;\n return this;\n }\n\n @inline\n setU64(value: u64): this {\n this.lo1 = value;\n this.lo2 = 0;\n this.hi1 = 0;\n this.hi2 = 0;\n return this;\n }\n\n @inline\n setI32(value: i32): this {\n var mask: u64 = value >> 63;\n this.lo1 = value;\n this.lo2 = mask;\n this.hi1 = mask;\n this.hi2 = mask;\n return this;\n }\n\n @inline\n setU32(value: u32): this {\n this.lo1 = value;\n this.lo2 = 0;\n this.hi1 = 0;\n this.hi2 = 0;\n return this;\n }\n\n @inline\n isZero(): bool {\n return !(this.lo1 | this.lo2 | this.hi1 | this.hi2);\n }\n\n @inline @operator.prefix('!')\n static isEmpty(value: u256): bool {\n return value === null || value.isZero();\n }\n\n @inline @operator.prefix('~')\n not(): u256 {\n return new u256(~this.lo1, ~this.lo2, ~this.hi1, ~this.hi2);\n }\n\n @inline @operator.prefix('+')\n pos(): u256 {\n return this;\n }\n\n @operator.prefix('-')\n neg(): u256 {\n var\n lo1 = ~this.lo1,\n lo2 = ~this.lo2,\n hi1 = ~this.hi1,\n hi2 = ~this.hi2;\n\n var lo1p = lo1 + 1;\n var lo2p = lo2 + u64(lo1p < lo1);\n var hi1p = hi1 + ((lo2 & ~lo2p) >> 63);\n var hi2p = hi2 + ((hi1 & ~hi1p) >> 63);\n\n return new u256(lo1p, lo2p, hi1p, hi2p);\n }\n\n @operator.prefix('++')\n preInc(): this {\n var\n lo1 = this.lo1,\n lo2 = this.lo2,\n hi1 = this.hi1,\n hi2 = this.hi2;\n\n var lo1p = lo1 + 1;\n var lo2p = lo2 + u64(lo1p < lo1);\n var hi1p = hi1 + ((lo2 & ~lo2p) >> 63);\n var hi2p = hi2 + ((hi1 & ~hi1p) >> 63);\n\n this.lo1 = lo1p;\n this.lo2 = lo2p;\n this.hi1 = hi1p;\n this.hi2 = hi2p;\n\n return this;\n }\n\n @operator.prefix('--')\n preDec(): this {\n var\n lo1 = this.lo1,\n lo2 = this.lo2,\n hi1 = this.hi1,\n hi2 = this.hi2;\n\n var lo1p = lo1 - 1;\n var lo2p = lo2 - u64(lo1p > lo1);\n var hi1p = hi1 - ((~lo2 & lo2p) >> 63);\n var hi2p = hi2 - ((~hi1 & hi1p) >> 63);\n\n this.lo1 = lo1p;\n this.lo2 = lo2p;\n this.hi1 = hi1p;\n this.hi2 = hi2p;\n\n return this;\n }\n\n @inline @operator.postfix('++')\n postInc(): u256 {\n return this.clone().preInc();\n }\n\n @inline @operator.postfix('--')\n postDec(): u256 {\n return this.clone().preDec();\n }\n\n @operator('+')\n static add(a: u256, b: u256): u256 {\n var\n lo1a = a.lo1,\n lo2a = a.lo2,\n hi1a = a.hi1,\n hi2a = a.hi2;\n\n var\n lo1b = b.lo1,\n lo2b = b.lo2,\n hi1b = b.hi1,\n hi2b = b.hi2;\n\n var lo1 = lo1a + lo1b;\n var cy = u64(lo1 < lo1a);\n var lo2 = lo2a + lo2b + cy;\n // for a + b + c case we should calculate carry bit differently\n cy = ((lo2a & lo2b) | ((lo2a | lo2b) & ~lo2)) >> 63;\n var hi1 = hi1a + hi1b + cy;\n cy = ((hi1a & hi1b) | ((hi1a | hi1b) & ~hi1)) >> 63;\n var hi2 = hi2a + hi2b + cy;\n return new u256(lo1, lo2, hi1, hi2);\n }\n\n @operator('-')\n static sub(a: u256, b: u256): u256 {\n var\n lo1a = a.lo1,\n lo2a = a.lo2,\n hi1a = a.hi1,\n hi2a = a.hi2;\n\n var\n lo1b = b.lo1,\n lo2b = b.lo2,\n hi1b = b.hi1,\n hi2b = b.hi2;\n\n var lo1 = lo1a - lo1b;\n var cy = u64(lo1 > lo1a);\n var lo2 = lo2a - lo2b - cy;\n // for a - b - c case we should calculate carry bit differently\n cy = ((~lo2a & lo2b) | ((~lo2a | lo2b) & lo2)) >> 63;\n var hi1 = hi1a - hi1b - cy;\n cy = ((~hi1a & hi1b) | ((~hi1a | hi1b) & hi1)) >> 63;\n var hi2 = hi2a - hi2b - cy;\n return new u256(lo1, lo2, hi1, hi2);\n }\n\n @inline @operator('|')\n static or(a: u256, b: u256): u256 {\n return new u256(a.lo1 | b.lo1, a.lo2 | b.lo2, a.hi1 | b.hi1, a.hi2 | b.hi2);\n }\n\n @inline @operator('^')\n static xor(a: u256, b: u256): u256 {\n return new u256(a.lo1 ^ b.lo1, a.lo2 ^ b.lo2, a.hi1 ^ b.hi1, a.hi2 ^ b.hi2);\n }\n\n @inline @operator('&')\n static and(a: u256, b: u256): u256 {\n return new u256(a.lo1 & b.lo1, a.lo2 & b.lo2, a.hi1 & b.hi1, a.hi2 & b.hi2);\n }\n\n @operator('>>')\n static shr(value: u256, shift: i32): u256 {\n shift &= 255;\n var off = shift as u64;\n if (shift <= 64) {\n if (shift == 0) return value;\n let hi2 = value.hi2 >> off;\n let hi1 = (value.hi1 >> off) | (value.hi2 << 64 - off);\n let lo2 = (value.lo2 >> off) | (value.hi1 << 64 - off);\n let lo1 = (value.lo1 >> off) | (value.lo2 << 64 - off);\n return new u256(lo1, lo2, hi1, hi2);\n } else if (shift > 64 && shift <= 128) {\n let hi1 = value.hi2 >> 128 - off;\n return new u256(value.lo2, value.hi1, hi1);\n } else if (shift > 128 && shift <= 192) {\n let lo2 = value.hi2 >> 192 - off;\n return new u256(value.hi1, lo2);\n } else {\n return new u256(value.hi2 >> 256 - off);\n }\n }\n\n @inline @operator('>>>')\n static shr_u(value: u256, shift: i32): u256 {\n return u256.shr(value, shift);\n }\n\n @inline @operator('==')\n static eq(a: u256, b: u256): bool {\n return (\n a.lo1 == b.lo1 && a.lo2 == b.lo2 &&\n a.hi1 == b.hi1 && a.hi2 == b.hi2\n );\n }\n\n @inline @operator('!=')\n static ne(a: u256, b: u256): bool {\n return !u256.eq(a, b);\n }\n\n @operator('<')\n static lt(a: u256, b: u256): bool {\n var ah2 = a.hi2, ah1 = a.hi1,\n bh2 = b.hi2, bh1 = b.hi1,\n al2 = a.lo2, bl2 = b.lo2;\n if (ah2 == bh2) {\n if (ah1 == bh1) {\n return al2 == bl2 ? a.lo1 < b.lo1 : al2 < bl2\n } else {\n return ah1 < bh1;\n }\n } else {\n return ah2 < bh2;\n }\n }\n\n @inline @operator('>')\n static gt(a: u256, b: u256): bool {\n return b < a;\n }\n\n @inline @operator('<=')\n static le(a: u256, b: u256): bool {\n return !u256.gt(a, b);\n }\n\n @inline @operator('>=')\n static ge(a: u256, b: u256): bool {\n return !u256.lt(a, b);\n }\n\n @inline\n static popcnt(value: u256): i32 {\n var count = popcnt(value.lo1);\n if (value.lo2) count += popcnt(value.lo2);\n if (value.hi1) count += popcnt(value.hi1);\n if (value.hi2) count += popcnt(value.hi2);\n return count;\n }\n\n @inline\n static clz(value: u256): i32 {\n if (value.hi2) return (clz(value.hi2) + 0);\n else if (value.hi1) return (clz(value.hi1) + 64);\n else if (value.lo2) return (clz(value.lo2) + 128);\n else return (clz(value.lo1) + 192);\n }\n\n @inline\n static ctz(value: u256): i32 {\n if (value.lo1) return (ctz(value.lo1) + 0);\n else if (value.lo2) return (ctz(value.lo2) + 64);\n else if (value.hi1) return (ctz(value.hi1) + 128);\n else return (ctz(value.hi2) + 192);\n }\n\n /**\n * Convert to 128-bit signed integer\n * @return 256-bit signed integer\n */\n @inline\n toI128(): i128 {\n return new i128(\n this.lo1,\n (this.lo2 & 0x7FFFFFFFFFFFFFFF) |\n (this.hi2 & 0x8000000000000000)\n );\n }\n\n /**\n * Convert to 128-bit unsigned integer\n * @return 128-bit unsigned integer\n */\n @inline\n toU128(): u128 {\n return new u128(this.lo1, this.lo2);\n }\n\n /**\n * Convert to 256-bit unsigned integer\n * @returns 256-bit unsigned integer\n */\n @inline\n toU256(): this {\n return this;\n }\n\n /**\n * Convert to 64-bit signed integer\n * @return 64-bit signed integer\n */\n @inline\n toI64(): i64 {\n return (\n (this.lo1 & 0x7FFFFFFFFFFFFFFF) |\n (this.hi2 & 0x8000000000000000)\n );\n }\n\n /**\n * Convert to 64-bit unsigned integer\n * @return 64-bit unsigned integer\n */\n @inline\n toU64(): u64 {\n return this.lo1;\n }\n\n /**\n * Convert to 32-bit signed integer\n * @return 32-bit signed integer\n */\n @inline\n toI32(): i32 {\n return this.toI64();\n }\n\n /**\n * Convert to 32-bit unsigned integer\n * @return 32-bit unsigned integer\n */\n @inline\n toU32(): u32 {\n return this.lo1;\n }\n\n /**\n * Convert to 1-bit boolean\n * @return 1-bit boolean\n */\n @inline\n toBool(): bool {\n return (this.lo1 | this.lo2 | this.hi1 | this.hi2);\n }\n\n @inline\n private toArrayBufferLE(buffer: usize): void {\n store(buffer, this.lo1, 0 * sizeof());\n store(buffer, this.lo2, 1 * sizeof());\n store(buffer, this.hi1, 2 * sizeof());\n store(buffer, this.hi2, 3 * sizeof());\n }\n\n @inline\n private toArrayBufferBE(buffer: usize): void {\n store(buffer, bswap(this.hi2), 0 * sizeof());\n store(buffer, bswap(this.hi1), 1 * sizeof());\n store(buffer, bswap(this.lo2), 2 * sizeof());\n store(buffer, bswap(this.lo1), 3 * sizeof());\n }\n\n @inline\n private toArrayBuffer(buffer: usize, bigEndian: bool = false): void {\n if (bigEndian) {\n this.toArrayBufferBE(buffer);\n } else {\n this.toArrayBufferLE(buffer);\n }\n }\n\n /**\n * Convert to generic type T. Useful inside other generics methods\n * @param T is \n * @returns type of T\n */\n @inline\n as(): T {\n var dummy: T;\n if (dummy instanceof bool) return this.toBool();\n else if (dummy instanceof i8) return this.toI64();\n else if (dummy instanceof u8) return this.toU64();\n else if (dummy instanceof i16) return this.toI64();\n else if (dummy instanceof u16) return this.toU64();\n else if (dummy instanceof i32) return this.toI64();\n else if (dummy instanceof i64) return this.toI64();\n else if (dummy instanceof u32) return this.toU64();\n else if (dummy instanceof u64) return this.toU64();\n // else if (dummy instanceof f32) return this.toF64();\n // else if (dummy instanceof f64) return this.toF64();\n else if (dummy instanceof i128) return this.toI128();\n else if (dummy instanceof u128) return this.toU128();\n else if (dummy instanceof u256) return this.toU256();\n else if (dummy instanceof u8[]) return this.toBytes();\n else if (dummy instanceof Uint8Array) return this.toUint8Array();\n else if (dummy instanceof String) return this.toString();\n else throw new TypeError('Unsupported generic type');\n }\n\n /**\n * Convert to byte array\n * @param le Little or Big Endian? Default: true\n * @returns Array of bytes\n */\n @inline\n toBytes(bigEndian: bool = false): u8[] {\n var result = new Array(32);\n this.toArrayBuffer(result.dataStart, bigEndian);\n return result;\n }\n\n /**\n * Convert to Uint8Array\n * @param le Little or Big Endian? Default: true\n * @returns Uint8Array\n */\n @inline\n toUint8Array(bigEndian: bool = false): Uint8Array {\n var result = new Uint8Array(32);\n this.toArrayBuffer(result.dataStart, bigEndian);\n return result;\n }\n\n clone(): u256 {\n return new u256(this.lo1, this.lo2, this.hi1, this.hi2);\n }\n\n toString(radix: i32 = 10): string {\n assert(radix == 10 || radix == 16, 'radix argument must be between 10 or 16');\n if (this.isZero()) return '0';\n\n var result = '';\n var it = this.clone();\n if (radix == 16) {\n let shift: i32 = 252 - (u256.clz(it) & ~3);\n while (shift >= 0) {\n // @ts-ignore\n it >>= shift;\n result = result.concat(HEX_CHARS.charAt((it.lo1 & 15)));\n shift -= 4;\n }\n return result;\n }\n return u256toa10(this);\n }\n}\n","import { u256Safe as u256 } from './u256';\nimport { i128Safe } from './i128';\nimport { i256Safe } from './i256';\nimport { u128 as U128 } from '../u128';\nimport { u256 as U256 } from '../u256';\nimport { i128 as I128 } from '../i128';\nimport { i256 as I256 } from '../i256';\nimport { isPowerOverflow128, atou128 } from '../../utils';\n\n// @external(\"safe_u128.spec.as\", \"logStr\")\n// declare function logStr(str: string): void;\n\n// @external(\"safe_u128.spec.as\", \"logF64\")\n// declare function logF64(v: f64): void;\n\n// export namespace safe {\nclass u128 extends U128 {\n\n @inline static get Zero(): u128 { return new u128(); }\n @inline static get One(): u128 { return new u128(1); }\n @inline static get Min(): u128 { return new u128(); }\n @inline static get Max(): u128 { return new u128(-1, -1); }\n\n @inline\n static fromString(value: string, radix: i32 = 10): u128 {\n return changetype(atou128(value, radix));\n }\n\n @inline\n static fromI256(value: I256): u128 {\n return changetype(U128.fromI256(value));\n }\n\n @inline\n static fromI256Safe(value: i256Safe): u128 {\n return changetype(U128.fromI256(value));\n }\n\n @inline\n static fromU256(value: u256): u128 {\n return changetype(U128.fromU256(value));\n }\n\n @inline\n static fromI128(value: I128): u128 {\n return changetype(U128.fromI128(value));\n }\n\n @inline\n static fromI128Safe(value: i128Safe): u128 {\n return changetype(U128.fromI128(value));\n }\n\n @inline\n static fromU128(value: u128): u128 {\n return changetype(U128.fromU128(value));\n }\n\n @inline\n static fromI64(value: i64): u128 {\n return changetype(U128.fromI64(value));\n }\n\n @inline\n static fromU64(value: u64): u128 {\n return changetype(U128.fromU64(value));\n }\n\n @inline\n static fromF64(value: f64): u128 {\n return changetype(U128.fromF64(value));\n }\n\n @inline\n static fromF32(value: f32): u128 {\n return changetype(U128.fromF32(value));\n }\n\n @inline\n static fromI32(value: i32): u128 {\n return changetype(U128.fromI32(value));\n }\n\n @inline\n static fromU32(value: u32): u128 {\n return changetype(U128.fromU32(value));\n }\n\n @inline\n static fromBool(value: bool): u128 {\n return changetype(U128.fromBool(value));\n }\n\n @inline\n static fromBits(lo1: u32, lo2: u32, hi1: u32, hi2: u32): u128 {\n return changetype(U128.fromBits(lo1, lo2, hi1, hi2));\n }\n\n @inline\n static fromBytes(array: T, bigEndian: bool = false): u128 {\n return changetype(U128.fromBytes(array, bigEndian));\n }\n\n @inline\n static fromBytesLE(array: u8[]): u128 {\n return changetype(U128.fromBytesLE(array));\n }\n\n @inline\n static fromBytesBE(array: u8[]): u128 {\n return changetype(U128.fromBytesBE(array));\n }\n\n @inline\n static fromUint8ArrayLE(array: Uint8Array): u128 {\n return changetype(U128.fromUint8ArrayLE(array));\n }\n\n @inline\n static fromUint8ArrayBE(array: Uint8Array): u128 {\n return changetype(U128.fromUint8ArrayBE(array));\n }\n\n /**\n * Create 128-bit unsigned integer from generic type T\n * @param value\n * @returns 128-bit unsigned integer\n */\n @inline\n static from(value: T): u128 {\n if (value instanceof bool) return u128.fromU64(value);\n else if (value instanceof i8) return u128.fromI64(value);\n else if (value instanceof u8) return u128.fromU64(value);\n else if (value instanceof i16) return u128.fromI64(value);\n else if (value instanceof u16) return u128.fromU64(value);\n else if (value instanceof i32) return u128.fromI64(value);\n else if (value instanceof u32) return u128.fromU64(value);\n else if (value instanceof i64) return u128.fromI64(value);\n else if (value instanceof u64) return u128.fromU64(value);\n else if (value instanceof f32) return u128.fromF64(value);\n else if (value instanceof f64) return u128.fromF64(value);\n else if (value instanceof I128) return u128.fromI128(value);\n else if (value instanceof i128Safe) return u128.fromI128(value);\n else if (value instanceof u128) return u128.fromU128(value);\n else if (value instanceof U128) return u128.fromU128(value);\n else if (value instanceof I256) return u128.fromI128(value);\n else if (value instanceof i256Safe) return u128.fromI256(value);\n else if (value instanceof u256) return u128.fromU256(value);\n else if (value instanceof u8[]) return u128.fromBytes(value);\n else if (value instanceof Uint8Array) return u128.fromBytes(value);\n else if (value instanceof String) return u128.fromString(value);\n else throw new TypeError(\"Unsupported generic type\");\n }\n\n @inline @operator('|')\n static or(a: u128, b: u128): u128 {\n return changetype(U128.or(a, b));\n }\n\n @inline @operator('^')\n static xor(a: u128, b: u128): u128 {\n return changetype(U128.xor(a, b));\n }\n\n @inline @operator('&')\n static and(a: u128, b: u128): u128 {\n return changetype(U128.and(a, b));\n }\n\n @inline @operator('<<')\n static shl(value: u128, shift: i32): u128 {\n return changetype(U128.shl(value, shift));\n }\n\n @inline @operator('>>')\n static shr(value: u128, shift: i32): u128 {\n return changetype(U128.shr(value, shift));\n }\n\n @inline @operator('>>>')\n static shr_u(value: u128, shift: i32): u128 {\n return u128.shr(value, shift);\n }\n\n @inline\n static rotl(value: u128, shift: i32): u128 {\n return changetype(U128.rotl(value, shift));\n }\n\n @inline\n static rotr(value: u128, shift: i32): u128 {\n return changetype(U128.rotr(value, shift));\n }\n\n @operator.prefix('++')\n preInc(): this {\n if ((this.lo & this.hi) == -1) { // if this == max\n throw new RangeError('Overflow during prefix incrementing');\n }\n super.preInc();\n return this;\n }\n\n @operator.prefix('--')\n preDec(): this {\n if ((this.lo | this.hi) == 0) { // if this == 0\n throw new RangeError('Underflow during prefix decrementing');\n }\n super.preDec();\n return this;\n }\n\n @inline @operator.postfix('++')\n postInc(): u128 {\n return this.clone().preInc();\n }\n\n @inline @operator.postfix('--')\n postDec(): u128 {\n return this.clone().preDec();\n }\n\n @operator('+')\n static add(a: u128, b: u128): u128 {\n var bl = b.lo;\n var lo = a.lo + bl;\n var c = u64(lo < bl);\n var x = a.hi;\n var y = b.hi;\n var hi = x + y + c;\n if (((hi ^ x) & (hi ^ y)) < c) {\n throw new RangeError('Overflow during addision');\n }\n return new u128(lo, hi);\n }\n\n @operator('-')\n static sub(a: u128, b: u128): u128 {\n if (a < b) throw new RangeError(\"Underflow during substraction\");\n return changetype(\n U128.sub(changetype(a), changetype(b))\n );\n }\n\n @operator('*')\n static mul(a: u128, b: u128): u128 {\n if (a.isZero() || b.isZero()) {\n return u128.Zero;\n }\n var s = u128.clz(a) + u128.clz(b);\n if (s < 127) { // defenitely overflow\n throw new RangeError(\"Overflow during multiplication\");\n }\n if (s == 127) { // this may overflow or not. Need extra checks.\n // See Hacker's Delight, 2nd Edition. 2–13 Overflow Detection\n // @ts-ignore\n let tmp = U128.mul(changetype(a), changetype(b) >> 1);\n // @ts-ignore\n if (tmp.hi >>> 63) { // (signed)t < 0\n throw new RangeError(\"Overflow during multiplication\");\n }\n // @ts-ignore\n let z = tmp << 1;\n if (b.lo & 1) {\n // @ts-ignore\n z += a;\n // @ts-ignore\n if (z < a) {\n throw new RangeError(\"Overflow during multiplication\");\n }\n }\n return changetype(z);\n }\n return changetype(\n U128.mul(changetype(a), changetype(b))\n );\n }\n\n @inline @operator('/')\n static div(a: u128, b: u128): u128 {\n return changetype(U128.div(a, b));\n }\n\n @inline @operator('**')\n static pow(base: u128, exponent: i32): u128 {\n if (isPowerOverflow128(base, exponent)) {\n throw new Error(\"Overflow during exponentiation\");\n }\n return changetype(U128.pow(changetype(base), exponent));\n }\n\n @inline @operator('%')\n static rem(a: u128, b: u128): u128 {\n return changetype(U128.rem(a, b));\n }\n\n @inline\n static div10(value: u128): u128 {\n return changetype(U128.div10(value));\n }\n\n @inline\n static rem10(value: u128): u128 {\n return changetype(U128.rem10(value));\n }\n\n // compute floor(sqrt(x))\n @inline\n static sqrt(value: u128): u128 {\n return changetype(U128.sqrt(value));\n }\n\n @inline\n static muldiv(number: u128, numerator: u128, denominator: u128): u128 {\n // TODO: Need implement overflow checking\n return changetype(U128.muldiv(number, numerator, denominator));\n }\n\n @inline\n toUnchecked(): U128 {\n return changetype(this);\n }\n\n @inline\n as(): T {\n var dummy: T;\n\n if (dummy instanceof bool) return this.toBool();\n else if (dummy instanceof i8) return this.toI64();\n else if (dummy instanceof u8) return this.toU64();\n else if (dummy instanceof i16) return this.toI64();\n else if (dummy instanceof u16) return this.toU64();\n else if (dummy instanceof i32) return this.toI64();\n else if (dummy instanceof i64) return this.toI64();\n else if (dummy instanceof u32) return this.toU64();\n else if (dummy instanceof u64) return this.toU64();\n else if (dummy instanceof f32) return this.toF64();\n else if (dummy instanceof f64) return this.toF64();\n else if (dummy instanceof i128) return this.toI128();\n else if (dummy instanceof u128) return this;\n else if (dummy instanceof U128) return this.toUnchecked();\n else if (dummy instanceof u256) return this.toU256();\n else if (dummy instanceof U256) return this.toU256();\n else if (dummy instanceof u8[]) return this.toBytes();\n else if (dummy instanceof Uint8Array) return this.toUint8Array();\n else if (dummy instanceof String) return this.toString();\n else throw new TypeError('Unsupported generic type');\n }\n\n //\n // unsigned div and rem already contain traps\n //\n\n @inline\n clone(): u128 {\n return new u128(this.lo, this.hi);\n }\n}\n\nexport { u128 as u128Safe };\n"]} \ No newline at end of file +{"version":3,"sources":["~lib/rt/common.ts","~lib/util/number.ts","~lib/util/math.ts","~lib/util/string.ts","~lib/rt/stub.ts","~lib/util/error.ts","assembly/integer/i128.ts","~lib/builtins.ts","assembly/utils.ts","~lib/string.ts","assembly/integer/u128.ts","~lib/array.ts","assembly/globals.ts","~lib/typedarray.ts","~lib/polyfills.ts","~lib/memory.ts","~lib/util/memory.ts","~lib/staticarray.ts","~lib/arraybuffer.ts","assembly/integer/i256.ts","assembly/integer/u256.ts","assembly/integer/safe/u128.ts"],"names":[],"mappings":"gkMIqFE,AAAI,EAAO,SAAgC,eArD3C,AAAI,AAsDc,AAAkB,EAAlB,KAtDP,SAA+B,cAlB1C,AAAI,AAsBY,AAFN,AADE,IACO,KAEG,AADJ,AATV,AAAC,KAAmC,GAAY,QAZxC,AADA,AAAC,AAAC,AADA,IACsB,GAAM,GAAW,QAIvD,AAAI,AAAY,AADM,EAAa,AADjB,AAAO,AAAC,EAAY,GAAY,KAAU,KAAa,aAE1C,KAC7B,AAAI,AAAY,IAAe,SAGnC,AAAS,IAgBT,OAmDA,AADA,AAAa,AAAmB,EAAM,UAEtC,OACA,OACA,OACO,EAAM,8DEzEqB,EAiJf,EACA,OA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,KAAW,mBAwapB,AAAa,KACb,AA3mBA,EAAgB,KAAW,KAAW,KAAW,SA4mBjD,AAAI,EAAS,KACX,AAAiB,GAAO,AAlMjB,AAkM0B,UAlMF,AAAI,OAC5B,UAAwB,AAAI,MAAa,IACzC,UAAwB,AAAI,MAAa,KACjB,AAAI,MAAa,QA+LT,MACvC,EAAO,EAAS,KAGd,AAAS,EAAc,AAAiB,AAAM,AAD9C,EAAO,UACgD,YACvD,EAAS,SAEJ,WZhhBX,AAAW,MKvGH,OLuGW,QACnB,AAAW,EAAQ,QACnB,AAAW,EAAQ,QACnB,AAAW,EAAQ,QAEnB,AAAa,KAER,AAAQ,OAAY,EAAK,KAExB,AADJ,AAAqC,IAAhC,OAAS,EAAO,KAAK,SAC1B,AAAoB,EAAc,AAAiB,EAAO,cAF1B,oCFwCf,KACA,qDa3JC,KACA,KACA,KACA,mDT4KD,KACA,qDUvCC,KACA,KACA,KACA,oDV1GlB,EAAgB,KAAW,gCAwN3B,OAAW,AAAI,AADL,AADD,OACM,KACM,QACrB,kCAVA,OAAW,AAAI,AADL,AADD,OACM,KACM,QACrB","sourceRoot":"./bignum.wasm","sourcesContent":["// Alignment guarantees\n\n// @ts-ignore: decorator\n@inline export const AL_BITS: u32 = 4; // 16 bytes to fit up to v128\n// @ts-ignore: decorator\n@inline export const AL_SIZE: usize = 1 << AL_BITS;\n// @ts-ignore: decorator\n@inline export const AL_MASK: usize = AL_SIZE - 1;\n\n// Extra debugging\n\n// @ts-ignore: decorator\n@inline export const DEBUG = true;\n// @ts-ignore: decorator\n@inline export const TRACE = false;\n// @ts-ignore: decorator\n@inline export const RTRACE = isDefined(ASC_RTRACE);\n// @ts-ignore: decorator\n@inline export const PROFILE = isDefined(ASC_PROFILE);\n\n// Memory manager\n\n// ╒════════════ Memory manager block layout (32-bit) ═════════════╕\n// 3 2 1\n// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 bits\n// ├─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┤\n// │ MM info │ -4\n// ╞>ptr═══════════════════════════════════════════════════════════╡\n// │ ... │\n@unmanaged export class BLOCK {\n /** Memory manager info. */\n mmInfo: usize;\n}\n\n/** Overhead of a memory manager block. */\n// @ts-ignore: decorator\n@inline export const BLOCK_OVERHEAD: usize = offsetof();\n\n/** Maximum size of a memory manager block's payload. */\n// @ts-ignore: decorator\n@inline export const BLOCK_MAXSIZE: usize = (1 << 30) - BLOCK_OVERHEAD;\n\n// Garbage collector\n\n// ╒══════════ Garbage collector object layout (32-bit) ═══════════╕\n// 3 2 1\n// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 bits\n// ├─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┤\n// │ Memory manager block │ -20\n// ╞═══════════════════════════════════════════════════════════════╡\n// │ GC info │ -16\n// ├───────────────────────────────────────────────────────────────┤\n// │ GC info │ -12\n// ├───────────────────────────────────────────────────────────────┤\n// │ RT id │ -8\n// ├───────────────────────────────────────────────────────────────┤\n// │ RT size │ -4\n// ╞>ptr═══════════════════════════════════════════════════════════╡\n// │ ... │\n@unmanaged export class OBJECT extends BLOCK {\n /** Garbage collector info. */\n gcInfo: u32;\n /** Garbage collector info. */\n gcInfo2: u32;\n /** Runtime class id. */\n rtId: u32;\n /** Runtime object size. */\n rtSize: u32;\n}\n\n/** Overhead of a garbage collector object. Excludes memory manager block overhead. */\n// @ts-ignore: decorator\n@inline export const OBJECT_OVERHEAD: usize = (offsetof() - BLOCK_OVERHEAD + AL_MASK) & ~AL_MASK;\n\n/** Maximum size of a garbage collector object's payload. */\n// @ts-ignore: decorator\n@inline export const OBJECT_MAXSIZE: usize = BLOCK_MAXSIZE - OBJECT_OVERHEAD;\n\n/** Total of memory manager and garbage collector overhead. */\n// @ts-ignore: decorator\n@inline export const TOTAL_OVERHEAD: usize = BLOCK_OVERHEAD + OBJECT_OVERHEAD;\n","/// \n\nimport { idof } from \"../builtins\";\nimport { CharCode } from \"./string\";\n\n// @ts-ignore: decorator\n@inline\nexport const MAX_DOUBLE_LENGTH = 28;\n\n// @ts-ignore: decorator\n@lazy @inline const POWERS10 = memory.data([\n 1,\n 10,\n 100,\n 1000,\n 10000,\n 100000,\n 1000000,\n 10000000,\n 100000000,\n 1000000000\n]);\n\n/*\n Lookup table for pairwise char codes in range [0-99]\n\n \"00\", \"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\",\n \"10\", \"11\", \"12\", \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", \"19\",\n \"20\", \"21\", \"22\", \"23\", \"24\", \"25\", \"26\", \"27\", \"28\", \"29\",\n \"30\", \"31\", \"32\", \"33\", \"34\", \"35\", \"36\", \"37\", \"38\", \"39\",\n \"40\", \"41\", \"42\", \"43\", \"44\", \"45\", \"46\", \"47\", \"48\", \"49\",\n \"50\", \"51\", \"52\", \"53\", \"54\", \"55\", \"56\", \"57\", \"58\", \"59\",\n \"60\", \"61\", \"62\", \"63\", \"64\", \"65\", \"66\", \"67\", \"68\", \"69\",\n \"70\", \"71\", \"72\", \"73\", \"74\", \"75\", \"76\", \"77\", \"78\", \"79\",\n \"80\", \"81\", \"82\", \"83\", \"84\", \"85\", \"86\", \"87\", \"88\", \"89\",\n \"90\", \"91\", \"92\", \"93\", \"94\", \"95\", \"96\", \"97\", \"98\", \"99\"\n*/\n// @ts-ignore: decorator\n@lazy @inline const DIGITS = memory.data([\n 0x00300030, 0x00310030, 0x00320030, 0x00330030, 0x00340030,\n 0x00350030, 0x00360030, 0x00370030, 0x00380030, 0x00390030,\n 0x00300031, 0x00310031, 0x00320031, 0x00330031, 0x00340031,\n 0x00350031, 0x00360031, 0x00370031, 0x00380031, 0x00390031,\n 0x00300032, 0x00310032, 0x00320032, 0x00330032, 0x00340032,\n 0x00350032, 0x00360032, 0x00370032, 0x00380032, 0x00390032,\n 0x00300033, 0x00310033, 0x00320033, 0x00330033, 0x00340033,\n 0x00350033, 0x00360033, 0x00370033, 0x00380033, 0x00390033,\n 0x00300034, 0x00310034, 0x00320034, 0x00330034, 0x00340034,\n 0x00350034, 0x00360034, 0x00370034, 0x00380034, 0x00390034,\n 0x00300035, 0x00310035, 0x00320035, 0x00330035, 0x00340035,\n 0x00350035, 0x00360035, 0x00370035, 0x00380035, 0x00390035,\n 0x00300036, 0x00310036, 0x00320036, 0x00330036, 0x00340036,\n 0x00350036, 0x00360036, 0x00370036, 0x00380036, 0x00390036,\n 0x00300037, 0x00310037, 0x00320037, 0x00330037, 0x00340037,\n 0x00350037, 0x00360037, 0x00370037, 0x00380037, 0x00390037,\n 0x00300038, 0x00310038, 0x00320038, 0x00330038, 0x00340038,\n 0x00350038, 0x00360038, 0x00370038, 0x00380038, 0x00390038,\n 0x00300039, 0x00310039, 0x00320039, 0x00330039, 0x00340039,\n 0x00350039, 0x00360039, 0x00370039, 0x00380039, 0x00390039\n]);\n\n// Lookup table for pairwise char codes in range [0x00-0xFF]\n// @ts-ignore: decorator\n@lazy @inline const HEX_DIGITS =\n\"000102030405060708090a0b0c0d0e0f\\\n101112131415161718191a1b1c1d1e1f\\\n202122232425262728292a2b2c2d2e2f\\\n303132333435363738393a3b3c3d3e3f\\\n404142434445464748494a4b4c4d4e4f\\\n505152535455565758595a5b5c5d5e5f\\\n606162636465666768696a6b6c6d6e6f\\\n707172737475767778797a7b7c7d7e7f\\\n808182838485868788898a8b8c8d8e8f\\\n909192939495969798999a9b9c9d9e9f\\\na0a1a2a3a4a5a6a7a8a9aaabacadaeaf\\\nb0b1b2b3b4b5b6b7b8b9babbbcbdbebf\\\nc0c1c2c3c4c5c6c7c8c9cacbcccdcecf\\\nd0d1d2d3d4d5d6d7d8d9dadbdcdddedf\\\ne0e1e2e3e4e5e6e7e8e9eaebecedeeef\\\nf0f1f2f3f4f5f6f7f8f9fafbfcfdfeff\";\n\n// @ts-ignore: decorator\n@lazy @inline const ANY_DIGITS = \"0123456789abcdefghijklmnopqrstuvwxyz\";\n\n// @ts-ignore: decorator\n@lazy @inline const EXP_POWERS = memory.data([/* eslint-disable indent */\n -1220, -1193, -1166, -1140, -1113, -1087, -1060, -1034, -1007, -980,\n -954, -927, -901, -874, -847, -821, -794, -768, -741, -715,\n -688, -661, -635, -608, -582, -555, -529, -502, -475, -449,\n -422, -396, -369, -343, -316, -289, -263, -236, -210, -183,\n -157, -130, -103, -77, -50, -24, 3, 30, 56, 83,\n 109, 136, 162, 189, 216, 242, 269, 295, 322, 348,\n 375, 402, 428, 455, 481, 508, 534, 561, 588, 614,\n 641, 667, 694, 720, 747, 774, 800, 827, 853, 880,\n 907, 933, 960, 986, 1013, 1039, 1066\n/* eslint-enable indent */]);\n\n// 1e-348, 1e-340, ..., 1e340\n// @ts-ignore: decorator\n@lazy @inline const FRC_POWERS = memory.data([\n 0xFA8FD5A0081C0288, 0xBAAEE17FA23EBF76, 0x8B16FB203055AC76, 0xCF42894A5DCE35EA,\n 0x9A6BB0AA55653B2D, 0xE61ACF033D1A45DF, 0xAB70FE17C79AC6CA, 0xFF77B1FCBEBCDC4F,\n 0xBE5691EF416BD60C, 0x8DD01FAD907FFC3C, 0xD3515C2831559A83, 0x9D71AC8FADA6C9B5,\n 0xEA9C227723EE8BCB, 0xAECC49914078536D, 0x823C12795DB6CE57, 0xC21094364DFB5637,\n 0x9096EA6F3848984F, 0xD77485CB25823AC7, 0xA086CFCD97BF97F4, 0xEF340A98172AACE5,\n 0xB23867FB2A35B28E, 0x84C8D4DFD2C63F3B, 0xC5DD44271AD3CDBA, 0x936B9FCEBB25C996,\n 0xDBAC6C247D62A584, 0xA3AB66580D5FDAF6, 0xF3E2F893DEC3F126, 0xB5B5ADA8AAFF80B8,\n 0x87625F056C7C4A8B, 0xC9BCFF6034C13053, 0x964E858C91BA2655, 0xDFF9772470297EBD,\n 0xA6DFBD9FB8E5B88F, 0xF8A95FCF88747D94, 0xB94470938FA89BCF, 0x8A08F0F8BF0F156B,\n 0xCDB02555653131B6, 0x993FE2C6D07B7FAC, 0xE45C10C42A2B3B06, 0xAA242499697392D3,\n 0xFD87B5F28300CA0E, 0xBCE5086492111AEB, 0x8CBCCC096F5088CC, 0xD1B71758E219652C,\n 0x9C40000000000000, 0xE8D4A51000000000, 0xAD78EBC5AC620000, 0x813F3978F8940984,\n 0xC097CE7BC90715B3, 0x8F7E32CE7BEA5C70, 0xD5D238A4ABE98068, 0x9F4F2726179A2245,\n 0xED63A231D4C4FB27, 0xB0DE65388CC8ADA8, 0x83C7088E1AAB65DB, 0xC45D1DF942711D9A,\n 0x924D692CA61BE758, 0xDA01EE641A708DEA, 0xA26DA3999AEF774A, 0xF209787BB47D6B85,\n 0xB454E4A179DD1877, 0x865B86925B9BC5C2, 0xC83553C5C8965D3D, 0x952AB45CFA97A0B3,\n 0xDE469FBD99A05FE3, 0xA59BC234DB398C25, 0xF6C69A72A3989F5C, 0xB7DCBF5354E9BECE,\n 0x88FCF317F22241E2, 0xCC20CE9BD35C78A5, 0x98165AF37B2153DF, 0xE2A0B5DC971F303A,\n 0xA8D9D1535CE3B396, 0xFB9B7CD9A4A7443C, 0xBB764C4CA7A44410, 0x8BAB8EEFB6409C1A,\n 0xD01FEF10A657842C, 0x9B10A4E5E9913129, 0xE7109BFBA19C0C9D, 0xAC2820D9623BF429,\n 0x80444B5E7AA7CF85, 0xBF21E44003ACDD2D, 0x8E679C2F5E44FF8F, 0xD433179D9C8CB841,\n 0x9E19DB92B4E31BA9, 0xEB96BF6EBADF77D9, 0xAF87023B9BF0EE6B\n]);\n\n// @ts-ignore: decorator\n@inline\nexport function isPowerOf2(value: T): bool {\n return popcnt(value) == 1;\n}\n\n// Count number of decimals for u32 values\n// In our case input value always non-zero so we can simplify some parts\nexport function decimalCount32(value: u32): u32 {\n if (value < 100000) {\n if (value < 100) {\n return 1 + u32(value >= 10);\n } else {\n return 3 + u32(value >= 10000) + u32(value >= 1000);\n }\n } else {\n if (value < 10000000) {\n return 6 + u32(value >= 1000000);\n } else {\n return 8 + u32(value >= 1000000000) + u32(value >= 100000000);\n }\n }\n}\n\n// Count number of decimals for u64 values\n// In our case input value always greater than 2^32-1 so we can skip some parts\nexport function decimalCount64High(value: u64): u32 {\n if (value < 1000000000000000) {\n if (value < 1000000000000) {\n return 10 + u32(value >= 100000000000) + u32(value >= 10000000000);\n } else {\n return 13 + u32(value >= 100000000000000) + u32(value >= 10000000000000);\n }\n } else {\n if (value < 100000000000000000) {\n return 16 + u32(value >= 10000000000000000);\n } else {\n return 18 + u32(value >= 10000000000000000000) + u32(value >= 1000000000000000000);\n }\n }\n}\n\nfunction ulog_base(num: u64, base: i32): u32 {\n if (isPowerOf2(base)) {\n return (63 - clz(num)) / (31 - clz(base)) + 1;\n }\n var b64 = u64(base), b = b64, e: u32 = 1;\n while (num >= b) {\n num /= b;\n b *= b;\n e <<= 1;\n }\n while (num >= 1) {\n num /= b64;\n e++;\n }\n return e - 1;\n}\n\nfunction utoa32_dec_lut(buffer: usize, num: u32, offset: usize): void {\n while (num >= 10000) {\n // in most VMs i32/u32 div and modulo by constant can be shared and simplificate\n let t = num / 10000;\n let r = num % 10000;\n num = t;\n\n let d1 = r / 100;\n let d2 = r % 100;\n\n let digits1 = load(DIGITS + (d1 << alignof()));\n let digits2 = load(DIGITS + (d2 << alignof()));\n\n offset -= 4;\n store(buffer + (offset << 1), digits1 | (digits2 << 32));\n }\n\n if (num >= 100) {\n let t = num / 100;\n let d1 = num % 100;\n num = t;\n offset -= 2;\n let digits = load(DIGITS + (d1 << alignof()));\n store(buffer + (offset << 1), digits);\n }\n\n if (num >= 10) {\n offset -= 2;\n let digits = load(DIGITS + (num << alignof()));\n store(buffer + (offset << 1), digits);\n } else {\n offset -= 1;\n let digit = CharCode._0 + num;\n store(buffer + (offset << 1), digit);\n }\n}\n\nfunction utoa64_dec_lut(buffer: usize, num: u64, offset: usize): void {\n while (num >= 100000000) {\n let t = num / 100000000;\n let r = (num - t * 100000000);\n num = t;\n\n let b = r / 10000;\n let c = r % 10000;\n\n let b1 = b / 100;\n let b2 = b % 100;\n let c1 = c / 100;\n let c2 = c % 100;\n\n let digits1 = load(DIGITS + (c1 << alignof()));\n let digits2 = load(DIGITS + (c2 << alignof()));\n\n offset -= 4;\n store(buffer + (offset << 1), digits1 | (digits2 << 32));\n\n digits1 = load(DIGITS + (b1 << alignof()));\n digits2 = load(DIGITS + (b2 << alignof()));\n\n offset -= 4;\n store(buffer + (offset << 1), digits1 | (digits2 << 32));\n }\n\n utoa32_dec_lut(buffer, num, offset);\n}\n\nfunction utoa_hex_lut(buffer: usize, num: u64, offset: usize): void {\n const lut = changetype(HEX_DIGITS);\n while (offset >= 2) {\n offset -= 2;\n store(\n buffer + (offset << 1),\n load(lut + ((num & 0xFF) << alignof()))\n );\n num >>= 8;\n }\n if (offset & 1) {\n store(buffer, load(lut + (num << 6)));\n }\n}\n\nfunction utoa_dec_simple(buffer: usize, num: T, offset: usize): void {\n do {\n let t = num / 10;\n let r = (num % 10);\n num = changetype(t);\n offset--;\n store(buffer + (offset << 1), CharCode._0 + r);\n } while (num);\n}\n\nfunction utoa_hex_simple(buffer: usize, num: T, offset: usize): void {\n do {\n let d = num & 0x0F | CharCode._0;\n d += select(0x27, 0, d > CharCode._9);\n offset--;\n store(buffer + (offset << 1), d);\n // @ts-ignore: type\n num >>= 4;\n } while (num);\n}\n\n// @ts-ignore: decorator\n@inline\nexport function utoa32_dec_core(buffer: usize, num: u32, offset: usize): void {\n if (ASC_SHRINK_LEVEL >= 1) {\n utoa_dec_simple(buffer, num, offset);\n } else {\n utoa32_dec_lut(buffer, num, offset);\n }\n}\n\n// @ts-ignore: decorator\n@inline\nfunction utoa32_hex_core(buffer: usize, num: u32, offset: usize): void {\n if (ASC_SHRINK_LEVEL >= 1) {\n utoa_hex_simple(buffer, num, offset);\n } else {\n utoa_hex_lut(buffer, num, offset);\n }\n}\n\n// @ts-ignore: decorator\n@inline\nfunction utoa64_dec_core(buffer: usize, num: u64, offset: usize): void {\n if (ASC_SHRINK_LEVEL >= 1) {\n utoa_dec_simple(buffer, num, offset);\n } else {\n utoa64_dec_lut(buffer, num, offset);\n }\n}\n\n// @ts-ignore: decorator\n@inline\nfunction utoa64_hex_core(buffer: usize, num: u64, offset: usize): void {\n if (ASC_SHRINK_LEVEL >= 1) {\n utoa_hex_simple(buffer, num, offset);\n } else {\n utoa_hex_lut(buffer, num, offset);\n }\n}\n\nfunction utoa64_any_core(buffer: usize, num: u64, offset: usize, radix: i32): void {\n const lut = changetype(ANY_DIGITS);\n var base = u64(radix);\n if ((radix & (radix - 1)) == 0) { // for radix which pow of two\n let shift = u64(ctz(radix) & 7);\n let mask = base - 1;\n do {\n offset--;\n store(buffer + (offset << 1), load(lut + (usize(num & mask) << 1)));\n num >>= shift;\n } while (num);\n } else {\n do {\n offset--;\n let q = num / base;\n store(buffer + (offset << 1), load(lut + (usize(num - q * base) << 1)));\n num = q;\n } while (num);\n }\n}\n\nexport function utoa32(value: u32, radix: i32): String {\n if (radix < 2 || radix > 36) {\n throw new RangeError(\"toString() radix argument must be between 2 and 36\");\n }\n if (!value) return \"0\";\n var out: String;\n\n if (radix == 10) {\n let decimals = decimalCount32(value);\n out = changetype(__new(decimals << 1, idof()));\n utoa32_dec_core(changetype(out), value, decimals);\n } else if (radix == 16) {\n let decimals = (31 - clz(value) >> 2) + 1;\n out = changetype(__new(decimals << 1, idof()));\n utoa32_hex_core(changetype(out), value, decimals);\n } else {\n let decimals = ulog_base(value, radix);\n out = changetype(__new(decimals << 1, idof()));\n utoa64_any_core(changetype(out), value, decimals, radix);\n }\n return out;\n}\n\nexport function itoa32(value: i32, radix: i32): String {\n if (radix < 2 || radix > 36) {\n throw new RangeError(\"toString() radix argument must be between 2 and 36\");\n }\n if (!value) return \"0\";\n\n var sign = value >>> 31;\n if (sign) value = -value;\n var out: String;\n\n if (radix == 10) {\n let decimals = decimalCount32(value) + sign;\n out = changetype(__new(decimals << 1, idof()));\n utoa32_dec_core(changetype(out), value, decimals);\n } else if (radix == 16) {\n let decimals = (31 - clz(value) >> 2) + 1 + sign;\n out = changetype(__new(decimals << 1, idof()));\n utoa32_hex_core(changetype(out), value, decimals);\n } else {\n let val32 = u32(value);\n let decimals = ulog_base(val32, radix) + sign;\n out = changetype(__new(decimals << 1, idof()));\n utoa64_any_core(changetype(out), val32, decimals, radix);\n }\n if (sign) store(changetype(out), CharCode.MINUS);\n return out;\n}\n\nexport function utoa64(value: u64, radix: i32): String {\n if (radix < 2 || radix > 36) {\n throw new RangeError(\"toString() radix argument must be between 2 and 36\");\n }\n if (!value) return \"0\";\n var out: String;\n\n if (radix == 10) {\n if (value <= u32.MAX_VALUE) {\n let val32 = value;\n let decimals = decimalCount32(val32);\n out = changetype(__new(decimals << 1, idof()));\n utoa32_dec_core(changetype(out), val32, decimals);\n } else {\n let decimals = decimalCount64High(value);\n out = changetype(__new(decimals << 1, idof()));\n utoa64_dec_core(changetype(out), value, decimals);\n }\n } else if (radix == 16) {\n let decimals = (63 - u32(clz(value)) >> 2) + 1;\n out = changetype(__new(decimals << 1, idof()));\n utoa64_hex_core(changetype(out), value, decimals);\n } else {\n let decimals = ulog_base(value, radix);\n out = changetype(__new(decimals << 1, idof()));\n utoa64_any_core(changetype(out), value, decimals, radix);\n }\n return out;\n}\n\nexport function itoa64(value: i64, radix: i32): String {\n if (radix < 2 || radix > 36) {\n throw new RangeError(\"toString() radix argument must be between 2 and 36\");\n }\n if (!value) return \"0\";\n\n var sign = u32(value >>> 63);\n if (sign) value = -value;\n var out: String;\n\n if (radix == 10) {\n if (value <= u32.MAX_VALUE) {\n let val32 = value;\n let decimals = decimalCount32(val32) + sign;\n out = changetype(__new(decimals << 1, idof()));\n utoa32_dec_core(changetype(out), val32, decimals);\n } else {\n let decimals = decimalCount64High(value) + sign;\n out = changetype(__new(decimals << 1, idof()));\n utoa64_dec_core(changetype(out), value, decimals);\n }\n } else if (radix == 16) {\n let decimals = (63 - u32(clz(value)) >> 2) + 1 + sign;\n out = changetype(__new(decimals << 1, idof()));\n utoa64_hex_core(changetype(out), value, decimals);\n } else {\n let decimals = ulog_base(value, radix) + sign;\n out = changetype(__new(decimals << 1, idof()));\n utoa64_any_core(changetype(out), value, decimals, radix);\n }\n if (sign) store(changetype(out), CharCode.MINUS);\n return out;\n}\n\n// @ts-ignore: decorator\n@lazy var _K: i32 = 0;\n\n// // @ts-ignore: decorator\n// @lazy\n// var _frc: u64 = 0;\n\n// @ts-ignore: decorator\n@lazy var _exp: i32 = 0;\n\n// @ts-ignore: decorator\n@lazy var _frc_minus: u64 = 0;\n\n// @ts-ignore: decorator\n@lazy var _frc_plus: u64 = 0;\n\n// @ts-ignore: decorator\n@lazy var _frc_pow: u64 = 0;\n\n// @ts-ignore: decorator\n@lazy var _exp_pow: i32 = 0;\n\n// @ts-ignore: decorator\n@inline\nfunction umul64f(u: u64, v: u64): u64 {\n var u0 = u & 0xFFFFFFFF;\n var v0 = v & 0xFFFFFFFF;\n\n var u1 = u >> 32;\n var v1 = v >> 32;\n\n var l = u0 * v0;\n var t = u1 * v0 + (l >> 32);\n var w = u0 * v1 + (t & 0xFFFFFFFF);\n\n w += 0x7FFFFFFF; // rounding\n\n t >>= 32;\n w >>= 32;\n\n return u1 * v1 + t + w;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction umul64e(e1: i32, e2: i32): i32 {\n return e1 + e2 + 64; // where 64 is significand size\n}\n\n// @ts-ignore: decorator\n@inline\nfunction normalizedBoundaries(f: u64, e: i32): void {\n var frc = (f << 1) + 1;\n var exp = e - 1;\n var off = clz(frc);\n frc <<= off;\n exp -= off;\n\n var m = 1 + i32(f == 0x0010000000000000);\n\n _frc_plus = frc;\n _frc_minus = ((f << m) - 1) << e - m - exp;\n _exp = exp;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction grisuRound(buffer: usize, len: i32, delta: u64, rest: u64, ten_kappa: u64, wp_w: u64): void {\n var lastp = buffer + ((len - 1) << 1);\n var digit = load(lastp);\n while (\n rest < wp_w &&\n delta - rest >= ten_kappa && (\n rest + ten_kappa < wp_w ||\n wp_w - rest > rest + ten_kappa - wp_w\n )\n ) {\n --digit;\n rest += ten_kappa;\n }\n store(lastp, digit);\n}\n\n// @ts-ignore: decorator\n@inline\nfunction getCachedPower(minExp: i32): void {\n const c = reinterpret(0x3FD34413509F79FE); // 1 / lg(10) = 0.30102999566398114\n var dk = (-61 - minExp) * c + 347;\t // dk must be positive, so can do ceiling in positive\n var k = dk;\n k += i32(k != dk); // conversion with ceil\n\n var index = (k >> 3) + 1;\n _K = 348 - (index << 3);\t// decimal exponent no need lookup table\n _frc_pow = load(FRC_POWERS + (index << alignof()));\n _exp_pow = load(EXP_POWERS + (index << alignof()));\n}\n\n// @ts-ignore: decorator\n@inline\nfunction grisu2(value: f64, buffer: usize, sign: i32): i32 {\n\n // frexp routine\n var uv = reinterpret(value);\n var exp = i32((uv & 0x7FF0000000000000) >>> 52);\n var sid = uv & 0x000FFFFFFFFFFFFF;\n var frc = (u64(exp != 0) << 52) + sid;\n exp = select(exp, 1, exp) - (0x3FF + 52);\n\n normalizedBoundaries(frc, exp);\n getCachedPower(_exp);\n\n // normalize\n var off = clz(frc);\n frc <<= off;\n exp -= off;\n\n var frc_pow = _frc_pow;\n var exp_pow = _exp_pow;\n\n var w_frc = umul64f(frc, frc_pow);\n var w_exp = umul64e(exp, exp_pow);\n\n var wp_frc = umul64f(_frc_plus, frc_pow) - 1;\n var wp_exp = umul64e(_exp, exp_pow);\n\n var wm_frc = umul64f(_frc_minus, frc_pow) + 1;\n var delta = wp_frc - wm_frc;\n\n return genDigits(buffer, w_frc, w_exp, wp_frc, wp_exp, delta, sign);\n}\n\nfunction genDigits(buffer: usize, w_frc: u64, w_exp: i32, mp_frc: u64, mp_exp: i32, delta: u64, sign: i32): i32 {\n var one_exp = -mp_exp;\n var one_frc = (1) << one_exp;\n var mask = one_frc - 1;\n\n var wp_w_frc = mp_frc - w_frc;\n\n var p1 = u32(mp_frc >> one_exp);\n var p2 = mp_frc & mask;\n\n var kappa = decimalCount32(p1);\n var len = sign;\n\n while (kappa > 0) {\n let d: u32;\n switch (kappa) {\n case 10: { d = p1 / 1000000000; p1 %= 1000000000; break; }\n case 9: { d = p1 / 100000000; p1 %= 100000000; break; }\n case 8: { d = p1 / 10000000; p1 %= 10000000; break; }\n case 7: { d = p1 / 1000000; p1 %= 1000000; break; }\n case 6: { d = p1 / 100000; p1 %= 100000; break; }\n case 5: { d = p1 / 10000; p1 %= 10000; break; }\n case 4: { d = p1 / 1000; p1 %= 1000; break; }\n case 3: { d = p1 / 100; p1 %= 100; break; }\n case 2: { d = p1 / 10; p1 %= 10; break; }\n case 1: { d = p1; p1 = 0; break; }\n default: { d = 0; break; }\n }\n\n if (d | len) store(buffer + (len++ << 1), CharCode._0 + d);\n\n --kappa;\n let tmp = ((p1) << one_exp) + p2;\n if (tmp <= delta) {\n _K += kappa;\n grisuRound(buffer, len, delta, tmp, load(POWERS10 + (kappa << alignof())) << one_exp, wp_w_frc);\n return len;\n }\n }\n\n while (true) {\n p2 *= 10;\n delta *= 10;\n\n let d = p2 >> one_exp;\n if (d | len) store(buffer + (len++ << 1), CharCode._0 + d);\n\n p2 &= mask;\n --kappa;\n if (p2 < delta) {\n _K += kappa;\n wp_w_frc *= load(POWERS10 + (-kappa << alignof()));\n grisuRound(buffer, len, delta, p2, one_frc, wp_w_frc);\n return len;\n }\n }\n}\n\n// @ts-ignore: decorator\n@inline\nfunction genExponent(buffer: usize, k: i32): i32 {\n var sign = k < 0;\n if (sign) k = -k;\n var decimals = decimalCount32(k) + 1;\n utoa32_dec_core(buffer, k, decimals);\n store(buffer, select(CharCode.MINUS, CharCode.PLUS, sign));\n return decimals;\n}\n\nfunction prettify(buffer: usize, length: i32, k: i32): i32 {\n if (!k) {\n store(buffer + (length << 1), CharCode.DOT | (CharCode._0 << 16));\n return length + 2;\n }\n\n var kk = length + k;\n if (length <= kk && kk <= 21) {\n // 1234e7 -> 12340000000\n for (let i = length; i < kk; ++i) {\n store(buffer + (i << 1), CharCode._0);\n }\n store(buffer + (kk << 1), CharCode.DOT | (CharCode._0 << 16));\n return kk + 2;\n } else if (kk > 0 && kk <= 21) {\n // 1234e-2 -> 12.34\n let ptr = buffer + (kk << 1);\n memory.copy(\n ptr + 2,\n ptr,\n -k << 1\n );\n store(buffer + (kk << 1), CharCode.DOT);\n return length + 1;\n } else if (-6 < kk && kk <= 0) {\n // 1234e-6 -> 0.001234\n let offset = 2 - kk;\n memory.copy(\n buffer + (offset << 1),\n buffer,\n length << 1\n );\n store(buffer, CharCode._0 | (CharCode.DOT << 16));\n for (let i = 2; i < offset; ++i) {\n store(buffer + (i << 1), CharCode._0);\n }\n return length + offset;\n } else if (length == 1) {\n // 1e30\n store(buffer, CharCode.e, 2);\n length = genExponent(buffer + 4, kk - 1);\n return length + 2;\n } else {\n let len = length << 1;\n memory.copy(\n buffer + 4,\n buffer + 2,\n len - 2\n );\n store(buffer, CharCode.DOT, 2);\n store(buffer + len, CharCode.e, 2);\n length += genExponent(buffer + len + 4, kk - 1);\n return length + 2;\n }\n}\n\nfunction dtoa_core(buffer: usize, value: f64): i32 {\n var sign = i32(value < 0);\n if (sign) {\n value = -value;\n store(buffer, CharCode.MINUS);\n }\n // assert(value > 0 && value <= 1.7976931348623157e308);\n var len = grisu2(value, buffer, sign);\n len = prettify(buffer + (sign << 1), len - sign, _K);\n return len + sign;\n}\n\n// @ts-ignore: decorator\n@lazy @inline const dtoa_buf = memory.data(MAX_DOUBLE_LENGTH << 1);\n\nexport function dtoa(value: f64): String {\n if (value == 0) return \"0.0\";\n if (!isFinite(value)) {\n if (isNaN(value)) return \"NaN\";\n return select(\"-Infinity\", \"Infinity\", value < 0);\n }\n var size = dtoa_core(dtoa_buf, value) << 1;\n var result = changetype(__new(size, idof()));\n memory.copy(changetype(result), dtoa_buf, size);\n return result;\n}\n\nexport function itoa_buffered(buffer: usize, value: T): u32 {\n var sign: u32 = 0;\n if (isSigned()) {\n sign = u32(value < 0);\n if (sign) {\n value = changetype(-value);\n store(buffer, CharCode.MINUS);\n }\n }\n if (ASC_SHRINK_LEVEL <= 1) {\n if (isSigned()) {\n if (sizeof() <= 4) {\n if (value < 10) {\n store(buffer + (sign << 1), value | CharCode._0);\n return 1 + sign;\n }\n } else {\n if (value < 10) {\n store(buffer + (sign << 1), value | CharCode._0);\n return 1 + sign;\n }\n }\n } else {\n if (value < 10) {\n store(buffer, value | CharCode._0);\n return 1;\n }\n }\n }\n var decimals = sign;\n if (sizeof() <= 4) {\n decimals += decimalCount32(value);\n utoa32_dec_core(buffer, value, decimals);\n } else {\n if (value <= u32.MAX_VALUE) {\n let val32 = value;\n decimals += decimalCount32(val32);\n utoa32_dec_core(buffer, val32, decimals);\n } else {\n decimals += decimalCount64High(value);\n utoa64_dec_core(buffer, value, decimals);\n }\n }\n return decimals;\n}\n\nexport function dtoa_buffered(buffer: usize, value: f64): u32 {\n if (value == 0) {\n store(buffer, CharCode._0);\n store(buffer, CharCode.DOT, 2);\n store(buffer, CharCode._0, 4);\n return 3;\n }\n if (!isFinite(value)) {\n if (isNaN(value)) {\n store(buffer, CharCode.N);\n store(buffer, CharCode.a, 2);\n store(buffer, CharCode.N, 4);\n return 3;\n } else {\n let sign = value < 0;\n if (sign) {\n store(buffer, CharCode.MINUS); // -\n buffer += 2;\n }\n store(buffer, 0x690066006E0049, 0); // ifnI\n store(buffer, 0x7900740069006E, 8); // ytin\n return 8 + u32(sign);\n }\n }\n return dtoa_core(buffer, value);\n}\n","//\n// Lookup data for exp2f\n//\n\n// @ts-ignore: decorator\n@inline const EXP2F_TABLE_BITS = 5;\n\n// @ts-ignore: decorator\n@lazy @inline const EXP2F_DATA_TAB = memory.data([\n // exp2f_data_tab[i] = uint(2^(i/N)) - (i << 52-BITS)\n // used for computing 2^(k/N) for an int |k| < 150 N as\n // double(tab[k%N] + (k << 52-BITS))\n 0x3FF0000000000000, 0x3FEFD9B0D3158574, 0x3FEFB5586CF9890F, 0x3FEF9301D0125B51,\n 0x3FEF72B83C7D517B, 0x3FEF54873168B9AA, 0x3FEF387A6E756238, 0x3FEF1E9DF51FDEE1,\n 0x3FEF06FE0A31B715, 0x3FEEF1A7373AA9CB, 0x3FEEDEA64C123422, 0x3FEECE086061892D,\n 0x3FEEBFDAD5362A27, 0x3FEEB42B569D4F82, 0x3FEEAB07DD485429, 0x3FEEA47EB03A5585,\n 0x3FEEA09E667F3BCD, 0x3FEE9F75E8EC5F74, 0x3FEEA11473EB0187, 0x3FEEA589994CCE13,\n 0x3FEEACE5422AA0DB, 0x3FEEB737B0CDC5E5, 0x3FEEC49182A3F090, 0x3FEED503B23E255D,\n 0x3FEEE89F995AD3AD, 0x3FEEFF76F2FB5E47, 0x3FEF199BDD85529C, 0x3FEF3720DCEF9069,\n 0x3FEF5818DCFBA487, 0x3FEF7C97337B9B5F, 0x3FEFA4AFA2A490DA, 0x3FEFD0765B6E4540\n]);\n\n// ULP error: 0.502 (nearest rounding.)\n// Relative error: 1.69 * 2^-34 in [-1/64, 1/64] (before rounding.)\n// Wrong count: 168353 (all nearest rounding wrong results with fma.)\n// @ts-ignore: decorator\n@inline\nexport function exp2f_lut(x: f32): f32 {\n const\n N = 1 << EXP2F_TABLE_BITS,\n N_MASK = N - 1,\n shift = reinterpret(0x4338000000000000) / N, // 0x1.8p+52\n Ox127f = reinterpret(0x7F000000);\n\n const\n C0 = reinterpret(0x3FAC6AF84B912394), // 0x1.c6af84b912394p-5\n C1 = reinterpret(0x3FCEBFCE50FAC4F3), // 0x1.ebfce50fac4f3p-3\n C2 = reinterpret(0x3FE62E42FF0C52D6); // 0x1.62e42ff0c52d6p-1\n\n var xd = x;\n var ix = reinterpret(x);\n var ux = ix >> 20 & 0x7FF;\n if (ux >= 0x430) {\n // |x| >= 128 or x is nan.\n if (ix == 0xFF800000) return 0; // x == -Inf -> 0\n if (ux >= 0x7F8) return x + x; // x == Inf/NaN -> Inf/NaN\n if (x > 0) return x * Ox127f; // x > 0 -> HugeVal (Owerflow)\n if (x <= -150) return 0; // x <= -150 -> 0 (Underflow)\n }\n\n // x = k/N + r with r in [-1/(2N), 1/(2N)] and int k.\n var kd = xd + shift;\n var ki = reinterpret(kd);\n var r = xd - (kd - shift);\n var t: u64, y: f64, s: f64;\n\n // exp2(x) = 2^(k/N) * 2^r ~= s * (C0*r^3 + C1*r^2 + C2*r + 1)\n t = load(EXP2F_DATA_TAB + ((ki & N_MASK) << alignof()));\n t += ki << (52 - EXP2F_TABLE_BITS);\n s = reinterpret(t);\n y = C2 * r + 1;\n y += (C0 * r + C1) * (r * r);\n y *= s;\n\n return y;\n}\n\n// ULP error: 0.502 (nearest rounding.)\n// Relative error: 1.69 * 2^-34 in [-ln2/64, ln2/64] (before rounding.)\n// Wrong count: 170635 (all nearest rounding wrong results with fma.)\n// @ts-ignore: decorator\n@inline\nexport function expf_lut(x: f32): f32 {\n const\n N = 1 << EXP2F_TABLE_BITS,\n N_MASK = N - 1,\n shift = reinterpret(0x4338000000000000), // 0x1.8p+52\n InvLn2N = reinterpret(0x3FF71547652B82FE) * N, // 0x1.71547652b82fep+0\n Ox1p127f = reinterpret(0x7F000000);\n\n const\n C0 = reinterpret(0x3FAC6AF84B912394) / N / N / N, // 0x1.c6af84b912394p-5\n C1 = reinterpret(0x3FCEBFCE50FAC4F3) / N / N, // 0x1.ebfce50fac4f3p-3\n C2 = reinterpret(0x3FE62E42FF0C52D6) / N; // 0x1.62e42ff0c52d6p-1\n\n var xd = x;\n var ix = reinterpret(x);\n var ux = ix >> 20 & 0x7FF;\n if (ux >= 0x42B) {\n // |x| >= 88 or x is nan.\n if (ix == 0xFF800000) return 0; // x == -Inf -> 0\n if (ux >= 0x7F8) return x + x; // x == Inf/NaN -> Inf/NaN\n if (x > reinterpret(0x42B17217)) return x * Ox1p127f; // x > log(0x1p128) ~= 88.72 -> HugeVal (Owerflow)\n if (x < reinterpret(0xC2CFF1B4)) return 0; // x < log(0x1p-150) ~= -103.97 -> 0 (Underflow)\n }\n\n // x*N/Ln2 = k + r with r in [-1/2, 1/2] and int k.\n var z = InvLn2N * xd;\n\n // Round and convert z to int, the result is in [-150*N, 128*N] and\n // ideally ties-to-even rule is used, otherwise the magnitude of r\n // can be bigger which gives larger approximation error.\n var kd = (z + shift);\n var ki = reinterpret(kd);\n var r = z - (kd - shift);\n var s: f64, y: f64, t: u64;\n\n // exp(x) = 2^(k/N) * 2^(r/N) ~= s * (C0*r^3 + C1*r^2 + C2*r + 1)\n t = load(EXP2F_DATA_TAB + ((ki & N_MASK) << alignof()));\n t += ki << (52 - EXP2F_TABLE_BITS);\n s = reinterpret(t);\n z = C0 * r + C1;\n y = C2 * r + 1;\n y += z * (r * r);\n y *= s;\n\n return y;\n}\n\n//\n// Lookup data for log2f\n//\n\n// @ts-ignore: decorator\n@inline const LOG2F_TABLE_BITS = 4;\n\n// @ts-ignore: decorator\n@lazy @inline const LOG2F_DATA_TAB = memory.data([\n reinterpret(0x3FF661EC79F8F3BE), reinterpret(0xBFDEFEC65B963019), // 0x1.661ec79f8f3bep+0, -0x1.efec65b963019p-2,\n reinterpret(0x3FF571ED4AAF883D), reinterpret(0xBFDB0B6832D4FCA4), // 0x1.571ed4aaf883dp+0, -0x1.b0b6832d4fca4p-2,\n reinterpret(0x3FF49539F0F010B0), reinterpret(0xBFD7418B0A1FB77B), // 0x1.49539f0f010bp+0 , -0x1.7418b0a1fb77bp-2,\n reinterpret(0x3FF3C995B0B80385), reinterpret(0xBFD39DE91A6DCF7B), // 0x1.3c995b0b80385p+0, -0x1.39de91a6dcf7bp-2,\n reinterpret(0x3FF30D190C8864A5), reinterpret(0xBFD01D9BF3F2B631), // 0x1.30d190c8864a5p+0, -0x1.01d9bf3f2b631p-2,\n reinterpret(0x3FF25E227B0B8EA0), reinterpret(0xBFC97C1D1B3B7AF0), // 0x1.25e227b0b8eap+0 , -0x1.97c1d1b3b7afp-3 ,\n reinterpret(0x3FF1BB4A4A1A343F), reinterpret(0xBFC2F9E393AF3C9F), // 0x1.1bb4a4a1a343fp+0, -0x1.2f9e393af3c9fp-3,\n reinterpret(0x3FF12358F08AE5BA), reinterpret(0xBFB960CBBF788D5C), // 0x1.12358f08ae5bap+0, -0x1.960cbbf788d5cp-4,\n reinterpret(0x3FF0953F419900A7), reinterpret(0xBFAA6F9DB6475FCE), // 0x1.0953f419900a7p+0, -0x1.a6f9db6475fcep-5,\n reinterpret(0x3FF0000000000000), 0, // 0x1p+0, 0x0,\n reinterpret(0x3FEE608CFD9A47AC), reinterpret(0x3FB338CA9F24F53D), // 0x1.e608cfd9a47acp-1, 0x1.338ca9f24f53dp-4,\n reinterpret(0x3FECA4B31F026AA0), reinterpret(0x3FC476A9543891BA), // 0x1.ca4b31f026aap-1 , 0x1.476a9543891bap-3,\n reinterpret(0x3FEB2036576AFCE6), reinterpret(0x3FCE840B4AC4E4D2), // 0x1.b2036576afce6p-1, 0x1.e840b4ac4e4d2p-3,\n reinterpret(0x3FE9C2D163A1AA2D), reinterpret(0x3FD40645F0C6651C), // 0x1.9c2d163a1aa2dp-1, 0x1.40645f0c6651cp-2,\n reinterpret(0x3FE886E6037841ED), reinterpret(0x3FD88E9C2C1B9FF8), // 0x1.886e6037841edp-1, 0x1.88e9c2c1b9ff8p-2,\n reinterpret(0x3FE767DCF5534862), reinterpret(0x3FDCE0A44EB17BCC) // 0x1.767dcf5534862p-1, 0x1.ce0a44eb17bccp-2\n]);\n\n// ULP error: 0.752 (nearest rounding.)\n// Relative error: 1.9 * 2^-26 (before rounding.)\n// @ts-ignore: decorator\n@inline\nexport function log2f_lut(x: f32): f32 {\n const\n N_MASK = (1 << LOG2F_TABLE_BITS) - 1,\n Ox1p23f = reinterpret(0x4B000000); // 0x1p23f\n\n const\n A0 = reinterpret(0xBFD712B6F70A7E4D), // -0x1.712b6f70a7e4dp-2\n A1 = reinterpret(0x3FDECABF496832E0), // 0x1.ecabf496832ep-2\n A2 = reinterpret(0xBFE715479FFAE3DE), // -0x1.715479ffae3dep-1\n A3 = reinterpret(0x3FF715475F35C8B8); // 0x1.715475f35c8b8p0\n\n var ux = reinterpret(x);\n // Fix sign of zero with downward rounding when x==1.\n // if (WANT_ROUNDING && predict_false(ix == 0x3f800000)) return 0;\n if (ux - 0x00800000 >= 0x7F800000 - 0x00800000) {\n // x < 0x1p-126 or inf or nan.\n if (ux * 2 == 0) return -Infinity;\n if (ux == 0x7F800000) return x; // log2(inf) == inf.\n if ((ux >> 31) || ux * 2 >= 0xFF000000) return (x - x) / (x - x);\n // x is subnormal, normalize it.\n ux = reinterpret(x * Ox1p23f);\n ux -= 23 << 23;\n }\n // x = 2^k z; where z is in range [OFF,2*OFF] and exact.\n // The range is split into N subintervals.\n // The ith subinterval contains z and c is near its center.\n var tmp = ux - 0x3F330000;\n var i = (tmp >> (23 - LOG2F_TABLE_BITS)) & N_MASK;\n var top = tmp & 0xFF800000;\n var iz = ux - top;\n var k = tmp >> 23;\n\n var invc = load(LOG2F_DATA_TAB + (i << (1 + alignof())), 0 << alignof());\n var logc = load(LOG2F_DATA_TAB + (i << (1 + alignof())), 1 << alignof());\n var z = reinterpret(iz);\n\n // log2(x) = log1p(z/c-1)/ln2 + log2(c) + k\n var r = z * invc - 1;\n var y0 = logc + k;\n\n // Pipelined polynomial evaluation to approximate log1p(r)/ln2.\n var y = A1 * r + A2;\n var p = A3 * r + y0;\n var r2 = r * r;\n y += A0 * r2;\n y = y * r2 + p;\n\n return y;\n}\n\n//\n// Lookup data for logf. See: https://git.musl-libc.org/cgit/musl/tree/src/math/logf.c\n//\n\n// @ts-ignore: decorator\n@inline const LOGF_TABLE_BITS = 4;\n\n// @ts-ignore: decorator\n@lazy @inline const LOGF_DATA_TAB = memory.data([\n reinterpret(0x3FF661EC79F8F3BE), reinterpret(0xBFD57BF7808CAADE), // 0x1.661ec79f8f3bep+0, -0x1.57bf7808caadep-2,\n reinterpret(0x3FF571ED4AAF883D), reinterpret(0xBFD2BEF0A7C06DDB), // 0x1.571ed4aaf883dp+0, -0x1.2bef0a7c06ddbp-2,\n reinterpret(0x3FF49539F0F010B0), reinterpret(0xBFD01EAE7F513A67), // 0x1.49539f0f010bp+0 , -0x1.01eae7f513a67p-2,\n reinterpret(0x3FF3C995B0B80385), reinterpret(0xBFCB31D8A68224E9), // 0x1.3c995b0b80385p+0, -0x1.b31d8a68224e9p-3,\n reinterpret(0x3FF30D190C8864A5), reinterpret(0xBFC6574F0AC07758), // 0x1.30d190c8864a5p+0, -0x1.6574f0ac07758p-3,\n reinterpret(0x3FF25E227B0B8EA0), reinterpret(0xBFC1AA2BC79C8100), // 0x1.25e227b0b8eap+0 , -0x1.1aa2bc79c81p-3 ,\n reinterpret(0x3FF1BB4A4A1A343F), reinterpret(0xBFBA4E76CE8C0E5E), // 0x1.1bb4a4a1a343fp+0, -0x1.a4e76ce8c0e5ep-4,\n reinterpret(0x3FF12358F08AE5BA), reinterpret(0xBFB1973C5A611CCC), // 0x1.12358f08ae5bap+0, -0x1.1973c5a611cccp-4,\n reinterpret(0x3FF0953F419900A7), reinterpret(0xBFA252F438E10C1E), // 0x1.0953f419900a7p+0, -0x1.252f438e10c1ep-5,\n reinterpret(0x3FF0000000000000), 0, // 0x1p+0, 0,\n reinterpret(0x3FEE608CFD9A47AC), reinterpret(0x3FAAA5AA5DF25984), // 0x1.e608cfd9a47acp-1, 0x1.aa5aa5df25984p-5,\n reinterpret(0x3FECA4B31F026AA0), reinterpret(0x3FBC5E53AA362EB4), // 0x1.ca4b31f026aap-1 , 0x1.c5e53aa362eb4p-4,\n reinterpret(0x3FEB2036576AFCE6), reinterpret(0x3FC526E57720DB08), // 0x1.b2036576afce6p-1, 0x1.526e57720db08p-3,\n reinterpret(0x3FE9C2D163A1AA2D), reinterpret(0x3FCBC2860D224770), // 0x1.9c2d163a1aa2dp-1, 0x1.bc2860d22477p-3 ,\n reinterpret(0x3FE886E6037841ED), reinterpret(0x3FD1058BC8A07EE1), // 0x1.886e6037841edp-1, 0x1.1058bc8a07ee1p-2,\n reinterpret(0x3FE767DCF5534862), reinterpret(0x3FD4043057B6EE09) // 0x1.767dcf5534862p-1, 0x1.4043057b6ee09p-2\n]);\n\n// ULP error: 0.818 (nearest rounding.)\n// Relative error: 1.957 * 2^-26 (before rounding.)\n// @ts-ignore: decorator\n@inline\nexport function logf_lut(x: f32): f32 {\n const\n N_MASK = (1 << LOGF_TABLE_BITS) - 1,\n Ox1p23f = reinterpret(0x4B000000); // 0x1p23f\n\n const\n Ln2 = reinterpret(0x3FE62E42FEFA39EF), // 0x1.62e42fefa39efp-1;\n A0 = reinterpret(0xBFD00EA348B88334), // -0x1.00ea348b88334p-2\n A1 = reinterpret(0x3FD5575B0BE00B6A), // 0x1.5575b0be00b6ap-2\n A2 = reinterpret(0xBFDFFFFEF20A4123); // -0x1.ffffef20a4123p-2\n\n var ux = reinterpret(x);\n // Fix sign of zero with downward rounding when x==1.\n // if (WANT_ROUNDING && ux == 0x3f800000) return 0;\n if (ux - 0x00800000 >= 0x7F800000 - 0x00800000) {\n // x < 0x1p-126 or inf or nan.\n if ((ux << 1) == 0) return -Infinity;\n if (ux == 0x7F800000) return x; // log(inf) == inf.\n if ((ux >> 31) || (ux << 1) >= 0xFF000000) return (x - x) / (x - x);\n // x is subnormal, normalize it.\n ux = reinterpret(x * Ox1p23f);\n ux -= 23 << 23;\n }\n // x = 2^k z; where z is in range [OFF,2*OFF] and exact.\n // The range is split into N subintervals.\n // The ith subinterval contains z and c is near its center.\n var tmp = ux - 0x3F330000;\n var i = (tmp >> (23 - LOGF_TABLE_BITS)) & N_MASK;\n var k = tmp >> 23;\n var iz = ux - (tmp & 0x1FF << 23);\n\n var invc = load(LOGF_DATA_TAB + (i << (1 + alignof())), 0 << alignof());\n var logc = load(LOGF_DATA_TAB + (i << (1 + alignof())), 1 << alignof());\n\n var z = reinterpret(iz);\n\n // log(x) = log1p(z/c-1) + log(c) + k*Ln2\n var r = z * invc - 1;\n var y0 = logc + k * Ln2;\n\n // Pipelined polynomial evaluation to approximate log1p(r).\n var r2 = r * r;\n var y = A1 * r + A2;\n y += A0 * r2;\n y = y * r2 + (y0 + r);\n\n return y;\n}\n\n//\n// Lookup data for powf. See: https://git.musl-libc.org/cgit/musl/tree/src/math/powf.c\n//\n\n// @ts-ignore: decorator\n@inline\nfunction zeroinfnanf(ux: u32): bool {\n return (ux << 1) - 1 >= (0x7f800000 << 1) - 1;\n}\n\n// Returns 0 if not int, 1 if odd int, 2 if even int. The argument is\n// the bit representation of a non-zero finite floating-point value.\n// @ts-ignore: decorator\n@inline\nfunction checkintf(iy: u32): i32 {\n var e = iy >> 23 & 0xFF;\n if (e < 0x7F ) return 0;\n if (e > 0x7F + 23) return 2;\n e = 1 << (0x7F + 23 - e);\n if (iy & (e - 1)) return 0;\n if (iy & e ) return 1;\n return 2;\n}\n\n// Subnormal input is normalized so ix has negative biased exponent.\n// Output is multiplied by N (POWF_SCALE) if TOINT_INTRINICS is set.\n// @ts-ignore: decorator\n@inline\nfunction log2f_inline(ux: u32): f64 {\n const N_MASK = (1 << LOG2F_TABLE_BITS) - 1;\n\n const\n A0 = reinterpret(0x3FD27616C9496E0B), // 0x1.27616c9496e0bp-2\n A1 = reinterpret(0xBFD71969A075C67A), // -0x1.71969a075c67ap-2\n A2 = reinterpret(0x3FDEC70A6CA7BADD), // 0x1.ec70a6ca7baddp-2\n A3 = reinterpret(0xBFE7154748BEF6C8), // -0x1.7154748bef6c8p-1\n A4 = reinterpret(0x3FF71547652AB82B); // 0x1.71547652ab82bp+0\n\n // x = 2^k z; where z is in range [OFF,2*OFF] and exact.\n // The range is split into N subintervals.\n // The ith subinterval contains z and c is near its center.\n var tmp = ux - 0x3F330000;\n var i = ((tmp >> (23 - LOG2F_TABLE_BITS)) & N_MASK);\n var top = tmp & 0xFF800000;\n var uz = ux - top;\n var k = (top >> 23);\n\n var invc = load(LOG2F_DATA_TAB + (i << (1 + alignof())), 0 << alignof());\n var logc = load(LOG2F_DATA_TAB + (i << (1 + alignof())), 1 << alignof());\n var z = reinterpret(uz);\n\n // log2(x) = log1p(z/c-1)/ln2 + log2(c) + k\n var r = z * invc - 1;\n var y0 = logc + k;\n\n // Pipelined polynomial evaluation to approximate log1p(r)/ln2.\n var y = A0 * r + A1;\n var p = A2 * r + A3;\n var q = A4 * r + y0;\n\n r *= r;\n q += p * r;\n y = y * (r * r) + q;\n\n return y;\n}\n\n// The output of log2 and thus the input of exp2 is either scaled by N\n// (in case of fast toint intrinsics) or not. The unscaled xd must be\n// in [-1021,1023], sign_bias sets the sign of the result.\n// @ts-ignore: decorator\n@inline\nfunction exp2f_inline(xd: f64, signBias: u32): f32 {\n const\n N = 1 << EXP2F_TABLE_BITS,\n N_MASK = N - 1,\n shift = reinterpret(0x4338000000000000) / N; // 0x1.8p+52\n\n const\n C0 = reinterpret(0x3FAC6AF84B912394), // 0x1.c6af84b912394p-5\n C1 = reinterpret(0x3FCEBFCE50FAC4F3), // 0x1.ebfce50fac4f3p-3\n C2 = reinterpret(0x3FE62E42FF0C52D6); // 0x1.62e42ff0c52d6p-1\n\n // x = k/N + r with r in [-1/(2N), 1/(2N)]\n var kd = (xd + shift);\n var ki = reinterpret(kd);\n var r = xd - (kd - shift);\n var t: u64, z: f64, y: f64, s: f64;\n\n // exp2(x) = 2^(k/N) * 2^r ~= s * (C0*r^3 + C1*r^2 + C2*r + 1)\n t = load(EXP2F_DATA_TAB + ((ki & N_MASK) << alignof()));\n t += (ki + signBias) << (52 - EXP2F_TABLE_BITS);\n s = reinterpret(t);\n z = C0 * r + C1;\n y = C2 * r + 1;\n y += z * (r * r);\n y *= s;\n return y;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction xflowf(sign: u32, y: f32): f32 {\n return select(-y, y, sign) * y;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction oflowf(sign: u32): f32 {\n return xflowf(sign, reinterpret(0x70000000)); // 0x1p97f\n}\n\n// @ts-ignore: decorator\n@inline\nfunction uflowf(sign: u32): f32 {\n return xflowf(sign, reinterpret(0x10000000)); // 0x1p-95f\n}\n\n// @ts-ignore: decorator\n@inline\nexport function powf_lut(x: f32, y: f32): f32 {\n const\n Ox1p23f = reinterpret(0x4B000000), // 0x1p23f\n UPPER_LIMIT = reinterpret(0x405FFFFFFFD1D571), // 0x1.fffffffd1d571p+6\n LOWER_LIMIT = -150.0,\n SIGN_BIAS = 1 << (EXP2F_TABLE_BITS + 11);\n\n var signBias: u32 = 0;\n var ix = reinterpret(x);\n var iy = reinterpret(y);\n var ny = 0;\n\n if (i32(ix - 0x00800000 >= 0x7f800000 - 0x00800000) | (ny = i32(zeroinfnanf(iy)))) {\n // Either (x < 0x1p-126 or inf or nan) or (y is 0 or inf or nan).\n if (ny) {\n if ((iy << 1) == 0) return 1.0;\n if (ix == 0x3F800000) return NaN; // original: 1.0\n if ((ix << 1) > (0x7F800000 << 1) || (iy << 1) > (0x7F800000 << 1)) return x + y;\n if ((ix << 1) == (0x3F800000 << 1)) return NaN; // original: 1.0\n if (((ix << 1) < (0x3F800000 << 1)) == !(iy >> 31)) return 0; // |x| < 1 && y==inf or |x| > 1 && y==-inf.\n return y * y;\n }\n if (zeroinfnanf(ix)) {\n let x2 = x * x;\n if ((ix >> 31) && checkintf(iy) == 1) x2 = -x2;\n return iy >> 31 ? 1 / x2 : x2;\n }\n // x and y are non-zero finite.\n if (ix >> 31) {\n // Finite x < 0.\n let yint = checkintf(iy);\n if (yint == 0) return (x - x) / (x - x);\n if (yint == 1) signBias = SIGN_BIAS;\n ix &= 0x7FFFFFFF;\n }\n if (ix < 0x00800000) {\n // Normalize subnormal x so exponent becomes negative.\n ix = reinterpret(x * Ox1p23f);\n ix &= 0x7FFFFFFF;\n ix -= 23 << 23;\n }\n }\n var logx = log2f_inline(ix);\n var ylogx = y * logx; // cannot overflow, y is single prec.\n if ((reinterpret(ylogx) >> 47 & 0xFFFF) >= 0x80BF) { // reinterpret(126.0) >> 47\n // |y * log(x)| >= 126\n if (ylogx > UPPER_LIMIT) return oflowf(signBias); // overflow\n if (ylogx <= LOWER_LIMIT) return uflowf(signBias); // underflow\n }\n return exp2f_inline(ylogx, signBias);\n}\n\n//\n// Lookup data for exp. See: https://git.musl-libc.org/cgit/musl/tree/src/math/exp.c\n//\n\n// @ts-ignore: decorator\n@inline const EXP_TABLE_BITS = 7;\n\n// @ts-ignore: decorator\n@lazy @inline const EXP_DATA_TAB = memory.data([\n 0x0000000000000000, 0x3FF0000000000000,\n 0x3C9B3B4F1A88BF6E, 0x3FEFF63DA9FB3335,\n 0xBC7160139CD8DC5D, 0x3FEFEC9A3E778061,\n 0xBC905E7A108766D1, 0x3FEFE315E86E7F85,\n 0x3C8CD2523567F613, 0x3FEFD9B0D3158574,\n 0xBC8BCE8023F98EFA, 0x3FEFD06B29DDF6DE,\n 0x3C60F74E61E6C861, 0x3FEFC74518759BC8,\n 0x3C90A3E45B33D399, 0x3FEFBE3ECAC6F383,\n 0x3C979AA65D837B6D, 0x3FEFB5586CF9890F,\n 0x3C8EB51A92FDEFFC, 0x3FEFAC922B7247F7,\n 0x3C3EBE3D702F9CD1, 0x3FEFA3EC32D3D1A2,\n 0xBC6A033489906E0B, 0x3FEF9B66AFFED31B,\n 0xBC9556522A2FBD0E, 0x3FEF9301D0125B51,\n 0xBC5080EF8C4EEA55, 0x3FEF8ABDC06C31CC,\n 0xBC91C923B9D5F416, 0x3FEF829AAEA92DE0,\n 0x3C80D3E3E95C55AF, 0x3FEF7A98C8A58E51,\n 0xBC801B15EAA59348, 0x3FEF72B83C7D517B,\n 0xBC8F1FF055DE323D, 0x3FEF6AF9388C8DEA,\n 0x3C8B898C3F1353BF, 0x3FEF635BEB6FCB75,\n 0xBC96D99C7611EB26, 0x3FEF5BE084045CD4,\n 0x3C9AECF73E3A2F60, 0x3FEF54873168B9AA,\n 0xBC8FE782CB86389D, 0x3FEF4D5022FCD91D,\n 0x3C8A6F4144A6C38D, 0x3FEF463B88628CD6,\n 0x3C807A05B0E4047D, 0x3FEF3F49917DDC96,\n 0x3C968EFDE3A8A894, 0x3FEF387A6E756238,\n 0x3C875E18F274487D, 0x3FEF31CE4FB2A63F,\n 0x3C80472B981FE7F2, 0x3FEF2B4565E27CDD,\n 0xBC96B87B3F71085E, 0x3FEF24DFE1F56381,\n 0x3C82F7E16D09AB31, 0x3FEF1E9DF51FDEE1,\n 0xBC3D219B1A6FBFFA, 0x3FEF187FD0DAD990,\n 0x3C8B3782720C0AB4, 0x3FEF1285A6E4030B,\n 0x3C6E149289CECB8F, 0x3FEF0CAFA93E2F56,\n 0x3C834D754DB0ABB6, 0x3FEF06FE0A31B715,\n 0x3C864201E2AC744C, 0x3FEF0170FC4CD831,\n 0x3C8FDD395DD3F84A, 0x3FEEFC08B26416FF,\n 0xBC86A3803B8E5B04, 0x3FEEF6C55F929FF1,\n 0xBC924AEDCC4B5068, 0x3FEEF1A7373AA9CB,\n 0xBC9907F81B512D8E, 0x3FEEECAE6D05D866,\n 0xBC71D1E83E9436D2, 0x3FEEE7DB34E59FF7,\n 0xBC991919B3CE1B15, 0x3FEEE32DC313A8E5,\n 0x3C859F48A72A4C6D, 0x3FEEDEA64C123422,\n 0xBC9312607A28698A, 0x3FEEDA4504AC801C,\n 0xBC58A78F4817895B, 0x3FEED60A21F72E2A,\n 0xBC7C2C9B67499A1B, 0x3FEED1F5D950A897,\n 0x3C4363ED60C2AC11, 0x3FEECE086061892D,\n 0x3C9666093B0664EF, 0x3FEECA41ED1D0057,\n 0x3C6ECCE1DAA10379, 0x3FEEC6A2B5C13CD0,\n 0x3C93FF8E3F0F1230, 0x3FEEC32AF0D7D3DE,\n 0x3C7690CEBB7AAFB0, 0x3FEEBFDAD5362A27,\n 0x3C931DBDEB54E077, 0x3FEEBCB299FDDD0D,\n 0xBC8F94340071A38E, 0x3FEEB9B2769D2CA7,\n 0xBC87DECCDC93A349, 0x3FEEB6DAA2CF6642,\n 0xBC78DEC6BD0F385F, 0x3FEEB42B569D4F82,\n 0xBC861246EC7B5CF6, 0x3FEEB1A4CA5D920F,\n 0x3C93350518FDD78E, 0x3FEEAF4736B527DA,\n 0x3C7B98B72F8A9B05, 0x3FEEAD12D497C7FD,\n 0x3C9063E1E21C5409, 0x3FEEAB07DD485429,\n 0x3C34C7855019C6EA, 0x3FEEA9268A5946B7,\n 0x3C9432E62B64C035, 0x3FEEA76F15AD2148,\n 0xBC8CE44A6199769F, 0x3FEEA5E1B976DC09,\n 0xBC8C33C53BEF4DA8, 0x3FEEA47EB03A5585,\n 0xBC845378892BE9AE, 0x3FEEA34634CCC320,\n 0xBC93CEDD78565858, 0x3FEEA23882552225,\n 0x3C5710AA807E1964, 0x3FEEA155D44CA973,\n 0xBC93B3EFBF5E2228, 0x3FEEA09E667F3BCD,\n 0xBC6A12AD8734B982, 0x3FEEA012750BDABF,\n 0xBC6367EFB86DA9EE, 0x3FEE9FB23C651A2F,\n 0xBC80DC3D54E08851, 0x3FEE9F7DF9519484,\n 0xBC781F647E5A3ECF, 0x3FEE9F75E8EC5F74,\n 0xBC86EE4AC08B7DB0, 0x3FEE9F9A48A58174,\n 0xBC8619321E55E68A, 0x3FEE9FEB564267C9,\n 0x3C909CCB5E09D4D3, 0x3FEEA0694FDE5D3F,\n 0xBC7B32DCB94DA51D, 0x3FEEA11473EB0187,\n 0x3C94ECFD5467C06B, 0x3FEEA1ED0130C132,\n 0x3C65EBE1ABD66C55, 0x3FEEA2F336CF4E62,\n 0xBC88A1C52FB3CF42, 0x3FEEA427543E1A12,\n 0xBC9369B6F13B3734, 0x3FEEA589994CCE13,\n 0xBC805E843A19FF1E, 0x3FEEA71A4623C7AD,\n 0xBC94D450D872576E, 0x3FEEA8D99B4492ED,\n 0x3C90AD675B0E8A00, 0x3FEEAAC7D98A6699,\n 0x3C8DB72FC1F0EAB4, 0x3FEEACE5422AA0DB,\n 0xBC65B6609CC5E7FF, 0x3FEEAF3216B5448C,\n 0x3C7BF68359F35F44, 0x3FEEB1AE99157736,\n 0xBC93091FA71E3D83, 0x3FEEB45B0B91FFC6,\n 0xBC5DA9B88B6C1E29, 0x3FEEB737B0CDC5E5,\n 0xBC6C23F97C90B959, 0x3FEEBA44CBC8520F,\n 0xBC92434322F4F9AA, 0x3FEEBD829FDE4E50,\n 0xBC85CA6CD7668E4B, 0x3FEEC0F170CA07BA,\n 0x3C71AFFC2B91CE27, 0x3FEEC49182A3F090,\n 0x3C6DD235E10A73BB, 0x3FEEC86319E32323,\n 0xBC87C50422622263, 0x3FEECC667B5DE565,\n 0x3C8B1C86E3E231D5, 0x3FEED09BEC4A2D33,\n 0xBC91BBD1D3BCBB15, 0x3FEED503B23E255D,\n 0x3C90CC319CEE31D2, 0x3FEED99E1330B358,\n 0x3C8469846E735AB3, 0x3FEEDE6B5579FDBF,\n 0xBC82DFCD978E9DB4, 0x3FEEE36BBFD3F37A,\n 0x3C8C1A7792CB3387, 0x3FEEE89F995AD3AD,\n 0xBC907B8F4AD1D9FA, 0x3FEEEE07298DB666,\n 0xBC55C3D956DCAEBA, 0x3FEEF3A2B84F15FB,\n 0xBC90A40E3DA6F640, 0x3FEEF9728DE5593A,\n 0xBC68D6F438AD9334, 0x3FEEFF76F2FB5E47,\n 0xBC91EEE26B588A35, 0x3FEF05B030A1064A,\n 0x3C74FFD70A5FDDCD, 0x3FEF0C1E904BC1D2,\n 0xBC91BDFBFA9298AC, 0x3FEF12C25BD71E09,\n 0x3C736EAE30AF0CB3, 0x3FEF199BDD85529C,\n 0x3C8EE3325C9FFD94, 0x3FEF20AB5FFFD07A,\n 0x3C84E08FD10959AC, 0x3FEF27F12E57D14B,\n 0x3C63CDAF384E1A67, 0x3FEF2F6D9406E7B5,\n 0x3C676B2C6C921968, 0x3FEF3720DCEF9069,\n 0xBC808A1883CCB5D2, 0x3FEF3F0B555DC3FA,\n 0xBC8FAD5D3FFFFA6F, 0x3FEF472D4A07897C,\n 0xBC900DAE3875A949, 0x3FEF4F87080D89F2,\n 0x3C74A385A63D07A7, 0x3FEF5818DCFBA487,\n 0xBC82919E2040220F, 0x3FEF60E316C98398,\n 0x3C8E5A50D5C192AC, 0x3FEF69E603DB3285,\n 0x3C843A59AC016B4B, 0x3FEF7321F301B460,\n 0xBC82D52107B43E1F, 0x3FEF7C97337B9B5F,\n 0xBC892AB93B470DC9, 0x3FEF864614F5A129,\n 0x3C74B604603A88D3, 0x3FEF902EE78B3FF6,\n 0x3C83C5EC519D7271, 0x3FEF9A51FBC74C83,\n 0xBC8FF7128FD391F0, 0x3FEFA4AFA2A490DA,\n 0xBC8DAE98E223747D, 0x3FEFAF482D8E67F1,\n 0x3C8EC3BC41AA2008, 0x3FEFBA1BEE615A27,\n 0x3C842B94C3A9EB32, 0x3FEFC52B376BBA97,\n 0x3C8A64A931D185EE, 0x3FEFD0765B6E4540,\n 0xBC8E37BAE43BE3ED, 0x3FEFDBFDAD9CBE14,\n 0x3C77893B4D91CD9D, 0x3FEFE7C1819E90D8,\n 0x3C5305C14160CC89, 0x3FEFF3C22B8F71F1\n]);\n\n// Handle cases that may overflow or underflow when computing the result that\n// is scale*(1+TMP) without intermediate rounding. The bit representation of\n// scale is in SBITS, however it has a computed exponent that may have\n// overflown into the sign bit so that needs to be adjusted before using it as\n// a double. (int32_t)KI is the k used in the argument reduction and exponent\n// adjustment of scale, positive k here means the result may overflow and\n// negative k means the result may underflow.\n// @ts-ignore: decorator\n@inline\nfunction specialcase(tmp: f64, sbits: u64, ki: u64): f64 {\n const\n Ox1p_1022 = reinterpret(0x0010000000000000), // 0x1p-1022\n Ox1p1009 = reinterpret(0x7F00000000000000); // 0x1p1009\n\n var scale: f64;\n if (!(ki & 0x80000000)) {\n // k > 0, the exponent of scale might have overflowed by <= 460.\n sbits -= u64(1009) << 52;\n scale = reinterpret(sbits);\n return Ox1p1009 * (scale + scale * tmp); // 0x1p1009\n }\n // k < 0, need special care in the subnormal range.\n sbits += u64(1022) << 52;\n // Note: sbits is signed scale.\n scale = reinterpret(sbits);\n var y = scale + scale * tmp;\n if (abs(y) < 1.0) {\n // Round y to the right precision before scaling it into the subnormal\n // range to avoid double rounding that can cause 0.5+E/2 ulp error where\n // E is the worst-case ulp error outside the subnormal range. So this\n // is only useful if the goal is better than 1 ulp worst-case error.\n let one = copysign(1.0, y);\n let lo = scale - y + scale * tmp;\n let hi = one + y;\n lo = one - hi + y + lo;\n y = (hi + lo) - one;\n // Fix the sign of 0.\n if (y == 0.0) y = reinterpret(sbits & 0x8000000000000000);\n }\n return y * Ox1p_1022;\n}\n\n// @ts-ignore: decorator\n@inline\nexport function exp_lut(x: f64): f64 {\n const\n N = 1 << EXP_TABLE_BITS,\n N_MASK = N - 1;\n\n const\n InvLn2N = reinterpret(0x3FF71547652B82FE) * N, // 0x1.71547652b82fep0\n NegLn2hiN = reinterpret(0xBF762E42FEFA0000), // -0x1.62e42fefa0000p-8\n NegLn2loN = reinterpret(0xBD0CF79ABC9E3B3A), // -0x1.cf79abc9e3b3ap-47\n shift = reinterpret(0x4338000000000000); // 0x1.8p52;\n\n const\n C2 = reinterpret(0x3FDFFFFFFFFFFDBD), // __exp_data.poly[0] (0x1.ffffffffffdbdp-2)\n C3 = reinterpret(0x3FC555555555543C), // __exp_data.poly[1] (0x1.555555555543cp-3)\n C4 = reinterpret(0x3FA55555CF172B91), // __exp_data.poly[2] (0x1.55555cf172b91p-5)\n C5 = reinterpret(0x3F81111167A4D017); // __exp_data.poly[3] (0x1.1111167a4d017p-7)\n\n var ux = reinterpret(x);\n var abstop = (ux >> 52 & 0x7FF);\n if (abstop - 0x3C9 >= 0x03F) {\n if (abstop - 0x3C9 >= 0x80000000) return 1;\n if (abstop >= 0x409) {\n if (ux == 0xFFF0000000000000) return 0;\n if (abstop >= 0x7FF) return 1.0 + x;\n return select(0, Infinity, ux >> 63);\n }\n // Large x is special cased below.\n abstop = 0;\n }\n\n // exp(x) = 2^(k/N) * exp(r), with exp(r) in [2^(-1/2N),2^(1/2N)]\n // x = ln2/N*k + r, with int k and r in [-ln2/2N, ln2/2N]\n var z = InvLn2N * x;\n // #if TOINT_INTRINSICS\n // \tkd = roundtoint(z);\n // \tki = converttoint(z);\n // #elif EXP_USE_TOINT_NARROW\n // \t// z - kd is in [-0.5-2^-16, 0.5] in all rounding modes.\n // var kd = z + shift;\n // var ki = reinterpret(kd) >> 16;\n // var kd = ki;\n // #else\n // z - kd is in [-1, 1] in non-nearest rounding modes.\n var kd = z + shift;\n var ki = reinterpret(kd);\n kd -= shift;\n // #endif\n var r = x + kd * NegLn2hiN + kd * NegLn2loN;\n // 2^(k/N) ~= scale * (1 + tail).\n var idx = ((ki & N_MASK) << 1);\n var top = ki << (52 - EXP_TABLE_BITS);\n\n var tail = reinterpret(load(EXP_DATA_TAB + (idx << alignof()))); // T[idx]\n // This is only a valid scale when -1023*N < k < 1024*N\n var sbits = load(EXP_DATA_TAB + (idx << alignof()), 1 << alignof()) + top; // T[idx + 1]\n // exp(x) = 2^(k/N) * exp(r) ~= scale + scale * (tail + exp(r) - 1).\n // Evaluation is optimized assuming superscalar pipelined execution.\n var r2 = r * r;\n // Without fma the worst case error is 0.25/N ulp larger.\n // Worst case error is less than 0.5+1.11/N+(abs poly error * 2^53) ulp.\n var tmp = tail + r + r2 * (C2 + r * C3) + r2 * r2 * (C4 + r * C5);\n if (abstop == 0) return specialcase(tmp, sbits, ki);\n var scale = reinterpret(sbits);\n // Note: tmp == 0 or |tmp| > 2^-200 and scale > 2^-739, so there\n // is no spurious underflow here even without fma.\n return scale + scale * tmp;\n}\n\n//\n// Lookup data for exp2. See: https://git.musl-libc.org/cgit/musl/tree/src/math/exp2.c\n//\n\n// Handle cases that may overflow or underflow when computing the result that\n// is scale*(1+TMP) without intermediate rounding. The bit representation of\n// scale is in SBITS, however it has a computed exponent that may have\n// overflown into the sign bit so that needs to be adjusted before using it as\n// a double. (int32_t)KI is the k used in the argument reduction and exponent\n// adjustment of scale, positive k here means the result may overflow and\n// negative k means the result may underflow.\n// @ts-ignore: decorator\n@inline\nfunction specialcase2(tmp: f64, sbits: u64, ki: u64): f64 {\n const Ox1p_1022 = reinterpret(0x10000000000000); // 0x1p-1022\n var scale: f64;\n if ((ki & 0x80000000) == 0) {\n // k > 0, the exponent of scale might have overflowed by 1\n sbits -= u64(1) << 52;\n scale = reinterpret(sbits);\n return 2 * (scale * tmp + scale);\n }\n // k < 0, need special care in the subnormal range\n sbits += u64(1022) << 52;\n scale = reinterpret(sbits);\n var y = scale * tmp + scale;\n if (y < 1.0) {\n // Round y to the right precision before scaling it into the subnormal\n // range to avoid double rounding that can cause 0.5+E/2 ulp error where\n // E is the worst-case ulp error outside the subnormal range. So this\n // is only useful if the goal is better than 1 ulp worst-case error.\n let hi: f64, lo: f64;\n lo = scale - y + scale * tmp;\n hi = 1.0 + y;\n lo = 1.0 - hi + y + lo;\n y = (hi + lo) - 1.0;\n }\n return y * Ox1p_1022;\n}\n\n// @ts-ignore: decorator\n@inline\nexport function exp2_lut(x: f64): f64 {\n const\n N = 1 << EXP_TABLE_BITS,\n N_MASK = N - 1,\n shift = reinterpret(0x4338000000000000) / N; // 0x1.8p52\n\n const\n C1 = reinterpret(0x3FE62E42FEFA39EF), // 0x1.62e42fefa39efp-1\n C2 = reinterpret(0x3FCEBFBDFF82C424), // 0x1.ebfbdff82c424p-3\n C3 = reinterpret(0x3FAC6B08D70CF4B5), // 0x1.c6b08d70cf4b5p-5\n C4 = reinterpret(0x3F83B2ABD24650CC), // 0x1.3b2abd24650ccp-7\n C5 = reinterpret(0x3F55D7E09B4E3A84); // 0x1.5d7e09b4e3a84p-10\n\n var ux = reinterpret(x);\n var abstop = (ux >> 52 & 0x7ff);\n if (abstop - 0x3C9 >= 0x03F) {\n if (abstop - 0x3C9 >= 0x80000000) return 1.0;\n if (abstop >= 0x409) {\n if (ux == 0xFFF0000000000000) return 0;\n if (abstop >= 0x7FF) return 1.0 + x;\n if (!(ux >> 63)) return Infinity;\n else if (ux >= 0xC090CC0000000000) return 0;\n }\n if ((ux << 1) > 0x811A000000000000) abstop = 0; // Large x is special cased below.\n }\n\n // exp2(x) = 2^(k/N) * 2^r, with 2^r in [2^(-1/2N),2^(1/2N)].\n // x = k/N + r, with int k and r in [-1/2N, 1/2N]\n var kd = x + shift;\n var ki = reinterpret(kd);\n kd -= shift; // k/N for int k\n var r = x - kd;\n // 2^(k/N) ~= scale * (1 + tail)\n var idx = ((ki & N_MASK) << 1);\n var top = ki << (52 - EXP_TABLE_BITS);\n\n var tail = reinterpret(load(EXP_DATA_TAB + (idx << alignof()), 0 << alignof())); // T[idx])\n // This is only a valid scale when -1023*N < k < 1024*N\n var sbits = load(EXP_DATA_TAB + (idx << alignof()), 1 << alignof()) + top; // T[idx + 1]\n // exp2(x) = 2^(k/N) * 2^r ~= scale + scale * (tail + 2^r - 1).\n // Evaluation is optimized assuming superscalar pipelined execution\n var r2 = r * r;\n // Without fma the worst case error is 0.5/N ulp larger.\n // Worst case error is less than 0.5+0.86/N+(abs poly error * 2^53) ulp.\n var tmp = tail + r * C1 + r2 * (C2 + r * C3) + r2 * r2 * (C4 + r * C5);\n if (abstop == 0) return specialcase2(tmp, sbits, ki);\n var scale = reinterpret(sbits);\n // Note: tmp == 0 or |tmp| > 2^-65 and scale > 2^-928, so there\n // is no spurious underflow here even without fma.\n return scale * tmp + scale;\n}\n\n//\n// Lookup data for log2. See: https://git.musl-libc.org/cgit/musl/tree/src/math/log2.c\n//\n\n// @ts-ignore: decorator\n@inline const LOG2_TABLE_BITS = 6;\n\n/* Algorithm:\n\n x = 2^k z\n log2(x) = k + log2(c) + log2(z/c)\n log2(z/c) = poly(z/c - 1)\n\nwhere z is in [1.6p-1; 1.6p0] which is split into N subintervals and z falls\ninto the ith one, then table entries are computed as\n\n tab[i].invc = 1/c\n tab[i].logc = (double)log2(c)\n tab2[i].chi = (double)c\n tab2[i].clo = (double)(c - (double)c)\n\nwhere c is near the center of the subinterval and is chosen by trying +-2^29\nfloating point invc candidates around 1/center and selecting one for which\n\n 1) the rounding error in 0x1.8p10 + logc is 0,\n 2) the rounding error in z - chi - clo is < 0x1p-64 and\n 3) the rounding error in (double)log2(c) is minimized (< 0x1p-68).\n\nNote: 1) ensures that k + logc can be computed without rounding error, 2)\nensures that z/c - 1 can be computed as (z - chi - clo)*invc with close to a\nsingle rounding error when there is no fast fma for z*invc - 1, 3) ensures\nthat logc + poly(z/c - 1) has small error, however near x == 1 when\n|log2(x)| < 0x1p-4, this is not enough so that is special cased. */\n\n// @ts-ignore: decorator\n@lazy @inline const LOG2_DATA_TAB1 = memory.data([\n // invc , logc\n reinterpret(0x3FF724286BB1ACF8), reinterpret(0xBFE1095FEECDB000),\n reinterpret(0x3FF6E1F766D2CCA1), reinterpret(0xBFE08494BD76D000),\n reinterpret(0x3FF6A13D0E30D48A), reinterpret(0xBFE00143AEE8F800),\n reinterpret(0x3FF661EC32D06C85), reinterpret(0xBFDEFEC5360B4000),\n reinterpret(0x3FF623FA951198F8), reinterpret(0xBFDDFDD91AB7E000),\n reinterpret(0x3FF5E75BA4CF026C), reinterpret(0xBFDCFFAE0CC79000),\n reinterpret(0x3FF5AC055A214FB8), reinterpret(0xBFDC043811FDA000),\n reinterpret(0x3FF571ED0F166E1E), reinterpret(0xBFDB0B67323AE000),\n reinterpret(0x3FF53909590BF835), reinterpret(0xBFDA152F5A2DB000),\n reinterpret(0x3FF5014FED61ADDD), reinterpret(0xBFD9217F5AF86000),\n reinterpret(0x3FF4CAB88E487BD0), reinterpret(0xBFD8304DB0719000),\n reinterpret(0x3FF49539B4334FEE), reinterpret(0xBFD74189F9A9E000),\n reinterpret(0x3FF460CBDFAFD569), reinterpret(0xBFD6552BB5199000),\n reinterpret(0x3FF42D664EE4B953), reinterpret(0xBFD56B23A29B1000),\n reinterpret(0x3FF3FB01111DD8A6), reinterpret(0xBFD483650F5FA000),\n reinterpret(0x3FF3C995B70C5836), reinterpret(0xBFD39DE937F6A000),\n reinterpret(0x3FF3991C4AB6FD4A), reinterpret(0xBFD2BAA1538D6000),\n reinterpret(0x3FF3698E0CE099B5), reinterpret(0xBFD1D98340CA4000),\n reinterpret(0x3FF33AE48213E7B2), reinterpret(0xBFD0FA853A40E000),\n reinterpret(0x3FF30D191985BDB1), reinterpret(0xBFD01D9C32E73000),\n reinterpret(0x3FF2E025CAB271D7), reinterpret(0xBFCE857DA2FA6000),\n reinterpret(0x3FF2B404CF13CD82), reinterpret(0xBFCCD3C8633D8000),\n reinterpret(0x3FF288B02C7CCB50), reinterpret(0xBFCB26034C14A000),\n reinterpret(0x3FF25E2263944DE5), reinterpret(0xBFC97C1C2F4FE000),\n reinterpret(0x3FF234563D8615B1), reinterpret(0xBFC7D6023F800000),\n reinterpret(0x3FF20B46E33EAF38), reinterpret(0xBFC633A71A05E000),\n reinterpret(0x3FF1E2EEFDCDA3DD), reinterpret(0xBFC494F5E9570000),\n reinterpret(0x3FF1BB4A580B3930), reinterpret(0xBFC2F9E424E0A000),\n reinterpret(0x3FF19453847F2200), reinterpret(0xBFC162595AFDC000),\n reinterpret(0x3FF16E06C0D5D73C), reinterpret(0xBFBF9C9A75BD8000),\n reinterpret(0x3FF1485F47B7E4C2), reinterpret(0xBFBC7B575BF9C000),\n reinterpret(0x3FF12358AD0085D1), reinterpret(0xBFB960C60FF48000),\n reinterpret(0x3FF0FEF00F532227), reinterpret(0xBFB64CE247B60000),\n reinterpret(0x3FF0DB2077D03A8F), reinterpret(0xBFB33F78B2014000),\n reinterpret(0x3FF0B7E6D65980D9), reinterpret(0xBFB0387D1A42C000),\n reinterpret(0x3FF0953EFE7B408D), reinterpret(0xBFAA6F9208B50000),\n reinterpret(0x3FF07325CAC53B83), reinterpret(0xBFA47A954F770000),\n reinterpret(0x3FF05197E40D1B5C), reinterpret(0xBF9D23A8C50C0000),\n reinterpret(0x3FF03091C1208EA2), reinterpret(0xBF916A2629780000),\n reinterpret(0x3FF0101025B37E21), reinterpret(0xBF7720F8D8E80000),\n reinterpret(0x3FEFC07EF9CAA76B), reinterpret(0x3F86FE53B1500000),\n reinterpret(0x3FEF4465D3F6F184), reinterpret(0x3FA11CCCE10F8000),\n reinterpret(0x3FEECC079F84107F), reinterpret(0x3FAC4DFC8C8B8000),\n reinterpret(0x3FEE573A99975AE8), reinterpret(0x3FB3AA321E574000),\n reinterpret(0x3FEDE5D6F0BD3DE6), reinterpret(0x3FB918A0D08B8000),\n reinterpret(0x3FED77B681FF38B3), reinterpret(0x3FBE72E9DA044000),\n reinterpret(0x3FED0CB5724DE943), reinterpret(0x3FC1DCD2507F6000),\n reinterpret(0x3FECA4B2DC0E7563), reinterpret(0x3FC476AB03DEA000),\n reinterpret(0x3FEC3F8EE8D6CB51), reinterpret(0x3FC7074377E22000),\n reinterpret(0x3FEBDD2B4F020C4C), reinterpret(0x3FC98EDE8BA94000),\n reinterpret(0x3FEB7D6C006015CA), reinterpret(0x3FCC0DB86AD2E000),\n reinterpret(0x3FEB20366E2E338F), reinterpret(0x3FCE840AAFCEE000),\n reinterpret(0x3FEAC57026295039), reinterpret(0x3FD0790AB4678000),\n reinterpret(0x3FEA6D01BC2731DD), reinterpret(0x3FD1AC056801C000),\n reinterpret(0x3FEA16D3BC3FF18B), reinterpret(0x3FD2DB11D4FEE000),\n reinterpret(0x3FE9C2D14967FEAD), reinterpret(0x3FD406464EC58000),\n reinterpret(0x3FE970E4F47C9902), reinterpret(0x3FD52DBE093AF000),\n reinterpret(0x3FE920FB3982BCF2), reinterpret(0x3FD651902050D000),\n reinterpret(0x3FE8D30187F759F1), reinterpret(0x3FD771D2CDEAF000),\n reinterpret(0x3FE886E5EBB9F66D), reinterpret(0x3FD88E9C857D9000),\n reinterpret(0x3FE83C97B658B994), reinterpret(0x3FD9A80155E16000),\n reinterpret(0x3FE7F405FFC61022), reinterpret(0x3FDABE186ED3D000),\n reinterpret(0x3FE7AD22181415CA), reinterpret(0x3FDBD0F2AEA0E000),\n reinterpret(0x3FE767DCF99EFF8C), reinterpret(0x3FDCE0A43DBF4000)\n]);\n\n// @ts-ignore: decorator\n@lazy @inline const LOG2_DATA_TAB2 = memory.data([\n // chi , clo\n reinterpret(0x3FE6200012B90A8E), reinterpret(0x3C8904AB0644B605),\n reinterpret(0x3FE66000045734A6), reinterpret(0x3C61FF9BEA62F7A9),\n reinterpret(0x3FE69FFFC325F2C5), reinterpret(0x3C827ECFCB3C90BA),\n reinterpret(0x3FE6E00038B95A04), reinterpret(0x3C88FF8856739326),\n reinterpret(0x3FE71FFFE09994E3), reinterpret(0x3C8AFD40275F82B1),\n reinterpret(0x3FE7600015590E10), reinterpret(0xBC72FD75B4238341),\n reinterpret(0x3FE7A00012655BD5), reinterpret(0x3C7808E67C242B76),\n reinterpret(0x3FE7E0003259E9A6), reinterpret(0xBC6208E426F622B7),\n reinterpret(0x3FE81FFFEDB4B2D2), reinterpret(0xBC8402461EA5C92F),\n reinterpret(0x3FE860002DFAFCC3), reinterpret(0x3C6DF7F4A2F29A1F),\n reinterpret(0x3FE89FFFF78C6B50), reinterpret(0xBC8E0453094995FD),\n reinterpret(0x3FE8E00039671566), reinterpret(0xBC8A04F3BEC77B45),\n reinterpret(0x3FE91FFFE2BF1745), reinterpret(0xBC77FA34400E203C),\n reinterpret(0x3FE95FFFCC5C9FD1), reinterpret(0xBC76FF8005A0695D),\n reinterpret(0x3FE9A0003BBA4767), reinterpret(0x3C70F8C4C4EC7E03),\n reinterpret(0x3FE9DFFFE7B92DA5), reinterpret(0x3C8E7FD9478C4602),\n reinterpret(0x3FEA1FFFD72EFDAF), reinterpret(0xBC6A0C554DCDAE7E),\n reinterpret(0x3FEA5FFFDE04FF95), reinterpret(0x3C867DA98CE9B26B),\n reinterpret(0x3FEA9FFFCA5E8D2B), reinterpret(0xBC8284C9B54C13DE),\n reinterpret(0x3FEADFFFDDAD03EA), reinterpret(0x3C5812C8EA602E3C),\n reinterpret(0x3FEB1FFFF10D3D4D), reinterpret(0xBC8EFADDAD27789C),\n reinterpret(0x3FEB5FFFCE21165A), reinterpret(0x3C53CB1719C61237),\n reinterpret(0x3FEB9FFFD950E674), reinterpret(0x3C73F7D94194CE00),\n reinterpret(0x3FEBE000139CA8AF), reinterpret(0x3C750AC4215D9BC0),\n reinterpret(0x3FEC20005B46DF99), reinterpret(0x3C6BEEA653E9C1C9),\n reinterpret(0x3FEC600040B9F7AE), reinterpret(0xBC7C079F274A70D6),\n reinterpret(0x3FECA0006255FD8A), reinterpret(0xBC7A0B4076E84C1F),\n reinterpret(0x3FECDFFFD94C095D), reinterpret(0x3C88F933F99AB5D7),\n reinterpret(0x3FED1FFFF975D6CF), reinterpret(0xBC582C08665FE1BE),\n reinterpret(0x3FED5FFFA2561C93), reinterpret(0xBC7B04289BD295F3),\n reinterpret(0x3FED9FFF9D228B0C), reinterpret(0x3C870251340FA236),\n reinterpret(0x3FEDE00065BC7E16), reinterpret(0xBC75011E16A4D80C),\n reinterpret(0x3FEE200002F64791), reinterpret(0x3C89802F09EF62E0),\n reinterpret(0x3FEE600057D7A6D8), reinterpret(0xBC7E0B75580CF7FA),\n reinterpret(0x3FEEA00027EDC00C), reinterpret(0xBC8C848309459811),\n reinterpret(0x3FEEE0006CF5CB7C), reinterpret(0xBC8F8027951576F4),\n reinterpret(0x3FEF2000782B7DCC), reinterpret(0xBC8F81D97274538F),\n reinterpret(0x3FEF6000260C450A), reinterpret(0xBC4071002727FFDC),\n reinterpret(0x3FEF9FFFE88CD533), reinterpret(0xBC581BDCE1FDA8B0),\n reinterpret(0x3FEFDFFFD50F8689), reinterpret(0x3C87F91ACB918E6E),\n reinterpret(0x3FF0200004292367), reinterpret(0x3C9B7FF365324681),\n reinterpret(0x3FF05FFFE3E3D668), reinterpret(0x3C86FA08DDAE957B),\n reinterpret(0x3FF0A0000A85A757), reinterpret(0xBC57E2DE80D3FB91),\n reinterpret(0x3FF0E0001A5F3FCC), reinterpret(0xBC91823305C5F014),\n reinterpret(0x3FF11FFFF8AFBAF5), reinterpret(0xBC8BFABB6680BAC2),\n reinterpret(0x3FF15FFFE54D91AD), reinterpret(0xBC9D7F121737E7EF),\n reinterpret(0x3FF1A00011AC36E1), reinterpret(0x3C9C000A0516F5FF),\n reinterpret(0x3FF1E00019C84248), reinterpret(0xBC9082FBE4DA5DA0),\n reinterpret(0x3FF220000FFE5E6E), reinterpret(0xBC88FDD04C9CFB43),\n reinterpret(0x3FF26000269FD891), reinterpret(0x3C8CFE2A7994D182),\n reinterpret(0x3FF2A00029A6E6DA), reinterpret(0xBC700273715E8BC5),\n reinterpret(0x3FF2DFFFE0293E39), reinterpret(0x3C9B7C39DAB2A6F9),\n reinterpret(0x3FF31FFFF7DCF082), reinterpret(0x3C7DF1336EDC5254),\n reinterpret(0x3FF35FFFF05A8B60), reinterpret(0xBC9E03564CCD31EB),\n reinterpret(0x3FF3A0002E0EAECC), reinterpret(0x3C75F0E74BD3A477),\n reinterpret(0x3FF3E000043BB236), reinterpret(0x3C9C7DCB149D8833),\n reinterpret(0x3FF4200002D187FF), reinterpret(0x3C7E08AFCF2D3D28),\n reinterpret(0x3FF460000D387CB1), reinterpret(0x3C820837856599A6),\n reinterpret(0x3FF4A00004569F89), reinterpret(0xBC89FA5C904FBCD2),\n reinterpret(0x3FF4E000043543F3), reinterpret(0xBC781125ED175329),\n reinterpret(0x3FF51FFFCC027F0F), reinterpret(0x3C9883D8847754DC),\n reinterpret(0x3FF55FFFFD87B36F), reinterpret(0xBC8709E731D02807),\n reinterpret(0x3FF59FFFF21DF7BA), reinterpret(0x3C87F79F68727B02),\n reinterpret(0x3FF5DFFFEBFC3481), reinterpret(0xBC9180902E30E93E)\n]);\n\n// @ts-ignore: decorator\n@inline\nexport function log2_lut(x: f64): f64 {\n const N_MASK = (1 << LOG2_TABLE_BITS) - 1;\n\n const\n LO: u64 = 0x3FEEA4AF00000000, // reinterpret(1.0 - 0x1.5b51p-5)\n HI: u64 = 0x3FF0B55900000000; // reinterpret(1.0 + 0x1.6ab2p-5)\n\n const\n InvLn2hi = reinterpret(0x3FF7154765200000), // 0x1.7154765200000p+0\n InvLn2lo = reinterpret(0x3DE705FC2EEFA200), // 0x1.705fc2eefa200p-33\n Ox1p52 = reinterpret(0x4330000000000000); // 0x1p52\n\n const\n B0 = reinterpret(0xBFE71547652B82FE), // -0x1.71547652b82fep-1\n B1 = reinterpret(0x3FDEC709DC3A03F7), // 0x1.ec709dc3a03f7p-2\n B2 = reinterpret(0xBFD71547652B7C3F), // -0x1.71547652b7c3fp-2\n B3 = reinterpret(0x3FD2776C50F05BE4), // 0x1.2776c50f05be4p-2\n B4 = reinterpret(0xBFCEC709DD768FE5), // -0x1.ec709dd768fe5p-3\n B5 = reinterpret(0x3FCA61761EC4E736), // 0x1.a61761ec4e736p-3\n B6 = reinterpret(0xBFC7153FBC64A79B), // -0x1.7153fbc64a79bp-3\n B7 = reinterpret(0x3FC484D154F01B4A), // 0x1.484d154f01b4ap-3\n B8 = reinterpret(0xBFC289E4A72C383C), // -0x1.289e4a72c383cp-3\n B9 = reinterpret(0x3FC0B32F285AEE66); // 0x1.0b32f285aee66p-3\n\n const\n A0 = reinterpret(0xBFE71547652B8339), // -0x1.71547652b8339p-1\n A1 = reinterpret(0x3FDEC709DC3A04BE), // 0x1.ec709dc3a04bep-2\n A2 = reinterpret(0xBFD7154764702FFB), // -0x1.7154764702ffbp-2\n A3 = reinterpret(0x3FD2776C50034C48), // 0x1.2776c50034c48p-2\n A4 = reinterpret(0xBFCEC7B328EA92BC), // -0x1.ec7b328ea92bcp-3\n A5 = reinterpret(0x3FCA6225E117F92E); // 0x1.a6225e117f92ep-3\n\n var ix = reinterpret(x);\n if (ix - LO < HI - LO) {\n let r = x - 1.0;\n // #if __FP_FAST_FMA\n // hi = r * InvLn2hi;\n // lo = r * InvLn2lo + __builtin_fma(r, InvLn2hi, -hi);\n // #else\n let rhi = reinterpret(reinterpret(r) & 0xFFFFFFFF00000000);\n let rlo = r - rhi;\n let hi = rhi * InvLn2hi;\n let lo = rlo * InvLn2hi + r * InvLn2lo;\n // #endif\n let r2 = r * r; // rounding error: 0x1p-62\n let r4 = r2 * r2;\n // Worst-case error is less than 0.54 ULP (0.55 ULP without fma)\n let p = r2 * (B0 + r * B1);\n let y = hi + p;\n lo += hi - y + p;\n lo += r4 * (B2 + r * B3 + r2 * (B4 + r * B5) +\n r4 * (B6 + r * B7 + r2 * (B8 + r * B9)));\n return y + lo;\n }\n var top = (ix >> 48);\n if (top - 0x0010 >= 0x7ff0 - 0x0010) {\n // x < 0x1p-1022 or inf or nan.\n if ((ix << 1) == 0) return -1.0 / (x * x);\n if (ix == 0x7FF0000000000000) return x; // log(inf) == inf\n if ((top & 0x8000) || (top & 0x7FF0) == 0x7FF0) return (x - x) / (x - x);\n // x is subnormal, normalize it.\n ix = reinterpret(x * Ox1p52);\n ix -= u64(52) << 52;\n }\n\n // x = 2^k z; where z is in range [OFF,2*OFF) and exact.\n // The range is split into N subintervals.\n // The ith subinterval contains z and c is near its center.\n var tmp = ix - 0x3FE6000000000000;\n var i = ((tmp >> (52 - LOG2_TABLE_BITS)) & N_MASK);\n var k = tmp >> 52;\n var iz = ix - (tmp & 0xFFF0000000000000);\n\n var invc = load(LOG2_DATA_TAB1 + (i << (1 + alignof())), 0 << alignof()); // T[i].invc;\n var logc = load(LOG2_DATA_TAB1 + (i << (1 + alignof())), 1 << alignof()); // T[i].logc;\n var z = reinterpret(iz);\n var kd = k;\n\n // log2(x) = log2(z/c) + log2(c) + k.\n // r ~= z/c - 1, |r| < 1/(2*N).\n // #if __FP_FAST_FMA\n // \t// rounding error: 0x1p-55/N.\n // \tr = __builtin_fma(z, invc, -1.0);\n // \tt1 = r * InvLn2hi;\n // \tt2 = r * InvLn2lo + __builtin_fma(r, InvLn2hi, -t1);\n // #else\n // rounding error: 0x1p-55/N + 0x1p-65.\n var chi = load(LOG2_DATA_TAB2 + (i << (1 + alignof())), 0 << alignof()); // T[i].chi;\n var clo = load(LOG2_DATA_TAB2 + (i << (1 + alignof())), 1 << alignof()); // T[i].clo;\n\n var r = (z - chi - clo) * invc;\n var rhi = reinterpret(reinterpret(r) & 0xFFFFFFFF00000000);\n var rlo = r - rhi;\n var t1 = rhi * InvLn2hi;\n var t2 = rlo * InvLn2hi + r * InvLn2lo;\n // #endif\n\n // hi + lo = r/ln2 + log2(c) + k\n var t3 = kd + logc;\n var hi = t3 + t1;\n var lo = t3 - hi + t1 + t2;\n\n // log2(r+1) = r/ln2 + r^2*poly(r)\n // Evaluation is optimized assuming superscalar pipelined execution\n var r2 = r * r; // rounding error: 0x1p-54/N^2\n // Worst-case error if |y| > 0x1p-4: 0.547 ULP (0.550 ULP without fma).\n // ~ 0.5 + 2/N/ln2 + abs-poly-error*0x1p56 ULP (+ 0.003 ULP without fma).\n var p = A0 + r * A1 + r2 * (A2 + r * A3) + (r2 * r2) * (A4 + r * A5);\n return lo + r2 * p + hi;\n}\n\n//\n// Lookup data for log. See: https://git.musl-libc.org/cgit/musl/tree/src/math/log.c\n//\n\n// @ts-ignore: decorator\n@inline const LOG_TABLE_BITS = 7;\n\n/* Algorithm:\n\n x = 2^k z\n log(x) = k ln2 + log(c) + log(z/c)\n log(z/c) = poly(z/c - 1)\n\nwhere z is in [1.6p-1; 1.6p0] which is split into N subintervals and z falls\ninto the ith one, then table entries are computed as\n\n tab[i].invc = 1/c\n tab[i].logc = (double)log(c)\n tab2[i].chi = (double)c\n tab2[i].clo = (double)(c - (double)c)\n\nwhere c is near the center of the subinterval and is chosen by trying +-2^29\nfloating point invc candidates around 1/center and selecting one for which\n\n 1) the rounding error in 0x1.8p9 + logc is 0,\n 2) the rounding error in z - chi - clo is < 0x1p-66 and\n 3) the rounding error in (double)log(c) is minimized (< 0x1p-66).\n\nNote: 1) ensures that k*ln2hi + logc can be computed without rounding error,\n2) ensures that z/c - 1 can be computed as (z - chi - clo)*invc with close to\na single rounding error when there is no fast fma for z*invc - 1, 3) ensures\nthat logc + poly(z/c - 1) has small error, however near x == 1 when\n|log(x)| < 0x1p-4, this is not enough so that is special cased.*/\n\n// @ts-ignore: decorator\n@lazy @inline const LOG_DATA_TAB1 = memory.data([\n // invc , logc\n reinterpret(0x3FF734F0C3E0DE9F), reinterpret(0xBFD7CC7F79E69000),\n reinterpret(0x3FF713786A2CE91F), reinterpret(0xBFD76FEEC20D0000),\n reinterpret(0x3FF6F26008FAB5A0), reinterpret(0xBFD713E31351E000),\n reinterpret(0x3FF6D1A61F138C7D), reinterpret(0xBFD6B85B38287800),\n reinterpret(0x3FF6B1490BC5B4D1), reinterpret(0xBFD65D5590807800),\n reinterpret(0x3FF69147332F0CBA), reinterpret(0xBFD602D076180000),\n reinterpret(0x3FF6719F18224223), reinterpret(0xBFD5A8CA86909000),\n reinterpret(0x3FF6524F99A51ED9), reinterpret(0xBFD54F4356035000),\n reinterpret(0x3FF63356AA8F24C4), reinterpret(0xBFD4F637C36B4000),\n reinterpret(0x3FF614B36B9DDC14), reinterpret(0xBFD49DA7FDA85000),\n reinterpret(0x3FF5F66452C65C4C), reinterpret(0xBFD445923989A800),\n reinterpret(0x3FF5D867B5912C4F), reinterpret(0xBFD3EDF439B0B800),\n reinterpret(0x3FF5BABCCB5B90DE), reinterpret(0xBFD396CE448F7000),\n reinterpret(0x3FF59D61F2D91A78), reinterpret(0xBFD3401E17BDA000),\n reinterpret(0x3FF5805612465687), reinterpret(0xBFD2E9E2EF468000),\n reinterpret(0x3FF56397CEE76BD3), reinterpret(0xBFD2941B3830E000),\n reinterpret(0x3FF54725E2A77F93), reinterpret(0xBFD23EC58CDA8800),\n reinterpret(0x3FF52AFF42064583), reinterpret(0xBFD1E9E129279000),\n reinterpret(0x3FF50F22DBB2BDDF), reinterpret(0xBFD1956D2B48F800),\n reinterpret(0x3FF4F38F4734DED7), reinterpret(0xBFD141679AB9F800),\n reinterpret(0x3FF4D843CFDE2840), reinterpret(0xBFD0EDD094EF9800),\n reinterpret(0x3FF4BD3EC078A3C8), reinterpret(0xBFD09AA518DB1000),\n reinterpret(0x3FF4A27FC3E0258A), reinterpret(0xBFD047E65263B800),\n reinterpret(0x3FF4880524D48434), reinterpret(0xBFCFEB224586F000),\n reinterpret(0x3FF46DCE1B192D0B), reinterpret(0xBFCF474A7517B000),\n reinterpret(0x3FF453D9D3391854), reinterpret(0xBFCEA4443D103000),\n reinterpret(0x3FF43A2744B4845A), reinterpret(0xBFCE020D44E9B000),\n reinterpret(0x3FF420B54115F8FB), reinterpret(0xBFCD60A22977F000),\n reinterpret(0x3FF40782DA3EF4B1), reinterpret(0xBFCCC00104959000),\n reinterpret(0x3FF3EE8F5D57FE8F), reinterpret(0xBFCC202956891000),\n reinterpret(0x3FF3D5D9A00B4CE9), reinterpret(0xBFCB81178D811000),\n reinterpret(0x3FF3BD60C010C12B), reinterpret(0xBFCAE2C9CCD3D000),\n reinterpret(0x3FF3A5242B75DAB8), reinterpret(0xBFCA45402E129000),\n reinterpret(0x3FF38D22CD9FD002), reinterpret(0xBFC9A877681DF000),\n reinterpret(0x3FF3755BC5847A1C), reinterpret(0xBFC90C6D69483000),\n reinterpret(0x3FF35DCE49AD36E2), reinterpret(0xBFC87120A645C000),\n reinterpret(0x3FF34679984DD440), reinterpret(0xBFC7D68FB4143000),\n reinterpret(0x3FF32F5CCEFFCB24), reinterpret(0xBFC73CB83C627000),\n reinterpret(0x3FF3187775A10D49), reinterpret(0xBFC6A39A9B376000),\n reinterpret(0x3FF301C8373E3990), reinterpret(0xBFC60B3154B7A000),\n reinterpret(0x3FF2EB4EBB95F841), reinterpret(0xBFC5737D76243000),\n reinterpret(0x3FF2D50A0219A9D1), reinterpret(0xBFC4DC7B8FC23000),\n reinterpret(0x3FF2BEF9A8B7FD2A), reinterpret(0xBFC4462C51D20000),\n reinterpret(0x3FF2A91C7A0C1BAB), reinterpret(0xBFC3B08ABC830000),\n reinterpret(0x3FF293726014B530), reinterpret(0xBFC31B996B490000),\n reinterpret(0x3FF27DFA5757A1F5), reinterpret(0xBFC2875490A44000),\n reinterpret(0x3FF268B39B1D3BBF), reinterpret(0xBFC1F3B9F879A000),\n reinterpret(0x3FF2539D838FF5BD), reinterpret(0xBFC160C8252CA000),\n reinterpret(0x3FF23EB7AAC9083B), reinterpret(0xBFC0CE7F57F72000),\n reinterpret(0x3FF22A012BA940B6), reinterpret(0xBFC03CDC49FEA000),\n reinterpret(0x3FF2157996CC4132), reinterpret(0xBFBF57BDBC4B8000),\n reinterpret(0x3FF201201DD2FC9B), reinterpret(0xBFBE370896404000),\n reinterpret(0x3FF1ECF4494D480B), reinterpret(0xBFBD17983EF94000),\n reinterpret(0x3FF1D8F5528F6569), reinterpret(0xBFBBF9674ED8A000),\n reinterpret(0x3FF1C52311577E7C), reinterpret(0xBFBADC79202F6000),\n reinterpret(0x3FF1B17C74CB26E9), reinterpret(0xBFB9C0C3E7288000),\n reinterpret(0x3FF19E010C2C1AB6), reinterpret(0xBFB8A646B372C000),\n reinterpret(0x3FF18AB07BB670BD), reinterpret(0xBFB78D01B3AC0000),\n reinterpret(0x3FF1778A25EFBCB6), reinterpret(0xBFB674F145380000),\n reinterpret(0x3FF1648D354C31DA), reinterpret(0xBFB55E0E6D878000),\n reinterpret(0x3FF151B990275FDD), reinterpret(0xBFB4485CDEA1E000),\n reinterpret(0x3FF13F0EA432D24C), reinterpret(0xBFB333D94D6AA000),\n reinterpret(0x3FF12C8B7210F9DA), reinterpret(0xBFB22079F8C56000),\n reinterpret(0x3FF11A3028ECB531), reinterpret(0xBFB10E4698622000),\n reinterpret(0x3FF107FBDA8434AF), reinterpret(0xBFAFFA6C6AD20000),\n reinterpret(0x3FF0F5EE0F4E6BB3), reinterpret(0xBFADDA8D4A774000),\n reinterpret(0x3FF0E4065D2A9FCE), reinterpret(0xBFABBCECE4850000),\n reinterpret(0x3FF0D244632CA521), reinterpret(0xBFA9A1894012C000),\n reinterpret(0x3FF0C0A77CE2981A), reinterpret(0xBFA788583302C000),\n reinterpret(0x3FF0AF2F83C636D1), reinterpret(0xBFA5715E67D68000),\n reinterpret(0x3FF09DDB98A01339), reinterpret(0xBFA35C8A49658000),\n reinterpret(0x3FF08CABAF52E7DF), reinterpret(0xBFA149E364154000),\n reinterpret(0x3FF07B9F2F4E28FB), reinterpret(0xBF9E72C082EB8000),\n reinterpret(0x3FF06AB58C358F19), reinterpret(0xBF9A55F152528000),\n reinterpret(0x3FF059EEA5ECF92C), reinterpret(0xBF963D62CF818000),\n reinterpret(0x3FF04949CDD12C90), reinterpret(0xBF9228FB8CAA0000),\n reinterpret(0x3FF038C6C6F0ADA9), reinterpret(0xBF8C317B20F90000),\n reinterpret(0x3FF02865137932A9), reinterpret(0xBF8419355DAA0000),\n reinterpret(0x3FF0182427EA7348), reinterpret(0xBF781203C2EC0000),\n reinterpret(0x3FF008040614B195), reinterpret(0xBF60040979240000),\n reinterpret(0x3FEFE01FF726FA1A), reinterpret(0x3F6FEFF384900000),\n reinterpret(0x3FEFA11CC261EA74), reinterpret(0x3F87DC41353D0000),\n reinterpret(0x3FEF6310B081992E), reinterpret(0x3F93CEA3C4C28000),\n reinterpret(0x3FEF25F63CEEADCD), reinterpret(0x3F9B9FC114890000),\n reinterpret(0x3FEEE9C8039113E7), reinterpret(0x3FA1B0D8CE110000),\n reinterpret(0x3FEEAE8078CBB1AB), reinterpret(0x3FA58A5BD001C000),\n reinterpret(0x3FEE741AA29D0C9B), reinterpret(0x3FA95C8340D88000),\n reinterpret(0x3FEE3A91830A99B5), reinterpret(0x3FAD276AEF578000),\n reinterpret(0x3FEE01E009609A56), reinterpret(0x3FB07598E598C000),\n reinterpret(0x3FEDCA01E577BB98), reinterpret(0x3FB253F5E30D2000),\n reinterpret(0x3FED92F20B7C9103), reinterpret(0x3FB42EDD8B380000),\n reinterpret(0x3FED5CAC66FB5CCE), reinterpret(0x3FB606598757C000),\n reinterpret(0x3FED272CAA5EDE9D), reinterpret(0x3FB7DA76356A0000),\n reinterpret(0x3FECF26E3E6B2CCD), reinterpret(0x3FB9AB434E1C6000),\n reinterpret(0x3FECBE6DA2A77902), reinterpret(0x3FBB78C7BB0D6000),\n reinterpret(0x3FEC8B266D37086D), reinterpret(0x3FBD431332E72000),\n reinterpret(0x3FEC5894BD5D5804), reinterpret(0x3FBF0A3171DE6000),\n reinterpret(0x3FEC26B533BB9F8C), reinterpret(0x3FC067152B914000),\n reinterpret(0x3FEBF583EEECE73F), reinterpret(0x3FC147858292B000),\n reinterpret(0x3FEBC4FD75DB96C1), reinterpret(0x3FC2266ECDCA3000),\n reinterpret(0x3FEB951E0C864A28), reinterpret(0x3FC303D7A6C55000),\n reinterpret(0x3FEB65E2C5EF3E2C), reinterpret(0x3FC3DFC33C331000),\n reinterpret(0x3FEB374867C9888B), reinterpret(0x3FC4BA366B7A8000),\n reinterpret(0x3FEB094B211D304A), reinterpret(0x3FC5933928D1F000),\n reinterpret(0x3FEADBE885F2EF7E), reinterpret(0x3FC66ACD2418F000),\n reinterpret(0x3FEAAF1D31603DA2), reinterpret(0x3FC740F8EC669000),\n reinterpret(0x3FEA82E63FD358A7), reinterpret(0x3FC815C0F51AF000),\n reinterpret(0x3FEA5740EF09738B), reinterpret(0x3FC8E92954F68000),\n reinterpret(0x3FEA2C2A90AB4B27), reinterpret(0x3FC9BB3602F84000),\n reinterpret(0x3FEA01A01393F2D1), reinterpret(0x3FCA8BED1C2C0000),\n reinterpret(0x3FE9D79F24DB3C1B), reinterpret(0x3FCB5B515C01D000),\n reinterpret(0x3FE9AE2505C7B190), reinterpret(0x3FCC2967CCBCC000),\n reinterpret(0x3FE9852EF297CE2F), reinterpret(0x3FCCF635D5486000),\n reinterpret(0x3FE95CBAEEA44B75), reinterpret(0x3FCDC1BD3446C000),\n reinterpret(0x3FE934C69DE74838), reinterpret(0x3FCE8C01B8CFE000),\n reinterpret(0x3FE90D4F2F6752E6), reinterpret(0x3FCF5509C0179000),\n reinterpret(0x3FE8E6528EFFD79D), reinterpret(0x3FD00E6C121FB800),\n reinterpret(0x3FE8BFCE9FCC007C), reinterpret(0x3FD071B80E93D000),\n reinterpret(0x3FE899C0DABEC30E), reinterpret(0x3FD0D46B9E867000),\n reinterpret(0x3FE87427AA2317FB), reinterpret(0x3FD13687334BD000),\n reinterpret(0x3FE84F00ACB39A08), reinterpret(0x3FD1980D67234800),\n reinterpret(0x3FE82A49E8653E55), reinterpret(0x3FD1F8FFE0CC8000),\n reinterpret(0x3FE8060195F40260), reinterpret(0x3FD2595FD7636800),\n reinterpret(0x3FE7E22563E0A329), reinterpret(0x3FD2B9300914A800),\n reinterpret(0x3FE7BEB377DCB5AD), reinterpret(0x3FD3187210436000),\n reinterpret(0x3FE79BAA679725C2), reinterpret(0x3FD377266DEC1800),\n reinterpret(0x3FE77907F2170657), reinterpret(0x3FD3D54FFBAF3000),\n reinterpret(0x3FE756CADBD6130C), reinterpret(0x3FD432EEE32FE000)\n]);\n\n// @ts-ignore: decorator\n@lazy @inline const LOG_DATA_TAB2 = memory.data([\n // chi , clo\n reinterpret(0x3FE61000014FB66B), reinterpret(0x3C7E026C91425B3C),\n reinterpret(0x3FE63000034DB495), reinterpret(0x3C8DBFEA48005D41),\n reinterpret(0x3FE650000D94D478), reinterpret(0x3C8E7FA786D6A5B7),\n reinterpret(0x3FE67000074E6FAD), reinterpret(0x3C61FCEA6B54254C),\n reinterpret(0x3FE68FFFFEDF0FAE), reinterpret(0xBC7C7E274C590EFD),\n reinterpret(0x3FE6B0000763C5BC), reinterpret(0xBC8AC16848DCDA01),\n reinterpret(0x3FE6D0001E5CC1F6), reinterpret(0x3C833F1C9D499311),\n reinterpret(0x3FE6EFFFEB05F63E), reinterpret(0xBC7E80041AE22D53),\n reinterpret(0x3FE710000E869780), reinterpret(0x3C7BFF6671097952),\n reinterpret(0x3FE72FFFFC67E912), reinterpret(0x3C8C00E226BD8724),\n reinterpret(0x3FE74FFFDF81116A), reinterpret(0xBC6E02916EF101D2),\n reinterpret(0x3FE770000F679C90), reinterpret(0xBC67FC71CD549C74),\n reinterpret(0x3FE78FFFFA7EC835), reinterpret(0x3C81BEC19EF50483),\n reinterpret(0x3FE7AFFFFE20C2E6), reinterpret(0xBC707E1729CC6465),\n reinterpret(0x3FE7CFFFED3FC900), reinterpret(0xBC808072087B8B1C),\n reinterpret(0x3FE7EFFFE9261A76), reinterpret(0x3C8DC0286D9DF9AE),\n reinterpret(0x3FE81000049CA3E8), reinterpret(0x3C897FD251E54C33),\n reinterpret(0x3FE8300017932C8F), reinterpret(0xBC8AFEE9B630F381),\n reinterpret(0x3FE850000633739C), reinterpret(0x3C89BFBF6B6535BC),\n reinterpret(0x3FE87000204289C6), reinterpret(0xBC8BBF65F3117B75),\n reinterpret(0x3FE88FFFEBF57904), reinterpret(0xBC89006EA23DCB57),\n reinterpret(0x3FE8B00022BC04DF), reinterpret(0xBC7D00DF38E04B0A),\n reinterpret(0x3FE8CFFFE50C1B8A), reinterpret(0xBC88007146FF9F05),\n reinterpret(0x3FE8EFFFFC918E43), reinterpret(0x3C83817BD07A7038),\n reinterpret(0x3FE910001EFA5FC7), reinterpret(0x3C893E9176DFB403),\n reinterpret(0x3FE9300013467BB9), reinterpret(0x3C7F804E4B980276),\n reinterpret(0x3FE94FFFE6EE076F), reinterpret(0xBC8F7EF0D9FF622E),\n reinterpret(0x3FE96FFFDE3C12D1), reinterpret(0xBC7082AA962638BA),\n reinterpret(0x3FE98FFFF4458A0D), reinterpret(0xBC87801B9164A8EF),\n reinterpret(0x3FE9AFFFDD982E3E), reinterpret(0xBC8740E08A5A9337),\n reinterpret(0x3FE9CFFFED49FB66), reinterpret(0x3C3FCE08C19BE000),\n reinterpret(0x3FE9F00020F19C51), reinterpret(0xBC8A3FAA27885B0A),\n reinterpret(0x3FEA10001145B006), reinterpret(0x3C74FF489958DA56),\n reinterpret(0x3FEA300007BBF6FA), reinterpret(0x3C8CBEAB8A2B6D18),\n reinterpret(0x3FEA500010971D79), reinterpret(0x3C88FECADD787930),\n reinterpret(0x3FEA70001DF52E48), reinterpret(0xBC8F41763DD8ABDB),\n reinterpret(0x3FEA90001C593352), reinterpret(0xBC8EBF0284C27612),\n reinterpret(0x3FEAB0002A4F3E4B), reinterpret(0xBC69FD043CFF3F5F),\n reinterpret(0x3FEACFFFD7AE1ED1), reinterpret(0xBC823EE7129070B4),\n reinterpret(0x3FEAEFFFEE510478), reinterpret(0x3C6A063EE00EDEA3),\n reinterpret(0x3FEB0FFFDB650D5B), reinterpret(0x3C5A06C8381F0AB9),\n reinterpret(0x3FEB2FFFFEAACA57), reinterpret(0xBC79011E74233C1D),\n reinterpret(0x3FEB4FFFD995BADC), reinterpret(0xBC79FF1068862A9F),\n reinterpret(0x3FEB7000249E659C), reinterpret(0x3C8AFF45D0864F3E),\n reinterpret(0x3FEB8FFFF9871640), reinterpret(0x3C7CFE7796C2C3F9),\n reinterpret(0x3FEBAFFFD204CB4F), reinterpret(0xBC63FF27EEF22BC4),\n reinterpret(0x3FEBCFFFD2415C45), reinterpret(0xBC6CFFB7EE3BEA21),\n reinterpret(0x3FEBEFFFF86309DF), reinterpret(0xBC814103972E0B5C),\n reinterpret(0x3FEC0FFFE1B57653), reinterpret(0x3C8BC16494B76A19),\n reinterpret(0x3FEC2FFFF1FA57E3), reinterpret(0xBC64FEEF8D30C6ED),\n reinterpret(0x3FEC4FFFDCBFE424), reinterpret(0xBC843F68BCEC4775),\n reinterpret(0x3FEC6FFFED54B9F7), reinterpret(0x3C847EA3F053E0EC),\n reinterpret(0x3FEC8FFFEB998FD5), reinterpret(0x3C7383068DF992F1),\n reinterpret(0x3FECB0002125219A), reinterpret(0xBC68FD8E64180E04),\n reinterpret(0x3FECCFFFDD94469C), reinterpret(0x3C8E7EBE1CC7EA72),\n reinterpret(0x3FECEFFFEAFDC476), reinterpret(0x3C8EBE39AD9F88FE),\n reinterpret(0x3FED1000169AF82B), reinterpret(0x3C757D91A8B95A71),\n reinterpret(0x3FED30000D0FF71D), reinterpret(0x3C89C1906970C7DA),\n reinterpret(0x3FED4FFFEA790FC4), reinterpret(0xBC580E37C558FE0C),\n reinterpret(0x3FED70002EDC87E5), reinterpret(0xBC7F80D64DC10F44),\n reinterpret(0x3FED900021DC82AA), reinterpret(0xBC747C8F94FD5C5C),\n reinterpret(0x3FEDAFFFD86B0283), reinterpret(0x3C8C7F1DC521617E),\n reinterpret(0x3FEDD000296C4739), reinterpret(0x3C88019EB2FFB153),\n reinterpret(0x3FEDEFFFE54490F5), reinterpret(0x3C6E00D2C652CC89),\n reinterpret(0x3FEE0FFFCDABF694), reinterpret(0xBC7F8340202D69D2),\n reinterpret(0x3FEE2FFFDB52C8DD), reinterpret(0x3C7B00C1CA1B0864),\n reinterpret(0x3FEE4FFFF24216EF), reinterpret(0x3C72FFA8B094AB51),\n reinterpret(0x3FEE6FFFE88A5E11), reinterpret(0xBC57F673B1EFBE59),\n reinterpret(0x3FEE9000119EFF0D), reinterpret(0xBC84808D5E0BC801),\n reinterpret(0x3FEEAFFFDFA51744), reinterpret(0x3C780006D54320B5),\n reinterpret(0x3FEED0001A127FA1), reinterpret(0xBC5002F860565C92),\n reinterpret(0x3FEEF00007BABCC4), reinterpret(0xBC8540445D35E611),\n reinterpret(0x3FEF0FFFF57A8D02), reinterpret(0xBC4FFB3139EF9105),\n reinterpret(0x3FEF30001EE58AC7), reinterpret(0x3C8A81ACF2731155),\n reinterpret(0x3FEF4FFFF5823494), reinterpret(0x3C8A3F41D4D7C743),\n reinterpret(0x3FEF6FFFFCA94C6B), reinterpret(0xBC6202F41C987875),\n reinterpret(0x3FEF8FFFE1F9C441), reinterpret(0x3C777DD1F477E74B),\n reinterpret(0x3FEFAFFFD2E0E37E), reinterpret(0xBC6F01199A7CA331),\n reinterpret(0x3FEFD0001C77E49E), reinterpret(0x3C7181EE4BCEACB1),\n reinterpret(0x3FEFEFFFF7E0C331), reinterpret(0xBC6E05370170875A),\n reinterpret(0x3FF00FFFF465606E), reinterpret(0xBC8A7EAD491C0ADA),\n reinterpret(0x3FF02FFFF3867A58), reinterpret(0xBC977F69C3FCB2E0),\n reinterpret(0x3FF04FFFFDFC0D17), reinterpret(0x3C97BFFE34CB945B),\n reinterpret(0x3FF0700003CD4D82), reinterpret(0x3C820083C0E456CB),\n reinterpret(0x3FF08FFFF9F2CBE8), reinterpret(0xBC6DFFDFBE37751A),\n reinterpret(0x3FF0B000010CDA65), reinterpret(0xBC913F7FAEE626EB),\n reinterpret(0x3FF0D00001A4D338), reinterpret(0x3C807DFA79489FF7),\n reinterpret(0x3FF0EFFFFADAFDFD), reinterpret(0xBC77040570D66BC0),\n reinterpret(0x3FF110000BBAFD96), reinterpret(0x3C8E80D4846D0B62),\n reinterpret(0x3FF12FFFFAE5F45D), reinterpret(0x3C9DBFFA64FD36EF),\n reinterpret(0x3FF150000DD59AD9), reinterpret(0x3C9A0077701250AE),\n reinterpret(0x3FF170000F21559A), reinterpret(0x3C8DFDF9E2E3DEEE),\n reinterpret(0x3FF18FFFFC275426), reinterpret(0x3C910030DC3B7273),\n reinterpret(0x3FF1B000123D3C59), reinterpret(0x3C997F7980030188),\n reinterpret(0x3FF1CFFFF8299EB7), reinterpret(0xBC65F932AB9F8C67),\n reinterpret(0x3FF1EFFFF48AD400), reinterpret(0x3C937FBF9DA75BEB),\n reinterpret(0x3FF210000C8B86A4), reinterpret(0x3C9F806B91FD5B22),\n reinterpret(0x3FF2300003854303), reinterpret(0x3C93FFC2EB9FBF33),\n reinterpret(0x3FF24FFFFFBCF684), reinterpret(0x3C7601E77E2E2E72),\n reinterpret(0x3FF26FFFF52921D9), reinterpret(0x3C7FFCBB767F0C61),\n reinterpret(0x3FF2900014933A3C), reinterpret(0xBC7202CA3C02412B),\n reinterpret(0x3FF2B00014556313), reinterpret(0xBC92808233F21F02),\n reinterpret(0x3FF2CFFFEBFE523B), reinterpret(0xBC88FF7E384FDCF2),\n reinterpret(0x3FF2F0000BB8AD96), reinterpret(0xBC85FF51503041C5),\n reinterpret(0x3FF30FFFFB7AE2AF), reinterpret(0xBC810071885E289D),\n reinterpret(0x3FF32FFFFEAC5F7F), reinterpret(0xBC91FF5D3FB7B715),\n reinterpret(0x3FF350000CA66756), reinterpret(0x3C957F82228B82BD),\n reinterpret(0x3FF3700011FBF721), reinterpret(0x3C8000BAC40DD5CC),\n reinterpret(0x3FF38FFFF9592FB9), reinterpret(0xBC943F9D2DB2A751),\n reinterpret(0x3FF3B00004DDD242), reinterpret(0x3C857F6B707638E1),\n reinterpret(0x3FF3CFFFF5B2C957), reinterpret(0x3C7A023A10BF1231),\n reinterpret(0x3FF3EFFFEAB0B418), reinterpret(0x3C987F6D66B152B0),\n reinterpret(0x3FF410001532AFF4), reinterpret(0x3C67F8375F198524),\n reinterpret(0x3FF4300017478B29), reinterpret(0x3C8301E672DC5143),\n reinterpret(0x3FF44FFFE795B463), reinterpret(0x3C89FF69B8B2895A),\n reinterpret(0x3FF46FFFE80475E0), reinterpret(0xBC95C0B19BC2F254),\n reinterpret(0x3FF48FFFEF6FC1E7), reinterpret(0x3C9B4009F23A2A72),\n reinterpret(0x3FF4AFFFE5BEA704), reinterpret(0xBC94FFB7BF0D7D45),\n reinterpret(0x3FF4D000171027DE), reinterpret(0xBC99C06471DC6A3D),\n reinterpret(0x3FF4F0000FF03EE2), reinterpret(0x3C977F890B85531C),\n reinterpret(0x3FF5100012DC4BD1), reinterpret(0x3C6004657166A436),\n reinterpret(0x3FF530001605277A), reinterpret(0xBC96BFCECE233209),\n reinterpret(0x3FF54FFFECDB704C), reinterpret(0xBC8902720505A1D7),\n reinterpret(0x3FF56FFFEF5F54A9), reinterpret(0x3C9BBFE60EC96412),\n reinterpret(0x3FF5900017E61012), reinterpret(0x3C887EC581AFEF90),\n reinterpret(0x3FF5B00003C93E92), reinterpret(0xBC9F41080ABF0CC0),\n reinterpret(0x3FF5D0001D4919BC), reinterpret(0xBC98812AFB254729),\n reinterpret(0x3FF5EFFFE7B87A89), reinterpret(0xBC947EB780ED6904)\n]);\n\n// @ts-ignore: decorator\n@inline\nexport function log_lut(x: f64): f64 {\n const N_MASK = (1 << LOG_TABLE_BITS) - 1;\n\n const\n B0 = reinterpret(0xBFE0000000000000), // -0x1p-1\n B1 = reinterpret(0x3FD5555555555577), // 0x1.5555555555577p-2\n B2 = reinterpret(0xBFCFFFFFFFFFFDCB), // -0x1.ffffffffffdcbp-3\n B3 = reinterpret(0x3FC999999995DD0C), // 0x1.999999995dd0cp-3\n B4 = reinterpret(0xBFC55555556745A7), // -0x1.55555556745a7p-3\n B5 = reinterpret(0x3FC24924A344DE30), // 0x1.24924a344de3p-3\n B6 = reinterpret(0xBFBFFFFFA4423D65), // -0x1.fffffa4423d65p-4\n B7 = reinterpret(0x3FBC7184282AD6CA), // 0x1.c7184282ad6cap-4\n B8 = reinterpret(0xBFB999EB43B068FF), // -0x1.999eb43b068ffp-4\n B9 = reinterpret(0x3FB78182F7AFD085), // 0x1.78182f7afd085p-4\n B10 = reinterpret(0xBFB5521375D145CD); // -0x1.5521375d145cdp-4\n\n const\n A0 = reinterpret(0xBFE0000000000001), // -0x1.0000000000001p-1\n A1 = reinterpret(0x3FD555555551305B), // 0x1.555555551305bp-2\n A2 = reinterpret(0xBFCFFFFFFFEB4590), // -0x1.fffffffeb459p-3\n A3 = reinterpret(0x3FC999B324F10111), // 0x1.999b324f10111p-3\n A4 = reinterpret(0xBFC55575E506C89F); // -0x1.55575e506c89fp-3\n\n const\n LO: u64 = 0x3FEE000000000000,\n HI: u64 = 0x3FF1090000000000;\n\n const\n Ln2hi = reinterpret(0x3FE62E42FEFA3800), // 0x1.62e42fefa3800p-1\n Ln2lo = reinterpret(0x3D2EF35793C76730), // 0x1.ef35793c76730p-45\n Ox1p27 = reinterpret(0x41A0000000000000), // 0x1p27\n Ox1p52 = reinterpret(0x4330000000000000); // 0x1p52\n\n var ix = reinterpret(x);\n if (ix - LO < HI - LO) {\n let r = x - 1.0;\n let r2 = r * r;\n let r3 = r2 * r;\n let y =\n r3 * (B1 + r * B2 + r2 * B3 +\n r3 * (B4 + r * B5 + r2 * B6 +\n r3 * (B7 + r * B8 + r2 * B9 + r3 * B10)));\n // Worst-case error is around 0.507 ULP\n let w = r * Ox1p27;\n let rhi = r + w - w;\n let rlo = r - rhi;\n w = rhi * rhi * B0; // B[0] == -0.5\n let hi = r + w;\n let lo = r - hi + w;\n lo += B0 * rlo * (rhi + r);\n return y + lo + hi;\n }\n var top = u32(ix >> 48);\n if (top - 0x0010 >= 0x7FF0 - 0x0010) {\n // x < 0x1p-1022 or inf or nan\n if ((ix << 1) == 0) return -1.0 / (x * x);\n if (ix == reinterpret(Infinity)) return x; // log(inf) == inf\n if ((top & 0x8000) || (top & 0x7FF0) == 0x7FF0) return (x - x) / (x - x);\n // x is subnormal, normalize it\n ix = reinterpret(x * Ox1p52);\n ix -= u64(52) << 52;\n }\n\n // x = 2^k z; where z is in range [OFF,2*OFF) and exact.\n // The range is split into N subintervals.\n // The ith subinterval contains z and c is near its center.\n var tmp = ix - 0x3FE6000000000000;\n var i = ((tmp >> (52 - LOG_TABLE_BITS)) & N_MASK);\n var k = tmp >> 52;\n var iz = ix - (tmp & (u64(0xFFF) << 52));\n\n var invc = load(LOG_DATA_TAB1 + (i << (1 + alignof())), 0 << alignof()); // T[i].invc;\n var logc = load(LOG_DATA_TAB1 + (i << (1 + alignof())), 1 << alignof()); // T[i].logc;\n var z = reinterpret(iz);\n\n // log(x) = log1p(z/c-1) + log(c) + k*Ln2.\n // r ~= z/c - 1, |r| < 1/(2*N)\n // #if __FP_FAST_FMA\n // \t// rounding error: 0x1p-55/N\n // \tr = __builtin_fma(z, invc, -1.0);\n // #else\n // rounding error: 0x1p-55/N + 0x1p-66\n const chi = load(LOG_DATA_TAB2 + (i << (1 + alignof())), 0 << alignof()); // T2[i].chi\n const clo = load(LOG_DATA_TAB2 + (i << (1 + alignof())), 1 << alignof()); // T2[i].clo\n var r = (z - chi - clo) * invc;\n // #endif\n var kd = k;\n\n // hi + lo = r + log(c) + k*Ln2\n var w = kd * Ln2hi + logc;\n var hi = w + r;\n var lo = w - hi + r + kd * Ln2lo;\n\n // log(x) = lo + (log1p(r) - r) + hi\n var r2 = r * r; // rounding error: 0x1p-54/N^2\n // Worst case error if |y| > 0x1p-5:\n // 0.5 + 4.13/N + abs-poly-error*2^57 ULP (+ 0.002 ULP without fma)\n // Worst case error if |y| > 0x1p-4:\n // 0.5 + 2.06/N + abs-poly-error*2^56 ULP (+ 0.001 ULP without fma).\n return lo + r2 * A0 + r * r2 * (A1 + r * A2 + r2 * (A3 + r * A4)) + hi;\n}\n\n//\n// Lookup data for pow. See: https://git.musl-libc.org/cgit/musl/tree/src/math/pow.c\n//\n\n// @ts-ignore: decorator\n@inline const POW_LOG_TABLE_BITS = 7;\n\n/* Algorithm:\n\n x = 2^k z\n log(x) = k ln2 + log(c) + log(z/c)\n log(z/c) = poly(z/c - 1)\n\nwhere z is in [0x1.69555p-1; 0x1.69555p0] which is split into N subintervals\nand z falls into the ith one, then table entries are computed as\n\n tab[i].invc = 1/c\n tab[i].logc = round(0x1p43*log(c))/0x1p43\n tab[i].logctail = (double)(log(c) - logc)\n\nwhere c is chosen near the center of the subinterval such that 1/c has only a\nfew precision bits so z/c - 1 is exactly representible as double:\n\n 1/c = center < 1 ? round(N/center)/N : round(2*N/center)/N/2\n\nNote: |z/c - 1| < 1/N for the chosen c, |log(c) - logc - logctail| < 0x1p-97,\nthe last few bits of logc are rounded away so k*ln2hi + logc has no rounding\nerror and the interval for z is selected such that near x == 1, where log(x)\nis tiny, large cancellation error is avoided in logc + poly(z/c - 1). */\n\n// @ts-ignore: decorator\n@lazy @inline const POW_LOG_DATA_TAB = memory.data([\n // invc ,pad, logc , logctail\n reinterpret(0x3FF6A00000000000), 0, reinterpret(0xBFD62C82F2B9C800), reinterpret(0x3CFAB42428375680),\n reinterpret(0x3FF6800000000000), 0, reinterpret(0xBFD5D1BDBF580800), reinterpret(0xBD1CA508D8E0F720),\n reinterpret(0x3FF6600000000000), 0, reinterpret(0xBFD5767717455800), reinterpret(0xBD2362A4D5B6506D),\n reinterpret(0x3FF6400000000000), 0, reinterpret(0xBFD51AAD872DF800), reinterpret(0xBCE684E49EB067D5),\n reinterpret(0x3FF6200000000000), 0, reinterpret(0xBFD4BE5F95777800), reinterpret(0xBD041B6993293EE0),\n reinterpret(0x3FF6000000000000), 0, reinterpret(0xBFD4618BC21C6000), reinterpret(0x3D13D82F484C84CC),\n reinterpret(0x3FF5E00000000000), 0, reinterpret(0xBFD404308686A800), reinterpret(0x3CDC42F3ED820B3A),\n reinterpret(0x3FF5C00000000000), 0, reinterpret(0xBFD3A64C55694800), reinterpret(0x3D20B1C686519460),\n reinterpret(0x3FF5A00000000000), 0, reinterpret(0xBFD347DD9A988000), reinterpret(0x3D25594DD4C58092),\n reinterpret(0x3FF5800000000000), 0, reinterpret(0xBFD2E8E2BAE12000), reinterpret(0x3D267B1E99B72BD8),\n reinterpret(0x3FF5600000000000), 0, reinterpret(0xBFD2895A13DE8800), reinterpret(0x3D15CA14B6CFB03F),\n reinterpret(0x3FF5600000000000), 0, reinterpret(0xBFD2895A13DE8800), reinterpret(0x3D15CA14B6CFB03F),\n reinterpret(0x3FF5400000000000), 0, reinterpret(0xBFD22941FBCF7800), reinterpret(0xBD165A242853DA76),\n reinterpret(0x3FF5200000000000), 0, reinterpret(0xBFD1C898C1699800), reinterpret(0xBD1FAFBC68E75404),\n reinterpret(0x3FF5000000000000), 0, reinterpret(0xBFD1675CABABA800), reinterpret(0x3D1F1FC63382A8F0),\n reinterpret(0x3FF4E00000000000), 0, reinterpret(0xBFD1058BF9AE4800), reinterpret(0xBD26A8C4FD055A66),\n reinterpret(0x3FF4C00000000000), 0, reinterpret(0xBFD0A324E2739000), reinterpret(0xBD0C6BEE7EF4030E),\n reinterpret(0x3FF4A00000000000), 0, reinterpret(0xBFD0402594B4D000), reinterpret(0xBCF036B89EF42D7F),\n reinterpret(0x3FF4A00000000000), 0, reinterpret(0xBFD0402594B4D000), reinterpret(0xBCF036B89EF42D7F),\n reinterpret(0x3FF4800000000000), 0, reinterpret(0xBFCFB9186D5E4000), reinterpret(0x3D0D572AAB993C87),\n reinterpret(0x3FF4600000000000), 0, reinterpret(0xBFCEF0ADCBDC6000), reinterpret(0x3D2B26B79C86AF24),\n reinterpret(0x3FF4400000000000), 0, reinterpret(0xBFCE27076E2AF000), reinterpret(0xBD172F4F543FFF10),\n reinterpret(0x3FF4200000000000), 0, reinterpret(0xBFCD5C216B4FC000), reinterpret(0x3D21BA91BBCA681B),\n reinterpret(0x3FF4000000000000), 0, reinterpret(0xBFCC8FF7C79AA000), reinterpret(0x3D27794F689F8434),\n reinterpret(0x3FF4000000000000), 0, reinterpret(0xBFCC8FF7C79AA000), reinterpret(0x3D27794F689F8434),\n reinterpret(0x3FF3E00000000000), 0, reinterpret(0xBFCBC286742D9000), reinterpret(0x3D194EB0318BB78F),\n reinterpret(0x3FF3C00000000000), 0, reinterpret(0xBFCAF3C94E80C000), reinterpret(0x3CBA4E633FCD9066),\n reinterpret(0x3FF3A00000000000), 0, reinterpret(0xBFCA23BC1FE2B000), reinterpret(0xBD258C64DC46C1EA),\n reinterpret(0x3FF3A00000000000), 0, reinterpret(0xBFCA23BC1FE2B000), reinterpret(0xBD258C64DC46C1EA),\n reinterpret(0x3FF3800000000000), 0, reinterpret(0xBFC9525A9CF45000), reinterpret(0xBD2AD1D904C1D4E3),\n reinterpret(0x3FF3600000000000), 0, reinterpret(0xBFC87FA06520D000), reinterpret(0x3D2BBDBF7FDBFA09),\n reinterpret(0x3FF3400000000000), 0, reinterpret(0xBFC7AB890210E000), reinterpret(0x3D2BDB9072534A58),\n reinterpret(0x3FF3400000000000), 0, reinterpret(0xBFC7AB890210E000), reinterpret(0x3D2BDB9072534A58),\n reinterpret(0x3FF3200000000000), 0, reinterpret(0xBFC6D60FE719D000), reinterpret(0xBD10E46AA3B2E266),\n reinterpret(0x3FF3000000000000), 0, reinterpret(0xBFC5FF3070A79000), reinterpret(0xBD1E9E439F105039),\n reinterpret(0x3FF3000000000000), 0, reinterpret(0xBFC5FF3070A79000), reinterpret(0xBD1E9E439F105039),\n reinterpret(0x3FF2E00000000000), 0, reinterpret(0xBFC526E5E3A1B000), reinterpret(0xBD20DE8B90075B8F),\n reinterpret(0x3FF2C00000000000), 0, reinterpret(0xBFC44D2B6CCB8000), reinterpret(0x3D170CC16135783C),\n reinterpret(0x3FF2C00000000000), 0, reinterpret(0xBFC44D2B6CCB8000), reinterpret(0x3D170CC16135783C),\n reinterpret(0x3FF2A00000000000), 0, reinterpret(0xBFC371FC201E9000), reinterpret(0x3CF178864D27543A),\n reinterpret(0x3FF2800000000000), 0, reinterpret(0xBFC29552F81FF000), reinterpret(0xBD248D301771C408),\n reinterpret(0x3FF2600000000000), 0, reinterpret(0xBFC1B72AD52F6000), reinterpret(0xBD2E80A41811A396),\n reinterpret(0x3FF2600000000000), 0, reinterpret(0xBFC1B72AD52F6000), reinterpret(0xBD2E80A41811A396),\n reinterpret(0x3FF2400000000000), 0, reinterpret(0xBFC0D77E7CD09000), reinterpret(0x3D0A699688E85BF4),\n reinterpret(0x3FF2400000000000), 0, reinterpret(0xBFC0D77E7CD09000), reinterpret(0x3D0A699688E85BF4),\n reinterpret(0x3FF2200000000000), 0, reinterpret(0xBFBFEC9131DBE000), reinterpret(0xBD2575545CA333F2),\n reinterpret(0x3FF2000000000000), 0, reinterpret(0xBFBE27076E2B0000), reinterpret(0x3D2A342C2AF0003C),\n reinterpret(0x3FF2000000000000), 0, reinterpret(0xBFBE27076E2B0000), reinterpret(0x3D2A342C2AF0003C),\n reinterpret(0x3FF1E00000000000), 0, reinterpret(0xBFBC5E548F5BC000), reinterpret(0xBD1D0C57585FBE06),\n reinterpret(0x3FF1C00000000000), 0, reinterpret(0xBFBA926D3A4AE000), reinterpret(0x3D253935E85BAAC8),\n reinterpret(0x3FF1C00000000000), 0, reinterpret(0xBFBA926D3A4AE000), reinterpret(0x3D253935E85BAAC8),\n reinterpret(0x3FF1A00000000000), 0, reinterpret(0xBFB8C345D631A000), reinterpret(0x3D137C294D2F5668),\n reinterpret(0x3FF1A00000000000), 0, reinterpret(0xBFB8C345D631A000), reinterpret(0x3D137C294D2F5668),\n reinterpret(0x3FF1800000000000), 0, reinterpret(0xBFB6F0D28AE56000), reinterpret(0xBD269737C93373DA),\n reinterpret(0x3FF1600000000000), 0, reinterpret(0xBFB51B073F062000), reinterpret(0x3D1F025B61C65E57),\n reinterpret(0x3FF1600000000000), 0, reinterpret(0xBFB51B073F062000), reinterpret(0x3D1F025B61C65E57),\n reinterpret(0x3FF1400000000000), 0, reinterpret(0xBFB341D7961BE000), reinterpret(0x3D2C5EDACCF913DF),\n reinterpret(0x3FF1400000000000), 0, reinterpret(0xBFB341D7961BE000), reinterpret(0x3D2C5EDACCF913DF),\n reinterpret(0x3FF1200000000000), 0, reinterpret(0xBFB16536EEA38000), reinterpret(0x3D147C5E768FA309),\n reinterpret(0x3FF1000000000000), 0, reinterpret(0xBFAF0A30C0118000), reinterpret(0x3D2D599E83368E91),\n reinterpret(0x3FF1000000000000), 0, reinterpret(0xBFAF0A30C0118000), reinterpret(0x3D2D599E83368E91),\n reinterpret(0x3FF0E00000000000), 0, reinterpret(0xBFAB42DD71198000), reinterpret(0x3D1C827AE5D6704C),\n reinterpret(0x3FF0E00000000000), 0, reinterpret(0xBFAB42DD71198000), reinterpret(0x3D1C827AE5D6704C),\n reinterpret(0x3FF0C00000000000), 0, reinterpret(0xBFA77458F632C000), reinterpret(0xBD2CFC4634F2A1EE),\n reinterpret(0x3FF0C00000000000), 0, reinterpret(0xBFA77458F632C000), reinterpret(0xBD2CFC4634F2A1EE),\n reinterpret(0x3FF0A00000000000), 0, reinterpret(0xBFA39E87B9FEC000), reinterpret(0x3CF502B7F526FEAA),\n reinterpret(0x3FF0A00000000000), 0, reinterpret(0xBFA39E87B9FEC000), reinterpret(0x3CF502B7F526FEAA),\n reinterpret(0x3FF0800000000000), 0, reinterpret(0xBF9F829B0E780000), reinterpret(0xBD2980267C7E09E4),\n reinterpret(0x3FF0800000000000), 0, reinterpret(0xBF9F829B0E780000), reinterpret(0xBD2980267C7E09E4),\n reinterpret(0x3FF0600000000000), 0, reinterpret(0xBF97B91B07D58000), reinterpret(0xBD288D5493FAA639),\n reinterpret(0x3FF0400000000000), 0, reinterpret(0xBF8FC0A8B0FC0000), reinterpret(0xBCDF1E7CF6D3A69C),\n reinterpret(0x3FF0400000000000), 0, reinterpret(0xBF8FC0A8B0FC0000), reinterpret(0xBCDF1E7CF6D3A69C),\n reinterpret(0x3FF0200000000000), 0, reinterpret(0xBF7FE02A6B100000), reinterpret(0xBD19E23F0DDA40E4),\n reinterpret(0x3FF0200000000000), 0, reinterpret(0xBF7FE02A6B100000), reinterpret(0xBD19E23F0DDA40E4),\n reinterpret(0x3FF0000000000000), 0, 0, 0,\n reinterpret(0x3FF0000000000000), 0, 0, 0,\n reinterpret(0x3FEFC00000000000), 0, reinterpret(0x3F80101575890000), reinterpret(0xBD10C76B999D2BE8),\n reinterpret(0x3FEF800000000000), 0, reinterpret(0x3F90205658938000), reinterpret(0xBD23DC5B06E2F7D2),\n reinterpret(0x3FEF400000000000), 0, reinterpret(0x3F98492528C90000), reinterpret(0xBD2AA0BA325A0C34),\n reinterpret(0x3FEF000000000000), 0, reinterpret(0x3FA0415D89E74000), reinterpret(0x3D0111C05CF1D753),\n reinterpret(0x3FEEC00000000000), 0, reinterpret(0x3FA466AED42E0000), reinterpret(0xBD2C167375BDFD28),\n reinterpret(0x3FEE800000000000), 0, reinterpret(0x3FA894AA149FC000), reinterpret(0xBD197995D05A267D),\n reinterpret(0x3FEE400000000000), 0, reinterpret(0x3FACCB73CDDDC000), reinterpret(0xBD1A68F247D82807),\n reinterpret(0x3FEE200000000000), 0, reinterpret(0x3FAEEA31C006C000), reinterpret(0xBD0E113E4FC93B7B),\n reinterpret(0x3FEDE00000000000), 0, reinterpret(0x3FB1973BD1466000), reinterpret(0xBD25325D560D9E9B),\n reinterpret(0x3FEDA00000000000), 0, reinterpret(0x3FB3BDF5A7D1E000), reinterpret(0x3D2CC85EA5DB4ED7),\n reinterpret(0x3FED600000000000), 0, reinterpret(0x3FB5E95A4D97A000), reinterpret(0xBD2C69063C5D1D1E),\n reinterpret(0x3FED400000000000), 0, reinterpret(0x3FB700D30AEAC000), reinterpret(0x3CEC1E8DA99DED32),\n reinterpret(0x3FED000000000000), 0, reinterpret(0x3FB9335E5D594000), reinterpret(0x3D23115C3ABD47DA),\n reinterpret(0x3FECC00000000000), 0, reinterpret(0x3FBB6AC88DAD6000), reinterpret(0xBD1390802BF768E5),\n reinterpret(0x3FECA00000000000), 0, reinterpret(0x3FBC885801BC4000), reinterpret(0x3D2646D1C65AACD3),\n reinterpret(0x3FEC600000000000), 0, reinterpret(0x3FBEC739830A2000), reinterpret(0xBD2DC068AFE645E0),\n reinterpret(0x3FEC400000000000), 0, reinterpret(0x3FBFE89139DBE000), reinterpret(0xBD2534D64FA10AFD),\n reinterpret(0x3FEC000000000000), 0, reinterpret(0x3FC1178E8227E000), reinterpret(0x3D21EF78CE2D07F2),\n reinterpret(0x3FEBE00000000000), 0, reinterpret(0x3FC1AA2B7E23F000), reinterpret(0x3D2CA78E44389934),\n reinterpret(0x3FEBA00000000000), 0, reinterpret(0x3FC2D1610C868000), reinterpret(0x3D039D6CCB81B4A1),\n reinterpret(0x3FEB800000000000), 0, reinterpret(0x3FC365FCB0159000), reinterpret(0x3CC62FA8234B7289),\n reinterpret(0x3FEB400000000000), 0, reinterpret(0x3FC4913D8333B000), reinterpret(0x3D25837954FDB678),\n reinterpret(0x3FEB200000000000), 0, reinterpret(0x3FC527E5E4A1B000), reinterpret(0x3D2633E8E5697DC7),\n reinterpret(0x3FEAE00000000000), 0, reinterpret(0x3FC6574EBE8C1000), reinterpret(0x3D19CF8B2C3C2E78),\n reinterpret(0x3FEAC00000000000), 0, reinterpret(0x3FC6F0128B757000), reinterpret(0xBD25118DE59C21E1),\n reinterpret(0x3FEAA00000000000), 0, reinterpret(0x3FC7898D85445000), reinterpret(0xBD1C661070914305),\n reinterpret(0x3FEA600000000000), 0, reinterpret(0x3FC8BEAFEB390000), reinterpret(0xBD073D54AAE92CD1),\n reinterpret(0x3FEA400000000000), 0, reinterpret(0x3FC95A5ADCF70000), reinterpret(0x3D07F22858A0FF6F),\n reinterpret(0x3FEA000000000000), 0, reinterpret(0x3FCA93ED3C8AE000), reinterpret(0xBD28724350562169),\n reinterpret(0x3FE9E00000000000), 0, reinterpret(0x3FCB31D8575BD000), reinterpret(0xBD0C358D4EACE1AA),\n reinterpret(0x3FE9C00000000000), 0, reinterpret(0x3FCBD087383BE000), reinterpret(0xBD2D4BC4595412B6),\n reinterpret(0x3FE9A00000000000), 0, reinterpret(0x3FCC6FFBC6F01000), reinterpret(0xBCF1EC72C5962BD2),\n reinterpret(0x3FE9600000000000), 0, reinterpret(0x3FCDB13DB0D49000), reinterpret(0xBD2AFF2AF715B035),\n reinterpret(0x3FE9400000000000), 0, reinterpret(0x3FCE530EFFE71000), reinterpret(0x3CC212276041F430),\n reinterpret(0x3FE9200000000000), 0, reinterpret(0x3FCEF5ADE4DD0000), reinterpret(0xBCCA211565BB8E11),\n reinterpret(0x3FE9000000000000), 0, reinterpret(0x3FCF991C6CB3B000), reinterpret(0x3D1BCBECCA0CDF30),\n reinterpret(0x3FE8C00000000000), 0, reinterpret(0x3FD07138604D5800), reinterpret(0x3CF89CDB16ED4E91),\n reinterpret(0x3FE8A00000000000), 0, reinterpret(0x3FD0C42D67616000), reinterpret(0x3D27188B163CEAE9),\n reinterpret(0x3FE8800000000000), 0, reinterpret(0x3FD1178E8227E800), reinterpret(0xBD2C210E63A5F01C),\n reinterpret(0x3FE8600000000000), 0, reinterpret(0x3FD16B5CCBACF800), reinterpret(0x3D2B9ACDF7A51681),\n reinterpret(0x3FE8400000000000), 0, reinterpret(0x3FD1BF99635A6800), reinterpret(0x3D2CA6ED5147BDB7),\n reinterpret(0x3FE8200000000000), 0, reinterpret(0x3FD214456D0EB800), reinterpret(0x3D0A87DEBA46BAEA),\n reinterpret(0x3FE7E00000000000), 0, reinterpret(0x3FD2BEF07CDC9000), reinterpret(0x3D2A9CFA4A5004F4),\n reinterpret(0x3FE7C00000000000), 0, reinterpret(0x3FD314F1E1D36000), reinterpret(0xBD28E27AD3213CB8),\n reinterpret(0x3FE7A00000000000), 0, reinterpret(0x3FD36B6776BE1000), reinterpret(0x3D116ECDB0F177C8),\n reinterpret(0x3FE7800000000000), 0, reinterpret(0x3FD3C25277333000), reinterpret(0x3D183B54B606BD5C),\n reinterpret(0x3FE7600000000000), 0, reinterpret(0x3FD419B423D5E800), reinterpret(0x3D08E436EC90E09D),\n reinterpret(0x3FE7400000000000), 0, reinterpret(0x3FD4718DC271C800), reinterpret(0xBD2F27CE0967D675),\n reinterpret(0x3FE7200000000000), 0, reinterpret(0x3FD4C9E09E173000), reinterpret(0xBD2E20891B0AD8A4),\n reinterpret(0x3FE7000000000000), 0, reinterpret(0x3FD522AE0738A000), reinterpret(0x3D2EBE708164C759),\n reinterpret(0x3FE6E00000000000), 0, reinterpret(0x3FD57BF753C8D000), reinterpret(0x3D1FADEDEE5D40EF),\n reinterpret(0x3FE6C00000000000), 0, reinterpret(0x3FD5D5BDDF596000), reinterpret(0xBD0A0B2A08A465DC)\n]);\n\n// Returns 0 if not int, 1 if odd int, 2 if even int. The argument is\n// the bit representation of a non-zero finite floating-point value.\n// @ts-ignore: decorator\n@inline\nfunction checkint(iy: u64): i32 {\n var e = iy >> 52 & 0x7FF;\n if (e < 0x3FF ) return 0;\n if (e > 0x3FF + 52) return 2;\n e = u64(1) << (0x3FF + 52 - e);\n if (iy & (e - 1)) return 0;\n if (iy & e ) return 1;\n return 2;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction xflow(sign: u32, y: f64): f64 {\n return select(-y, y, sign) * y;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction uflow(sign: u32): f64 {\n return xflow(sign, reinterpret(0x1000000000000000)); // 0x1p-767\n}\n\n// @ts-ignore: decorator\n@inline\nfunction oflow(sign: u32): f64 {\n return xflow(sign, reinterpret(0x7000000000000000)); // 0x1p769\n}\n\n// Returns 1 if input is the bit representation of 0, infinity or nan.\n// @ts-ignore: decorator\n@inline\nfunction zeroinfnan(u: u64): bool {\n return (u << 1) - 1 >= 0xFFE0000000000000 - 1;\n}\n\n// @ts-ignore: decorator\n@lazy var log_tail: f64 = 0;\n\n// Compute y+TAIL = log(x) where the rounded result is y and TAIL has about\n// additional 15 bits precision. IX is the bit representation of x, but\n// normalized in the subnormal range using the sign bit for the exponent.\n// @ts-ignore: decorator\n@inline\nfunction log_inline(ix: u64): f64 {\n const N = 1 << POW_LOG_TABLE_BITS;\n const N_MASK = N - 1;\n\n const\n Ln2hi = reinterpret(0x3FE62E42FEFA3800),\n Ln2lo = reinterpret(0x3D2EF35793C76730);\n\n const\n A0 = reinterpret(0xBFE0000000000000),\n A1 = reinterpret(0xBFE5555555555560),\n A2 = reinterpret(0x3FE0000000000006),\n A3 = reinterpret(0x3FE999999959554E),\n A4 = reinterpret(0xBFE555555529A47A),\n A5 = reinterpret(0xBFF2495B9B4845E9),\n A6 = reinterpret(0x3FF0002B8B263FC3);\n\n // x = 2^k z; where z is in range [OFF,2*OFF) and exact.\n // The range is split into N subintervals.\n // The ith subinterval contains z and c is near its center.\n var tmp = ix - 0x3fE6955500000000;\n var i = ((tmp >> (52 - POW_LOG_TABLE_BITS)) & N_MASK);\n var k = tmp >> 52;\n var iz = ix - (tmp & u64(0xFFF) << 52);\n var z = reinterpret(iz);\n var kd = k;\n\n // log(x) = k*Ln2 + log(c) + log1p(z/c-1).\n var invc = load(POW_LOG_DATA_TAB + (i << (2 + alignof())), 0 << alignof()); // tab[i].invc\n var logc = load(POW_LOG_DATA_TAB + (i << (2 + alignof())), 2 << alignof()); // tab[i].logc\n var logctail = load(POW_LOG_DATA_TAB + (i << (2 + alignof())), 3 << alignof()); // tab[i].logctail\n\n // Note: 1/c is j/N or j/N/2 where j is an integer in [N,2N) and\n // |z/c - 1| < 1/N, so r = z/c - 1 is exactly representible.\n // Split z such that rhi, rlo and rhi*rhi are exact and |rlo| <= |r|.\n var zhi = reinterpret((iz + u64(0x80000000)) & 0xFFFFFFFF00000000);\n var zlo = z - zhi;\n var rhi = zhi * invc - 1.0;\n var rlo = zlo * invc;\n var r = rhi + rlo;\n\n // k * Ln2 + log(c) + r.\n var t1 = kd * Ln2hi + logc;\n var t2 = t1 + r;\n var lo1 = kd * Ln2lo + logctail;\n var lo2 = t1 - t2 + r;\n\n // Evaluation is optimized assuming superscalar pipelined execution.\n var ar = A0 * r; // A[0] = -0.5\n var ar2 = r * ar;\n var ar3 = r * ar2;\n // k * Ln2 + log(c) + r + A[0] * r * r.\n var arhi = A0 * rhi;\n var arhi2 = rhi * arhi;\n var hi = t2 + arhi2;\n var lo3 = rlo * (ar + arhi);\n var lo4 = t2 - hi + arhi2;\n\n // p = log1p(r) - r - A[0] * r * r.\n var p = ar3 * (A1 + r * A2 + ar2 * (A3 + r * A4 + ar2 * (A5 + r * A6)));\n var lo = lo1 + lo2 + lo3 + lo4 + p;\n var y = hi + lo;\n log_tail = hi - y + lo;\n\n return y;\n}\n\n// @ts-ignore: decorator\n@inline const SIGN_BIAS = 0x800 << EXP_TABLE_BITS;\n\n// Computes sign*exp(x+xtail) where |xtail| < 2^-8/N and |xtail| <= |x|.\n// The sign_bias argument is SIGN_BIAS or 0 and sets the sign to -1 or 1.\n// @ts-ignore: decorator\n@inline\nfunction exp_inline(x: f64, xtail: f64, sign_bias: u32): f64 {\n const N = 1 << EXP_TABLE_BITS;\n const N_MASK = N - 1;\n\n const\n InvLn2N = reinterpret(0x3FF71547652B82FE) * N, // 0x1.71547652b82fep0\n NegLn2hiN = reinterpret(0xBF762E42FEFA0000), // -0x1.62e42fefa0000p-8\n NegLn2loN = reinterpret(0xBD0CF79ABC9E3B3A), // -0x1.cf79abc9e3b3ap-47\n shift = reinterpret(0x4338000000000000); // 0x1.8p52\n\n const\n C2 = reinterpret(0x3FDFFFFFFFFFFDBD), // __exp_data.poly[0] (0x1.ffffffffffdbdp-2)\n C3 = reinterpret(0x3FC555555555543C), // __exp_data.poly[1] (0x1.555555555543cp-3)\n C4 = reinterpret(0x3FA55555CF172B91), // __exp_data.poly[2] (0x1.55555cf172b91p-5)\n C5 = reinterpret(0x3F81111167A4D017); // __exp_data.poly[3] (0x1.1111167a4d017p-7)\n\n var abstop: u32;\n var ki: u64, top: u64, sbits: u64;\n var idx: usize;\n // double_t for better performance on targets with FLT_EVAL_METHOD==2.\n var kd: f64, z: f64, r: f64, r2: f64, scale: f64, tail: f64, tmp: f64;\n\n var ux = reinterpret(x);\n abstop = (ux >> 52) & 0x7FF;\n if (abstop - 0x3C9 >= 0x03F) {\n if (abstop - 0x3C9 >= 0x80000000) {\n // Avoid spurious underflow for tiny x.\n // Note: 0 is common input.\n return select(-1.0, 1.0, sign_bias);\n }\n if (abstop >= 0x409) { // top12(1024.0)\n // Note: inf and nan are already handled.\n return ux >> 63 ? uflow(sign_bias) : oflow(sign_bias);\n }\n // Large x is special cased below.\n abstop = 0;\n }\n\n // exp(x) = 2^(k/N) * exp(r), with exp(r) in [2^(-1/2N),2^(1/2N)].\n // x = ln2/N*k + r, with int k and r in [-ln2/2N, ln2/2N].\n z = InvLn2N * x;\n\n // #if TOINT_INTRINSICS\n // kd = roundtoint(z);\n // ki = converttoint(z);\n // #elif EXP_USE_TOINT_NARROW\n // // z - kd is in [-0.5-2^-16, 0.5] in all rounding modes.\n // kd = eval_as_double(z + shift);\n // ki = asuint64(kd) >> 16;\n // kd = (double_t)(int32_t)ki;\n // #else\n // z - kd is in [-1, 1] in non-nearest rounding modes\n kd = z + shift;\n ki = reinterpret(kd);\n kd -= shift;\n // #endif\n r = x + kd * NegLn2hiN + kd * NegLn2loN;\n // The code assumes 2^-200 < |xtail| < 2^-8/N\n r += xtail;\n // 2^(k/N) ~= scale * (1 + tail)\n idx = ((ki & N_MASK) << 1);\n top = (ki + sign_bias) << (52 - EXP_TABLE_BITS);\n\n tail = reinterpret(load(EXP_DATA_TAB + (idx << alignof())));\n // This is only a valid scale when -1023*N < k < 1024*N\n sbits = load(EXP_DATA_TAB + (idx << alignof()), 1 << alignof()) + top;\n // exp(x) = 2^(k/N) * exp(r) ~= scale + scale * (tail + exp(r) - 1).\n // Evaluation is optimized assuming superscalar pipelined execution.\n r2 = r * r;\n // Without fma the worst case error is 0.25/N ulp larger.\n // Worst case error is less than 0.5+1.11/N+(abs poly error * 2^53) ulp\n tmp = tail + r + r2 * (C2 + r * C3) + r2 * r2 * (C4 + r * C5);\n if (abstop == 0) return specialcase(tmp, sbits, ki);\n scale = reinterpret(sbits);\n // Note: tmp == 0 or |tmp| > 2^-200 and scale > 2^-739, so there\n // is no spurious underflow here even without fma.\n return scale + scale * tmp;\n}\n\n// @ts-ignore: decorator\n@inline\nexport function pow_lut(x: f64, y: f64): f64 {\n const Ox1p52 = reinterpret(0x4330000000000000); // 0x1p52\n\n var sign_bias: u32 = 0;\n var ix = reinterpret(x);\n var iy = reinterpret(y);\n var topx = ix >> 52;\n var topy = iy >> 52;\n\n if (topx - 0x001 >= 0x7FF - 0x001 || (topy & 0x7FF) - 0x3BE >= 0x43e - 0x3BE) {\n // Note: if |y| > 1075 * ln2 * 2^53 ~= 0x1.749p62 then pow(x,y) = inf/0\n // and if |y| < 2^-54 / 1075 ~= 0x1.e7b6p-65 then pow(x,y) = +-1.\n // Special cases: (x < 0x1p-126 or inf or nan) or\n // (|y| < 0x1p-65 or |y| >= 0x1p63 or nan).\n if (zeroinfnan(iy)) {\n if ((iy << 1) == 0) return 1.0;\n if (ix == 0x3FF0000000000000) return NaN; // original: 1.0\n if ((ix << 1) > 0xFFE0000000000000 || (iy << 1) > 0xFFE0000000000000) return x + y;\n if ((ix << 1) == 0x7FE0000000000000) return NaN; // original: 1.0\n if (((ix << 1) < 0x7FE0000000000000) == !(iy >> 63)) return 0; // |x|<1 && y==inf or |x|>1 && y==-inf.\n return y * y;\n }\n if (zeroinfnan(ix)) {\n let x2 = x * x;\n if (i32(ix >> 63) && checkint(iy) == 1) x2 = -x2;\n return iy >> 63 ? 1 / x2 : x2;\n }\n // Here x and y are non-zero finite\n if (ix >> 63) {\n // Finite x < 0\n let yint = checkint(iy);\n if (yint == 0) return (x - x) / (x - x);\n if (yint == 1) sign_bias = SIGN_BIAS;\n ix &= 0x7FFFFFFFFFFFFFFF;\n topx &= 0x7FF;\n }\n if ((topy & 0x7FF) - 0x3BE >= 0x43E - 0x3BE) {\n // Note: sign_bias == 0 here because y is not odd.\n if (ix == 0x3FF0000000000000) return 1;\n if ((topy & 0x7FF) < 0x3BE) return 1; // |y| < 2^-65, x^y ~= 1 + y*log(x).\n return (ix > 0x3FF0000000000000) == (topy < 0x800) ? Infinity : 0;\n }\n if (topx == 0) {\n // Normalize subnormal x so exponent becomes negative.\n ix = reinterpret(x * Ox1p52);\n ix &= 0x7FFFFFFFFFFFFFFF;\n ix -= u64(52) << 52;\n }\n }\n\n var hi = log_inline(ix);\n var lo = log_tail;\n var ehi: f64, elo: f64;\n // #if __FP_FAST_FMA\n // ehi = y * hi;\n // elo = y * lo + __builtin_fma(y, hi, -ehi);\n // #else\n var yhi = reinterpret(iy & 0xFFFFFFFFF8000000);\n var ylo = y - yhi;\n var lhi = reinterpret(reinterpret(hi) & 0xFFFFFFFFF8000000);\n var llo = hi - lhi + lo;\n ehi = yhi * lhi;\n elo = ylo * lhi + y * llo; // |elo| < |ehi| * 2^-25.\n // #endif\n return exp_inline(ehi, elo, sign_bias);\n}\n","import { itoa32, utoa32, itoa64, utoa64, dtoa, itoa_buffered, dtoa_buffered, MAX_DOUBLE_LENGTH } from \"./number\";\nimport { ipow32 } from \"../math\";\n\n// All tables are stored as two staged lookup tables (static tries)\n// because the full range of Unicode symbols can't be efficiently\n// represented as-is in memory (see Unicode spec ch 5, p.196):\n// https://www.unicode.org/versions/Unicode12.0.0/ch05.pdf\n// Tables have been generated using these forked musl tools:\n// https://github.com/MaxGraey/musl-chartable-tools/tree/case-ignorable\n\n// Lookup table to check if a character is alphanumeric or not\n// See: https://git.musl-libc.org/cgit/musl/tree/src/ctype/alpha.h\n// size: 3904 bytes\n// @ts-ignore\n@inline @lazy const ALPHA_TABLE = memory.data([\n 18,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,17,34,35,36,17,37,38,39,40,\n 41,42,43,44,17,45,46,47,16,16,48,16,16,16,16,16,16,16,49,50,51,16,52,53,16,16,\n 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,54,\n 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,\n 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,\n 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,\n 17,17,17,55,17,17,17,17,56,17,57,58,59,60,61,62,17,17,17,17,17,17,17,17,17,17,\n 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,\n 17,17,17,17,17,17,17,63,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,64,65,17,66,67,\n 68,69,70,71,72,73,74,17,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,\n 93,94,16,95,96,97,98,17,17,17,99,100,101,16,16,16,16,16,16,16,16,16,16,17,17,\n 17,17,102,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,103,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,17,17,104,105,16,16,106,107,17,17,17,17,17,17,17,17,17,17,17,17,17,\n 17,17,17,17,17,17,17,17,17,17,108,17,17,17,17,109,110,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 17,111,112,16,16,16,16,16,16,16,16,16,113,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,114,115,116,117,16,16,16,16,16,16,16,16,118,\n 119,120,16,16,16,16,16,121,122,16,16,16,16,123,16,16,124,16,16,16,16,16,16,16,\n 16,16,125,16,16,16,\n 16,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,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,254,255,255,7,254,\n 255,255,7,0,0,0,0,0,4,32,4,255,255,127,255,255,255,127,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,195,255,3,0,31,80,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,223,188,64,215,255,255,\n 251,255,255,255,255,255,255,255,255,255,191,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,3,252,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,254,255,255,255,127,2,255,255,255,\n 255,255,1,0,0,0,0,255,191,182,0,255,255,255,135,7,0,0,0,255,7,255,255,255,255,\n 255,255,255,254,255,195,255,255,255,255,255,255,255,255,255,255,255,255,239,\n 31,254,225,255,\n 159,0,0,255,255,255,255,255,255,0,224,255,255,255,255,255,255,255,255,255,255,\n 255,255,3,0,255,255,255,255,255,7,48,4,255,255,255,252,255,31,0,0,255,255,255,\n 1,255,7,0,0,0,0,0,0,255,255,223,255,255,0,240,255,248,3,255,255,255,255,255,\n 255,255,255,255,239,255,223,225,255,207,255,254,255,239,159,249,255,255,253,\n 197,227,159,89,128,176,207,255,3,16,238,135,249,255,255,253,109,195,135,25,2,\n 94,192,255,63,0,238,191,251,255,255,253,237,227,191,27,1,0,207,255,0,30,238,\n 159,249,255,255,253,237,227,159,25,192,176,207,255,2,0,236,199,61,214,24,199,\n 255,195,199,29,129,0,192,255,0,0,239,223,253,255,255,253,255,227,223,29,96,7,\n 207,255,0,0,239,223,253,255,255,253,239,227,223,29,96,64,207,255,6,0,255,223,\n 253,255,255,255,255,231,223,93,240,128,207,255,0,252,238,255,127,252,255,255,\n 251,47,127,128,95,255,192,255,12,0,254,255,255,255,255,127,255,7,63,32,255,3,\n 0,0,0,0,214,247,255,255,175,255,255,59,95,32,255,243,0,0,0,\n 0,1,0,0,0,255,3,0,0,255,254,255,255,255,31,254,255,3,255,255,254,255,255,255,\n 31,0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,249,255,3,255,255,255,255,255,\n 255,255,255,255,63,255,255,255,255,191,32,255,255,255,255,255,247,255,255,255,\n 255,255,255,255,255,255,61,127,61,255,255,255,255,255,61,255,255,255,255,61,\n 127,61,255,127,255,255,255,255,255,255,255,61,255,255,255,255,255,255,255,255,\n 7,0,0,0,0,255,255,0,0,255,255,255,255,255,255,255,255,255,255,63,63,254,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,159,255,255,254,255,255,7,255,255,255,255,255,255,255,255,\n 255,199,255,1,255,223,15,0,255,255,15,0,255,255,15,0,255,223,13,0,255,255,255,\n 255,255,255,207,255,255,1,128,16,255,3,0,0,0,0,255,3,255,255,255,255,255,255,\n 255,255,255,255,255,1,255,255,255,255,255,7,255,255,255,255,255,255,255,255,\n 63,\n 0,255,255,255,127,255,15,255,1,192,255,255,255,255,63,31,0,255,255,255,255,\n 255,15,255,255,255,3,255,3,0,0,0,0,255,255,255,15,255,255,255,255,255,255,255,\n 127,254,255,31,0,255,3,255,3,128,0,0,128,1,0,0,0,0,0,0,0,255,255,255,255,255,\n 255,239,255,239,15,255,3,0,0,0,0,255,255,255,255,255,243,255,255,255,255,255,\n 255,191,255,3,0,255,255,255,255,255,255,127,0,255,227,255,255,255,255,255,63,\n 255,1,255,255,255,255,255,231,0,0,0,0,0,222,111,4,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,\n 128,255,31,0,255,255,63,63,255,255,255,255,63,63,255,170,255,255,255,63,255,\n 255,255,255,255,255,223,95,220,31,207,15,255,31,220,31,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,2,128,0,0,255,31,0,0,0,0,0,0,0,0,0,0,0,0,132,252,47,62,80,189,255,243,\n 224,67,0,0,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,255,255,255,255,255,255,3,0,\n 0,255,255,255,255,255,127,255,255,255,255,255,127,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,31,120,12,0,255,255,255,255,191,32,255,\n 255,255,255,255,255,255,128,0,0,255,255,127,0,127,127,127,127,127,127,127,127,\n 255,255,255,255,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,224,0,0,0,254,3,62,31,254,255,255,255,255,255,255,255,255,255,127,224,254,\n 255,255,255,255,255,255,255,255,255,255,247,224,255,255,255,255,255,254,255,\n 255,255,255,255,255,255,255,255,255,127,0,0,255,255,255,255,0,0,0,0,0,0,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,\n 31,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0,\n 0,0,0,0,0,0,255,255,255,255,255,63,255,31,255,255,255,15,0,0,255,255,255,255,\n 255,127,240,143,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,\n 0,128,255,252,255,255,255,255,255,255,255,255,255,255,255,255,249,255,255,255,\n 255,255,255,252,7,0,0,0,0,224,255,191,255,255,255,255,0,0,0,255,255,255,255,\n 255,255,15,0,255,255,255,255,255,255,255,255,47,0,255,3,0,0,252,232,255,255,\n 255,255,255,7,255,255,255,255,7,0,255,255,255,31,255,255,255,255,255,255,247,\n 255,0,128,255,3,255,255,255,127,255,255,255,255,255,255,127,0,255,63,255,3,\n 255,255,127,252,255,255,255,255,255,255,255,127,5,0,0,56,255,255,60,0,126,126,\n 126,0,127,127,255,255,255,255,255,247,255,3,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,7,255,3,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,15,0,255,255,127,248,255,255,255,255,\n 255,\n 15,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,3,0,0,0,0,127,0,248,224,255,253,127,95,219,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,3,0,0,0,248,255,255,255,\n 255,255,255,255,255,255,255,255,255,63,0,0,255,255,255,255,255,255,255,255,\n 252,255,255,255,255,255,255,0,0,0,0,0,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,223,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,0,0,255,3,\n 254,255,255,7,254,255,255,7,192,255,255,255,255,255,255,255,255,255,255,127,\n 252,252,252,28,0,0,0,0,255,239,255,255,127,255,255,183,255,63,255,63,0,0,0,0,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,7,0,0,0,0,0,0,0,0,\n 255,255,255,255,255,255,31,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,\n 0,0,0,0,0,0,0,0,255,255,255,31,255,255,255,255,255,255,1,0,0,0,0,\n 0,255,255,255,255,0,224,255,255,255,7,255,255,255,255,255,7,255,255,255,63,\n 255,255,255,255,15,255,62,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,63,255,3,255,255,255,255,15,255,255,255,\n 255,15,255,255,255,255,255,0,255,255,255,255,255,255,15,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,255,255,255,255,255,255,127,0,255,255,63,0,255,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,63,253,255,255,255,255,191,145,255,255,63,0,255,255,\n 127,0,255,255,255,127,0,0,0,0,0,0,0,0,255,255,55,0,255,255,63,0,255,255,255,3,\n 0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,192,0,0,0,0,0,0,0,0,111,240,239,\n 254,255,255,63,0,0,0,0,0,255,255,255,31,255,255,255,31,0,0,0,0,255,254,255,\n 255,31,0,0,0,255,255,255,255,255,255,63,0,255,255,63,0,255,255,7,0,255,255,3,\n 0,0,0,0,0,0,0,0,0,0,0,0,\n 0,255,255,255,255,255,255,255,255,255,1,0,0,0,0,0,0,255,255,255,255,255,255,7,\n 0,255,255,255,255,255,255,7,0,255,255,255,255,255,0,255,3,0,0,0,0,0,0,0,0,0,0,\n 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,255,255,255,255,\n 255,27,3,0,0,0,0,0,0,0,0,0,255,255,255,31,128,0,255,255,63,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,255,255,31,0,0,0,255,255,127,0,255,255,255,255,255,255,255,255,63,0,0,\n 0,192,255,0,0,252,255,255,255,255,255,255,1,0,0,255,255,255,1,255,3,255,255,\n 255,255,255,255,199,255,240,0,255,255,255,255,71,0,255,255,255,255,255,255,\n 255,255,30,192,255,23,0,0,0,0,255,255,251,255,255,255,159,64,0,0,0,0,0,0,0,0,\n 127,189,255,191,255,1,255,255,255,255,255,255,255,1,255,3,239,159,249,255,255,\n 253,237,227,159,25,129,224,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,255,255,255,255,255,255,255,255,187,7,255,131,3,0,0,0,255,255,255,255,255,\n 255,255,255,179,0,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,\n 255,255,255,63,127,0,0,0,63,0,0,0,0,255,255,255,255,255,255,255,127,17,0,255,\n 3,0,0,0,0,255,255,255,255,255,255,63,1,255,3,0,0,0,0,0,0,255,255,255,231,255,\n 7,255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,\n 255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,3,0,128,\n 127,242,111,255,255,255,191,153,7,0,255,3,0,0,0,0,0,0,0,0,255,252,255,255,255,\n 255,255,252,26,0,0,0,255,255,255,255,255,255,231,127,0,0,255,255,255,255,255,\n 255,255,255,255,32,0,0,0,0,255,255,255,255,255,255,255,1,255,253,255,255,255,\n 255,127,127,1,0,255,3,0,0,252,255,255,255,252,255,255,254,127,0,0,0,0,0,0,0,0,\n 0,127,251,255,255,255,255,127,180,203,0,255,3,191,253,255,255,255,127,123,1,\n 255,3,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,\n 0,0,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,\n 0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,3,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,127,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,255,255,255,255,255,127,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,\n 0,255,255,255,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,\n 0,255,255,255,255,255,255,255,1,255,255,255,127,255,3,0,0,0,0,0,0,0,0,0,0,0,0,\n 255,255,255,63,0,0,255,255,255,255,255,255,0,0,15,0,255,3,248,255,255,224,255,\n 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,\n 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,135,\n 255,255,255,255,255,255,255,128,255,255,0,0,0,0,0,0,0,0,11,0,3,0,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,0,0,0,0,0,\n 255,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,255,255,255,\n 127,0,0,0,0,0,0,7,0,240,0,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,15,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,7,255,31,255,1,255,67,0,0,0,0,0,0,0,0,0,0,0,0,\n 255,255,255,255,255,255,255,255,255,255,223,255,255,255,255,255,255,255,255,\n 223,100,222,255,235,239,255,255,255,255,255,255,255,191,231,223,223,255,255,\n 255,123,95,252,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,63,255,255,255,253,255,255,247,255,255,255,\n 247,255,255,223,255,255,255,223,255,255,127,255,255,255,127,255,255,255,253,\n 255,255,255,253,255,255,247,207,255,255,255,255,255,255,127,255,255,249,219,7,\n 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,255,255,255,255,255,31,\n 128,63,255,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 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,255,255,255,255,255,15,255,\n 3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,31,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,143,8,\n 255,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,239,255,255,255,150,254,247,10,\n 132,234,150,170,150,247,247,94,255,251,255,15,238,251,255,15,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,255,255,255,3,255,255,255,3,255,255,255,3,0,0,0,0,0,0,0,0,0,0,0,0,\n 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,255,3\n]);\n\n// size: 1568 bytes (compressed to ~1380 bytes after binaryen)\n// @ts-ignore: decorator\n@lazy @inline const CASED = memory.data([\n 18,19,20,21,22,23,16,16,16,16,16,16,16,16,16,16,\n 24,16,16,25,16,16,16,16,16,16,16,16,26,27,17,28,\n 29,30,16,16,31,16,16,16,16,16,16,16,32,33,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,34,35,16,16,16,36,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,37,16,16,16,38,\n 16,16,16,16,39,16,16,16,16,16,16,16,40,16,16,16,\n 16,16,16,16,16,16,16,16,41,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,42,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,43,44,45,46,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,47,16,16,16,16,16,16,\n 16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 0,0,0,0,0,0,0,0,254,255,255,7,254,255,255,7,0,0,0,0,0,4,32,4,\n 255,255,127,255,255,255,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,247,240,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,239,255,255,255,255,1,3,0,0,0,31,0,0,0,\n 0,0,0,0,0,0,0,0,32,0,0,0,0,0,207,188,64,215,255,255,251,255,255,255,\n 255,255,255,255,255,255,191,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 3,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,\n 255,255,127,0,255,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,\n 191,32,255,255,255,255,255,231,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,255,255,255,255,255,255,255,255,255,255,63,63,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,255,1,255,255,255,255,255,231,0,0,0,0,0,0,0,0,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 0,0,0,0,0,0,0,0,255,255,63,63,255,255,255,255,63,63,255,170,255,255,255,63,\n 255,255,255,255,255,255,223,95,220,31,207,15,255,31,220,31,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,2,128,0,0,255,31,0,0,0,0,0,0,0,0,0,0,0,0,\n 132,252,47,62,80,189,31,242,224,67,0,0,255,255,255,255,24,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,192,255,255,255,255,255,255,3,0,0,255,255,255,255,255,127,255,255,\n 255,255,255,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,31,120,12,0,\n 255,255,255,255,191,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,63,0,0,\n 255,255,255,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252,255,255,255,\n 255,255,255,255,255,255,255,255,255,120,255,255,255,255,255,255,252,7,0,0,0,0,96,7,\n 0,0,0,0,0,0,255,255,255,255,255,247,255,1,255,255,255,255,255,255,255,255,255,255,\n 0,0,0,0,0,0,0,0,127,0,248,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,255,255,7,\n 254,255,255,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,\n 255,255,15,255,255,255,255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 255,255,255,255,255,255,7,0,255,255,255,255,255,255,7,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,0,0,\n 0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,223,255,255,255,255,255,\n 255,255,255,223,100,222,255,235,239,255,255,255,255,255,255,255,191,231,223,223,255,255,255,123,\n 95,252,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,255,255,255,\n 253,255,255,247,255,255,255,247,255,255,223,255,255,255,223,255,255,127,255,255,255,127,255,255,\n 255,253,255,255,255,253,255,255,247,15,0,0,0,0,0,0,255,255,255,255,255,255,255,255,\n 15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,255,255,255,3,255,255,255,3,255,255,255,3,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0\n]);\n\n// size: 2976 bytes (compressed to ~2050 bytes after binaryen)\n// @ts-ignore: decorator\n@lazy @inline const CASE_IGNORABLES = memory.data([\n 18,16,19,20,21,22,23,24,25,26,27,28,29,30,31,32,\n 33,16,16,34,16,16,16,35,36,37,38,39,40,41,16,42,\n 43,16,16,16,16,16,16,16,16,16,16,16,44,45,46,16,\n 47,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 48,16,16,16,49,16,50,51,52,53,54,55,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,56,16,16,57,58,\n 16,59,60,61,16,16,16,16,16,16,62,16,16,63,64,65,\n 66,67,68,69,70,71,72,73,74,75,76,16,77,78,79,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,80,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,81,82,16,16,16,83,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,84,16,16,16,\n 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,\n 16,85,86,16,16,16,16,16,16,16,87,16,16,16,16,16,\n 88,89,90,16,16,16,16,16,91,92,16,16,16,16,16,16,\n 16,16,16,93,16,16,16,16,16,16,16,16,16,16,16,16,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 0,0,0,0,128,64,0,4,0,0,0,64,1,0,0,0,0,0,0,0,0,161,144,1,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,\n 255,255,255,255,255,255,48,4,176,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,3,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,130,0,0,0,0,\n 0,0,254,255,255,255,255,191,182,0,0,0,0,0,16,0,63,0,255,23,0,0,0,0,\n 1,248,255,255,0,0,1,0,0,0,0,0,0,0,0,0,0,0,192,191,255,61,0,0,\n 0,128,2,0,0,0,255,255,255,7,0,0,0,0,0,0,0,0,0,0,192,255,1,0,\n 0,0,0,0,0,248,63,36,0,0,192,255,255,63,0,0,0,0,0,14,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,248,255,255,255,255,255,7,0,0,0,0,0,0,20,\n 254,33,254,0,12,0,2,0,2,0,0,0,0,0,0,16,30,32,0,0,12,0,0,64,\n 6,0,0,0,0,0,0,16,134,57,2,0,0,0,35,0,6,0,0,0,0,0,0,16,\n 190,33,0,0,12,0,0,252,2,0,0,0,0,0,0,144,30,32,96,0,12,0,0,0,\n 4,0,0,0,0,0,0,0,1,32,0,0,0,0,0,0,17,0,0,0,0,0,0,192,\n 193,61,96,0,12,0,0,0,2,0,0,0,0,0,0,144,64,48,0,0,12,0,0,0,\n 3,0,0,0,0,0,0,24,30,32,0,0,12,0,0,0,2,0,0,0,0,0,0,0,\n 0,4,92,0,0,0,0,0,0,0,0,0,0,0,242,7,192,127,0,0,0,0,0,0,\n 0,0,0,0,0,0,242,31,64,63,0,0,0,0,0,0,0,0,0,3,0,0,160,2,\n 0,0,0,0,0,0,254,127,223,224,255,254,255,255,255,31,64,0,0,0,0,0,0,0,\n 0,0,0,0,0,224,253,102,0,0,0,195,1,0,30,0,100,32,0,32,0,0,0,0,\n 0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,224,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,0,0,0,28,0,\n 0,0,12,0,0,0,12,0,0,0,0,0,0,0,176,63,64,254,143,32,0,0,0,0,\n 0,120,0,0,0,0,0,0,8,0,0,0,0,0,0,0,96,0,0,0,0,2,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,135,1,4,14,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,9,0,0,0,0,\n 0,0,64,127,229,31,248,159,0,0,0,0,128,0,255,255,1,0,0,0,0,0,0,0,\n 15,0,0,0,0,0,208,23,4,0,0,0,0,248,15,0,3,0,0,0,60,59,0,0,\n 0,0,0,0,64,163,3,0,0,0,0,0,0,240,207,0,0,0,0,0,0,0,0,63,\n 0,0,0,0,0,0,0,0,0,0,247,255,253,33,16,3,0,0,0,0,0,240,255,255,\n 255,255,255,255,255,7,0,1,0,0,0,248,255,255,255,255,255,255,255,255,255,255,255,251,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,\n 3,224,0,224,0,224,0,96,0,248,0,3,144,124,0,0,0,0,0,0,223,255,2,128,\n 0,0,255,31,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,0,0,0,128,3,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,128,0,0,0,0,0,0,0,0,\n 0,0,0,0,255,255,255,255,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,60,62,8,\n 0,0,0,0,0,0,0,0,0,0,0,126,0,0,0,0,0,0,0,0,0,0,0,112,\n 0,0,32,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 192,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 2,0,0,0,0,0,0,255,127,0,0,0,0,0,0,128,3,0,0,0,0,0,120,38,\n 0,32,0,0,0,0,0,0,7,0,0,0,128,239,31,0,0,0,0,0,0,0,8,0,\n 3,0,0,0,0,0,192,127,0,158,0,0,0,0,0,0,0,0,0,0,0,128,211,64,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,248,7,0,0,\n 3,0,0,0,0,0,0,24,1,0,0,0,192,31,31,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,92,0,0,64,0,0,0,0,\n 0,0,0,0,0,0,248,133,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,176,1,0,0,48,0,0,0,0,\n 0,0,0,0,0,0,248,167,1,0,0,0,0,0,0,0,0,0,0,0,0,40,191,0,\n 0,0,0,0,0,0,0,0,0,0,0,224,188,15,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,255,6,\n 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,88,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n 0,0,240,12,1,0,0,0,254,7,0,0,0,0,248,121,128,0,126,14,0,0,0,0,\n 0,252,127,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,191,\n 0,0,0,0,0,0,0,0,0,0,252,255,255,252,109,0,0,0,0,0,0,0,0,0,\n 0,0,0,0,0,0,126,180,191,0,0,0,0,0,0,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0,0,0,0,0,0,0,\n 0,0,0,0,0,0,0,248\n]);\n\n// @ts-ignore: decorator\n@lazy @inline const LOWER127 = memory.data([\n 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,\n 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,\n 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,\n 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,\n 64,\n 97,98,99,100,101,102,103,104,105,106,107,108,109,\n 110,111,112,113,114,115,116,117,118,119,120,121,122,\n 91,92,93,94,95,96,\n 97,98,99,100,101,102,103,104,105,106,107,108,109,\n 110,111,112,113,114,115,116,117,118,119,120,121,122,\n 123,124,125,126,127\n]);\n\n// @ts-ignore: decorator\n@lazy @inline const UPPER127 = memory.data([\n 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,\n 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,\n 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,\n 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,\n 64,\n 65,66,67,68,69,70,71,72,73,74,75,76,77,\n 78,79,80,81,82,83,84,85,86,87,88,89,90,\n 91,92,93,94,95,96,\n 65,66,67,68,69,70,71,72,73,74,75,76,77,\n 78,79,80,81,82,83,84,85,86,87,88,89,90,\n 123,124,125,126,127\n]);\n\n// 23 * 8 = 184 bytes\n// @ts-ignore: decorator\n@lazy @inline const POWERS10 = memory.data([\n 1e00, 1e01, 1e02, 1e03, 1e04, 1e05, 1e06, 1e07, 1e08, 1e09,\n 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,\n 1e20, 1e21, 1e22\n]);\n\n// @ts-ignore: decorator\n@inline\nexport const enum CharCode {\n PERCENT = 0x25,\n PLUS = 0x2B,\n MINUS = 0x2D,\n DOT = 0x2E,\n _0 = 0x30,\n _1 = 0x31,\n _2 = 0x32,\n _3 = 0x33,\n _4 = 0x34,\n _5 = 0x35,\n _6 = 0x36,\n _7 = 0x37,\n _8 = 0x38,\n _9 = 0x39,\n A = 0x41,\n B = 0x42,\n E = 0x45,\n I = 0x49,\n N = 0x4E,\n O = 0x4F,\n X = 0x58,\n Z = 0x5A,\n a = 0x61,\n b = 0x62,\n e = 0x65,\n n = 0x6E,\n o = 0x6F,\n u = 0x75,\n x = 0x78,\n z = 0x7A\n}\n\n// @ts-ignore: decorator\n@inline\nexport function isAscii(c: u32): bool {\n return !(c >> 7);\n}\n\n// @ts-ignore: decorator\n@inline\nexport function isLower8(c: u32): bool {\n return c - CharCode.a < 26;\n}\n\n// @ts-ignore: decorator\n@inline\nexport function isUpper8(c: u32): bool {\n return c - CharCode.A < 26;\n}\n\nexport function isSpace(c: u32): bool {\n if (c < 0x1680) { // < (1)\n // , , , , , and \n // (c == 0x20 || c == 0xA0) was optimized to (c | 0x80) == 0xA0\n // @ts-ignore: cast\n return ((c | 0x80) == 0xA0) | (c - 0x09 <= 0x0D - 0x09);\n }\n if (c - 0x2000 <= 0x200A - 0x2000) return true;\n switch (c) {\n case 0x1680: // (1)\n case 0x2028: // (2)\n case 0x2029: // \n case 0x202F: // \n case 0x205F: // \n case 0x3000: // \n case 0xFEFF: return true; // \n }\n return false;\n}\n\nexport function isAlpha(c: u32): bool {\n if (isAscii(c)) return (c | 32) - CharCode.a < 26;\n if (c < 0x20000) {\n // @ts-ignore: cast\n return stagedBinaryLookup(ALPHA_TABLE, c);\n }\n return c < 0x2FFFE;\n}\n\n// @ts-ignore: decorator\n@inline\nexport function isCased(c: u32): bool {\n // @ts-ignore: cast\n return c < 0x1F18A && stagedBinaryLookup(CASED, c);\n}\n\n// @ts-ignore: decorator\n@inline\nexport function isCaseIgnorable(c: u32): bool {\n // @ts-ignore: cast\n return c < 0xE01F0 && stagedBinaryLookup(CASE_IGNORABLES, c);\n}\n\n// @ts-ignore: decorator\n@inline\nexport function isFinalSigma(buffer: usize, index: isize, len: isize): bool {\n const lookaheadLimit = 30; // max lookahead limit\n var found = false;\n var pos = index;\n var minPos = max(0, pos - lookaheadLimit);\n while (pos > minPos) {\n let c = codePointBefore(buffer, pos);\n if (!isCaseIgnorable(c)) {\n if (isCased(c)) {\n found = true;\n } else {\n return false;\n }\n }\n pos -= isize(c >= 0x10000) + 1;\n }\n if (!found) return false;\n pos = index + 1;\n var maxPos = min(pos + lookaheadLimit, len);\n while (pos < maxPos) {\n let c = load(buffer + (pos << 1));\n if (u32((c & 0xFC00) == 0xD800) & u32(pos + 1 != len)) {\n let c1 = load(buffer + (pos << 1), 2);\n if ((c1 & 0xFC00) == 0xDC00) {\n c = (c - 0xD800 << 10) + (c1 - 0xDC00) + 0x10000;\n }\n }\n if (!isCaseIgnorable(c)) {\n return !isCased(c);\n }\n pos += isize(c >= 0x10000) + 1;\n }\n return true;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction codePointBefore(buffer: usize, index: isize): i32 {\n if (index <= 0) return -1;\n var c = load(buffer + (index - 1 << 1));\n if (u32((c & 0xFC00) == 0xDC00) & u32(index - 2 >= 0)) {\n let c1 = load(buffer + (index - 2 << 1));\n if ((c1 & 0xFC00) == 0xD800) {\n return ((c1 & 0x3FF) << 10) + (c & 0x3FF) + 0x10000;\n }\n }\n return (c & 0xF800) == 0xD800 ? 0xFFFD : c;\n}\n\n// Search routine for two-staged lookup tables\nfunction stagedBinaryLookup(table: usize, c: u32): bool {\n return ((load(table + (load(table + (c >>> 8)) << 5) + ((c & 255) >> 3)) >>> (c & 7)) & 1);\n}\n\nexport function compareImpl(str1: string, index1: usize, str2: string, index2: usize, len: usize): i32 {\n var ptr1 = changetype(str1) + (index1 << 1);\n var ptr2 = changetype(str2) + (index2 << 1);\n if (ASC_SHRINK_LEVEL < 2) {\n if (len >= 4 && !((ptr1 & 7) | (ptr2 & 7))) {\n do {\n if (load(ptr1) != load(ptr2)) break;\n ptr1 += 8;\n ptr2 += 8;\n len -= 4;\n } while (len >= 4);\n }\n }\n while (len--) {\n let a = load(ptr1);\n let b = load(ptr2);\n if (a != b) return a - b;\n ptr1 += 2;\n ptr2 += 2;\n }\n return 0;\n}\n\n// @ts-ignore: decorator\n@inline\nexport function toLower8(c: u32): u32 {\n if (ASC_SHRINK_LEVEL > 0) {\n return c | u32(isUpper8(c)) << 5;\n } else {\n return load(LOWER127 + c);\n }\n}\n\n// @ts-ignore: decorator\n@inline\nexport function toUpper8(c: u32): u32 {\n if (ASC_SHRINK_LEVEL > 0) {\n return c & ~(u32(isLower8(c)) << 5);\n } else {\n return load(UPPER127 + c);\n }\n}\n\n/** Parses a string to an integer (usually), using the specified radix. */\nexport function strtol(str: string, radix: i32 = 0): T {\n var len = str.length;\n if (!len) {\n if (isFloat()) {\n // @ts-ignore: cast\n return NaN;\n } else {\n // @ts-ignore: cast\n return 0;\n }\n }\n\n var ptr = changetype(str) /* + HEAD -> offset */;\n var code = load(ptr);\n\n // trim white spaces\n while (isSpace(code)) {\n code = load(ptr += 2);\n --len;\n }\n // determine sign\n // @ts-ignore\n var sign: T = 1;\n if (code == CharCode.MINUS || code == CharCode.PLUS) {\n if (!--len) {\n if (isFloat()) {\n // @ts-ignore: cast\n return NaN;\n } else {\n // @ts-ignore: cast\n return 0;\n }\n }\n if (code == CharCode.MINUS) {\n // @ts-ignore: type\n sign = -1;\n }\n code = load(ptr += 2);\n }\n\n // See https://tc39.es/ecma262/#sec-parseint-string-radix\n if (radix) {\n if (radix < 2 || radix > 36) {\n if (isFloat()) {\n // @ts-ignore: cast\n return NaN;\n } else {\n // @ts-ignore: cast\n return 0;\n }\n }\n // handle case as parseInt(\"0xFF\", 16) by spec\n if (radix == 16) {\n if (\n len > 2 &&\n code == CharCode._0 &&\n (load(ptr, 2) | 32) == CharCode.x\n ) {\n ptr += 4; len -= 2;\n }\n }\n } else {\n // determine radix by literal prefix\n if (code == CharCode._0 && len > 2) {\n switch (load(ptr, 2) | 32) {\n case CharCode.b: {\n ptr += 4; len -= 2;\n radix = 2;\n break;\n }\n case CharCode.o: {\n ptr += 4; len -= 2;\n radix = 8;\n break;\n }\n case CharCode.x: {\n ptr += 4; len -= 2;\n radix = 16;\n break;\n }\n }\n }\n if (!radix) radix = 10;\n }\n\n // calculate value\n // @ts-ignore: type\n var num: T = 0;\n while (len--) {\n code = load(ptr);\n if (code - CharCode._0 < 10) {\n code -= CharCode._0;\n } else if (code - CharCode.A <= (CharCode.Z - CharCode.A)) {\n code -= CharCode.A - 10;\n } else if (code - CharCode.a <= (CharCode.z - CharCode.a)) {\n code -= CharCode.a - 10;\n }\n if (code >= radix) {\n if (!num) {\n if (isFloat()) {\n // @ts-ignore: cast\n return NaN;\n } else {\n // @ts-ignore: cast\n return 0;\n }\n }\n break;\n }\n // @ts-ignore: type\n num = num * radix + code;\n ptr += 2;\n }\n // @ts-ignore: type\n return sign * num;\n}\n\nexport function strtod(str: string): f64 {\n var len = str.length;\n if (!len) return NaN;\n\n var ptr = changetype(str);\n var code = load(ptr);\n\n var sign = 1.0;\n // skip white spaces\n while (len && isSpace(code)) {\n code = load(ptr += 2);\n --len;\n }\n if (!len) return NaN;\n\n // try parse '-' or '+'\n if (code == CharCode.MINUS) {\n if (!--len) return NaN;\n code = load(ptr += 2);\n sign = -1;\n } else if (code == CharCode.PLUS) {\n if (!--len) return NaN;\n code = load(ptr += 2);\n }\n\n // try parse Infinity\n if (len >= 8 && code == CharCode.I) {\n if (\n load(ptr, 0) == 0x690066006E0049 && // ifnI\n load(ptr, 8) == 0x7900740069006E // ytin\n ) {\n return Infinity * sign;\n }\n return NaN;\n }\n // validate next symbol\n if (code != CharCode.DOT && (code - CharCode._0) >= 10) {\n return NaN;\n }\n var savedPtr = ptr;\n // skip zeros\n while (code == CharCode._0) {\n code = load(ptr += 2);\n --len;\n }\n if (len <= 0) return 0;\n const capacity = 19; // int(64 * 0.3010)\n var pointed = false;\n var consumed = 0;\n var position = 0;\n var x: u64 = 0;\n if (code == CharCode.DOT) {\n let noDigits = !(savedPtr - ptr);\n ptr += 2; --len;\n if (!len && noDigits) return NaN;\n for (pointed = true; (code = load(ptr)) == CharCode._0; --position, ptr += 2) --len;\n if (len <= 0) return 0;\n if (!position && noDigits && code - CharCode._0 >= 10) return NaN;\n }\n for (let digit = code - CharCode._0; digit < 10 || (code == CharCode.DOT && !pointed); digit = code - CharCode._0) {\n if (digit < 10) {\n x = consumed < capacity ? 10 * x + digit : x | u64(!!digit);\n ++consumed;\n } else {\n position = consumed;\n pointed = true;\n }\n if (!--len) break;\n code = load(ptr += 2);\n }\n\n if (!pointed) position = consumed;\n return copysign(scientific(x, position - min(capacity, consumed) + parseExp(ptr, len)), sign);\n}\n\nexport function joinBooleanArray(dataStart: usize, length: i32, separator: string): string {\n var lastIndex = length - 1;\n if (lastIndex < 0) return \"\";\n if (!lastIndex) return select(\"true\", \"false\", load(dataStart));\n\n var sepLen = separator.length;\n var valueLen = 5; // max possible length of element len(\"false\")\n var estLen = (valueLen + sepLen) * lastIndex + valueLen;\n var result = changetype(__new(estLen << 1, idof()));\n var offset = 0;\n var value: bool;\n for (let i = 0; i < lastIndex; ++i) {\n value = load(dataStart + i);\n valueLen = 4 + i32(!value);\n memory.copy(\n changetype(result) + (offset << 1),\n changetype(select(\"true\", \"false\", value)),\n valueLen << 1\n );\n offset += valueLen;\n if (sepLen) {\n memory.copy(\n changetype(result) + (offset << 1),\n changetype(separator),\n sepLen << 1\n );\n offset += sepLen;\n }\n }\n value = load(dataStart + lastIndex);\n valueLen = 4 + i32(!value);\n memory.copy(\n changetype(result) + (offset << 1),\n changetype(select(\"true\", \"false\", value)),\n valueLen << 1\n );\n offset += valueLen;\n\n if (estLen > offset) return result.substring(0, offset);\n return result;\n}\n\nexport function joinIntegerArray(dataStart: usize, length: i32, separator: string): string {\n var lastIndex = length - 1;\n if (lastIndex < 0) return \"\";\n if (!lastIndex) {\n let value = load(dataStart);\n if (isSigned()) {\n if (sizeof() <= 4) {\n // @ts-ignore: type\n return changetype(itoa32(value, 10));\n } else {\n // @ts-ignore: type\n return changetype(itoa64(value, 10));\n }\n } else {\n if (sizeof() <= 4) {\n // @ts-ignore: type\n return changetype(utoa32(value, 10));\n } else {\n // @ts-ignore: type\n return changetype(utoa64(value, 10));\n }\n }\n }\n\n var sepLen = separator.length;\n const valueLen = (sizeof() <= 4 ? 10 : 20) + i32(isSigned());\n var estLen = (valueLen + sepLen) * lastIndex + valueLen;\n var result = changetype(__new(estLen << 1, idof()));\n var offset = 0;\n var value: T;\n for (let i = 0; i < lastIndex; ++i) {\n value = load(dataStart + (i << alignof()));\n // @ts-ignore: type\n offset += itoa_buffered(changetype(result) + (offset << 1), value);\n if (sepLen) {\n memory.copy(\n changetype(result) + (offset << 1),\n changetype(separator),\n sepLen << 1\n );\n offset += sepLen;\n }\n }\n value = load(dataStart + (lastIndex << alignof()));\n // @ts-ignore: type\n offset += itoa_buffered(changetype(result) + (offset << 1), value);\n if (estLen > offset) return result.substring(0, offset);\n return result;\n}\n\nexport function joinFloatArray(dataStart: usize, length: i32, separator: string): string {\n var lastIndex = length - 1;\n if (lastIndex < 0) return \"\";\n if (!lastIndex) {\n return changetype(dtoa(\n // @ts-ignore: type\n load(dataStart))\n );\n }\n\n const valueLen = MAX_DOUBLE_LENGTH;\n var sepLen = separator.length;\n var estLen = (valueLen + sepLen) * lastIndex + valueLen;\n var result = changetype(__new(estLen << 1, idof()));\n var offset = 0;\n var value: T;\n for (let i = 0; i < lastIndex; ++i) {\n value = load(dataStart + (i << alignof()));\n // @ts-ignore: type\n offset += dtoa_buffered(changetype(result) + (offset << 1), value);\n if (sepLen) {\n memory.copy(\n changetype(result) + (offset << 1),\n changetype(separator),\n sepLen << 1\n );\n offset += sepLen;\n }\n }\n value = load(dataStart + (lastIndex << alignof()));\n // @ts-ignore: type\n offset += dtoa_buffered(changetype(result) + (offset << 1), value);\n if (estLen > offset) return result.substring(0, offset);\n return result;\n}\n\nexport function joinStringArray(dataStart: usize, length: i32, separator: string): string {\n var lastIndex = length - 1;\n if (lastIndex < 0) return \"\";\n if (!lastIndex) {\n // @ts-ignore: type\n return load(dataStart) || \"\";\n }\n var estLen = 0;\n var value: string;\n for (let i = 0; i < length; ++i) {\n value = load(dataStart + (i << alignof()));\n // @ts-ignore: type\n if (value !== null) estLen += value.length;\n }\n var offset = 0;\n var sepLen = separator.length;\n var result = changetype(__new((estLen + sepLen * lastIndex) << 1, idof()));\n for (let i = 0; i < lastIndex; ++i) {\n value = load(dataStart + (i << alignof()));\n if (value !== null) {\n let valueLen = value.length;\n memory.copy(\n changetype(result) + (offset << 1),\n changetype(value),\n valueLen << 1\n );\n offset += valueLen;\n }\n if (sepLen) {\n memory.copy(\n changetype(result) + (offset << 1),\n changetype(separator),\n sepLen << 1\n );\n offset += sepLen;\n }\n }\n value = load(dataStart + (lastIndex << alignof()));\n if (value !== null) {\n memory.copy(\n changetype(result) + (offset << 1),\n changetype(value),\n value.length << 1\n );\n }\n return result;\n}\n\nexport function joinReferenceArray(dataStart: usize, length: i32, separator: string): string {\n var lastIndex = length - 1;\n if (lastIndex < 0) return \"\";\n var value: T;\n if (!lastIndex) {\n value = load(dataStart);\n // @ts-ignore: type\n return value !== null ? value.toString() : \"\";\n }\n var result = \"\";\n var sepLen = separator.length;\n for (let i = 0; i < lastIndex; ++i) {\n value = load(dataStart + (i << alignof()));\n // @ts-ignore: type\n if (value !== null) result += value.toString();\n if (sepLen) result += separator;\n }\n value = load(dataStart + (lastIndex << alignof()));\n // @ts-ignore: type\n if (value !== null) result += value.toString();\n return result;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction scientific(significand: u64, exp: i32): f64 {\n if (!significand || exp < -342) return 0;\n if (exp > 308) return Infinity;\n // Try use fast path\n // Use fast path for string-to-double conversion if possible\n // see http://www.exploringbinary.com/fast-path-decimal-to-floating-point-conversion\n // Simple integer\n var significandf = significand;\n if (!exp) return significandf;\n if (exp > 22 && exp <= 22 + 15) {\n significandf *= pow10(exp - 22);\n exp = 22;\n }\n if (significand <= 9007199254740991 && abs(exp) <= 22) {\n if (exp > 0) return significandf * pow10(exp);\n return significandf / pow10(-exp);\n } else if (exp < 0) {\n return scaledown(significand, exp);\n } else {\n return scaleup(significand, exp);\n }\n}\n\n// Adopted from metallic lib:\n// https://github.com/jdh8/metallic/blob/master/src/stdlib/parse/scientific.h\n// @ts-ignore: decorator\n@inline\nfunction scaledown(significand: u64, exp: i32): f64 {\n const denom: u64 = 6103515625; // 1e14 * 0x1p-14\n const scale = reinterpret(0x3F06849B86A12B9B); // 1e-14 * 0x1p32\n\n var shift = clz(significand);\n significand <<= shift;\n shift = exp - shift;\n\n for (; exp <= -14; exp += 14) {\n let q = significand / denom;\n let r = significand % denom;\n let s = clz(q);\n significand = (q << s) + nearest(scale * (r << (s - 18)));\n shift -= s;\n }\n var b = ipow32(5, -exp);\n var q = significand / b;\n var r = significand % b;\n var s = clz(q);\n significand = (q << s) + (reinterpret(reinterpret(r) + (s << 52)) / b);\n shift -= s;\n\n return NativeMath.scalbn(significand, shift);\n}\n\n// Adopted from metallic lib:\n// https://github.com/jdh8/metallic/blob/master/src/stdlib/parse/scientific.h\n// @ts-ignore: decorator\n@inline\nfunction scaleup(significand: u64, exp: i32): f64 {\n const coeff: u32 = 1220703125; // 1e13 * 0x1p-13;\n var shift = ctz(significand);\n significand >>= shift;\n shift += exp;\n\n __fixmulShift = shift;\n for (; exp >= 13; exp -= 13) {\n significand = fixmul(significand, coeff);\n }\n significand = fixmul(significand, ipow32(5, exp));\n shift = __fixmulShift;\n return NativeMath.scalbn(significand, shift);\n}\n\n// Adopted from metallic lib:\n// https://github.com/jdh8/metallic/blob/master/src/stdlib/parse/scientific.h\n// @ts-ignore: decorator\n@inline\nfunction parseExp(ptr: usize, len: i32): i32 {\n var sign = 1, magnitude = 0;\n var code = load(ptr);\n // check code is 'e' or 'E'\n if ((code | 32) != CharCode.e) return 0;\n\n if (!--len) return 0;\n code = load(ptr += 2);\n if (code == CharCode.MINUS) {\n if (!--len) return 0;\n code = load(ptr += 2);\n sign = -1;\n } else if (code == CharCode.PLUS) {\n if (!--len) return 0;\n code = load(ptr += 2);\n }\n // skip zeros\n while (code == CharCode._0) {\n if (!--len) return 0;\n code = load(ptr += 2);\n }\n for (let digit: u32 = code - CharCode._0; len && digit < 10; digit = code - CharCode._0) {\n if (magnitude >= 3200) return sign * 3200;\n magnitude = 10 * magnitude + digit;\n code = load(ptr += 2);\n --len;\n }\n return sign * magnitude;\n}\n\n// @ts-ignore: decorator\n@lazy var __fixmulShift: u64 = 0;\n\n// Adopted from metallic lib:\n// https://github.com/jdh8/metallic/blob/master/src/stdlib/parse/scientific.h\n// @ts-ignore: decorator\n@inline\nfunction fixmul(a: u64, b: u32): u64 {\n var low = (a & 0xFFFFFFFF) * b;\n var high = (a >> 32) * b + (low >> 32);\n var overflow = (high >> 32);\n var space = clz(overflow);\n var revspace: u64 = 32 - space;\n __fixmulShift += revspace;\n return (high << space | (low & 0xFFFFFFFF) >> revspace) + (low << space >> 31 & 1);\n}\n\n// @ts-ignore: decorator\n@inline\nfunction pow10(n: i32): f64 {\n // argument `n` should bounds in [0, 22] range\n return load(POWERS10 + (n << alignof()));\n}\n","import { AL_MASK, OBJECT, OBJECT_OVERHEAD, BLOCK_MAXSIZE, BLOCK_OVERHEAD, BLOCK, OBJECT_MAXSIZE } from \"./common\";\nimport { E_ALLOCATION_TOO_LARGE } from \"../util/error\";\n\n// === A minimal runtime stub ===\n\n// @ts-ignore: decorator\n@lazy var startOffset: usize = ((__heap_base + BLOCK_OVERHEAD + AL_MASK) & ~AL_MASK) - BLOCK_OVERHEAD;\n// @ts-ignore: decorator\n@lazy var offset: usize = startOffset;\n\nfunction maybeGrowMemory(newOffset: usize): void {\n // assumes newOffset is aligned\n var pagesBefore = memory.size();\n var maxOffset = ((pagesBefore << 16) + AL_MASK) & ~AL_MASK;\n if (newOffset > maxOffset) {\n let pagesNeeded = (((newOffset - maxOffset + 0xffff) & ~0xffff) >>> 16);\n let pagesWanted = max(pagesBefore, pagesNeeded); // double memory\n if (memory.grow(pagesWanted) < 0) {\n if (memory.grow(pagesNeeded) < 0) unreachable(); // out of memory\n }\n }\n offset = newOffset;\n}\n\n// @ts-ignore: decorator\n@inline function computeSize(size: usize): usize {\n return ((size + BLOCK_OVERHEAD + AL_MASK) & ~AL_MASK) - BLOCK_OVERHEAD;\n}\n\n// @ts-ignore: decorator\n@unsafe @global\nexport function __alloc(size: usize): usize {\n if (size > BLOCK_MAXSIZE) throw new Error(E_ALLOCATION_TOO_LARGE);\n var block = changetype(offset);\n var ptr = offset + BLOCK_OVERHEAD;\n var payloadSize = computeSize(size);\n maybeGrowMemory(ptr + payloadSize);\n block.mmInfo = payloadSize;\n return ptr;\n}\n\n// @ts-ignore: decorator\n@unsafe @global\nexport function __realloc(ptr: usize, size: usize): usize {\n assert(ptr != 0 && !(ptr & AL_MASK)); // must exist and be aligned\n var block = changetype(ptr - BLOCK_OVERHEAD);\n var actualSize = block.mmInfo;\n var isLast = ptr + actualSize == offset;\n var payloadSize = computeSize(size);\n if (size > actualSize) {\n if (isLast) { // last block: grow\n if (size > BLOCK_MAXSIZE) throw new Error(E_ALLOCATION_TOO_LARGE);\n maybeGrowMemory(ptr + payloadSize);\n block.mmInfo = payloadSize;\n } else { // copy to new block at least double the size\n let newPtr = __alloc(max(payloadSize, actualSize << 1));\n memory.copy(newPtr, ptr, actualSize);\n block = changetype((ptr = newPtr) - BLOCK_OVERHEAD);\n }\n } else if (isLast) { // last block: shrink\n offset = ptr + payloadSize;\n block.mmInfo = payloadSize;\n }\n return ptr;\n}\n\n// @ts-ignore: decorator\n@unsafe @global\nexport function __free(ptr: usize): void {\n assert(ptr != 0 && !(ptr & AL_MASK)); // must exist and be aligned\n var block = changetype(ptr - BLOCK_OVERHEAD);\n if (ptr + block.mmInfo == offset) { // last block: discard\n offset = changetype(block);\n }\n}\n\n// @ts-ignore: decorator\n@unsafe @global\nexport function __reset(): void { // special\n offset = startOffset;\n}\n\n// @ts-ignore: decorator\n@unsafe @global\nexport function __new(size: usize, id: u32): usize {\n if (size > OBJECT_MAXSIZE) throw new Error(E_ALLOCATION_TOO_LARGE);\n var ptr = __alloc(OBJECT_OVERHEAD + size);\n var object = changetype(ptr - BLOCK_OVERHEAD);\n object.gcInfo = 0;\n object.gcInfo2 = 0;\n object.rtId = id;\n object.rtSize = size;\n return ptr + OBJECT_OVERHEAD;\n}\n\n// @ts-ignore: decorator\n@unsafe @global\nexport function __renew(oldPtr: usize, size: usize): usize {\n if (size > OBJECT_MAXSIZE) throw new Error(E_ALLOCATION_TOO_LARGE);\n var newPtr = __realloc(oldPtr - OBJECT_OVERHEAD, OBJECT_OVERHEAD + size);\n changetype(newPtr - BLOCK_OVERHEAD).rtSize = size;\n return newPtr + OBJECT_OVERHEAD;\n}\n\n// @ts-ignore: decorator\n@global @unsafe\nexport function __link(parentPtr: usize, childPtr: usize, expectMultiple: bool): void {\n // nop\n}\n\n// @ts-ignore: decorator\n@global @unsafe\nexport function __pin(ptr: usize): usize {\n return ptr;\n}\n\n// @ts-ignore: decorator\n@global @unsafe\nexport function __unpin(ptr: usize): void {\n // nop\n}\n\n// @ts-ignore: decorator\n@global @unsafe\nfunction __visit(ptr: usize, cookie: u32): void { // eslint-disable-line @typescript-eslint/no-unused-vars\n // nop\n}\n\n// @ts-ignore: decorator\n@global @unsafe\nexport function __collect(): void {\n // nop\n}\n","// Common error messages for use across the standard library. Keeping error messages compact\n// and reusing them where possible ensures minimal static data in binaries.\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_INDEXOUTOFRANGE: string = \"Index out of range\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_VALUEOUTOFRANGE: string = \"Value out of range\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_INVALIDLENGTH: string = \"Invalid length\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_ILLEGALGENTYPE: string = \"Illegal generic type\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_EMPTYARRAY: string = \"Array is empty\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_HOLEYARRAY: string = \"Element type must be nullable if array is holey\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_NOTIMPLEMENTED: string = \"Not implemented\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_KEYNOTFOUND: string = \"Key does not exist\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_ALLOCATION_TOO_LARGE: string = \"Allocation too large\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_ALREADY_PINNED: string = \"Object already pinned\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_NOT_PINNED: string = \"Object is not pinned\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_URI_MALFORMED: string = \"URI malformed\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_INVALIDDATE: string = \"Invalid Date\";\n\n// @ts-ignore: decorator\n@lazy @inline\nexport const E_UNPAIRED_SURROGATE: string = \"Unpaired surrogate\";\n","import { u128 } from './u128';\nimport { i256 } from './i256';\nimport { u256 } from './u256';\n\nimport {\n __clz128,\n __ctz128,\n __floatuntidf,\n\n __udivmod128,\n __divmod_quot_hi,\n __divmod_rem_lo,\n __divmod_rem_hi,\n} from '../globals';\n\nimport { atou128 } from '../utils';\n\nexport class i128 {\n\n @inline static get Zero(): i128 { return new i128(); }\n @inline static get One(): i128 { return new i128(1); }\n @inline static get Min(): i128 { return new i128(0, 0x8000000000000000); }\n @inline static get Max(): i128 { return new i128(u64.MAX_VALUE, 0x7FFFFFFFFFFFFFFF); }\n\n @inline\n static fromString(value: string, radix: i32 = 10): i128 {\n return changetype(atou128(value, radix));\n }\n\n @inline\n static fromI256(value: i256): i128 {\n return new i128(value.lo1, value.lo2);\n }\n\n @inline\n static fromU256(value: u256): i128 {\n return new i128(value.lo1, value.lo2);\n }\n\n @inline\n static fromI128(value: i128): i128 {\n return new i128(value.lo, value.hi);\n }\n\n @inline\n static fromU128(value: u128): i128 {\n return new i128(value.lo, value.hi);\n }\n\n @inline\n static fromI64(value: i64): i128 {\n return new i128(value, value >> 63);\n }\n\n @inline\n static fromU64(value: u64): i128 {\n return new i128(value);\n }\n\n // TODO need improvement\n // max safe uint for f64 actually 53-bits\n @inline\n static fromF64(value: f64): i128 {\n return new i128(value, reinterpret(value) >> 63);\n }\n\n // TODO need improvement\n // max safe int for f32 actually 23-bits\n @inline\n static fromF32(value: f32): i128 {\n return new i128(value, (reinterpret(value) >> 31));\n }\n\n @inline\n static fromI32(value: i32): i128 {\n return new i128(value, (value >> 31));\n }\n\n @inline\n static fromU32(value: u32): i128 {\n return new i128(value);\n }\n\n @inline\n static fromBits(lo1: i32, lo2: i32, hi1: i32, hi2: i32): i128 {\n return new i128(\n lo1 | ((lo2) << 32),\n hi1 | ((hi2) << 32),\n );\n }\n\n @inline\n static fromBytes(array: T, bigEndian: bool = false): i128 {\n if (array instanceof u8[]) {\n return bigEndian\n // @ts-ignore\n ? i128.fromBytesBE(array)\n // @ts-ignore\n : i128.fromBytesLE(array);\n } else if (array instanceof Uint8Array) {\n return bigEndian\n ? i128.fromUint8ArrayBE(array)\n : i128.fromUint8ArrayLE(array);\n } else {\n throw new TypeError(\"Unsupported generic type\");\n }\n }\n\n @inline\n static fromBytesLE(array: u8[]): i128 {\n return i128.fromUint8ArrayLE(changetype(array));\n }\n\n @inline\n static fromBytesBE(array: u8[]): i128 {\n return i128.fromUint8ArrayBE(changetype(array));\n }\n\n @inline\n static fromUint8ArrayLE(array: Uint8Array): i128 {\n assert(array.length && (array.length & 15) == 0);\n var buffer = array.dataStart;\n return new i128(\n load(buffer, 0 * sizeof()),\n load(buffer, 1 * sizeof())\n );\n }\n\n static fromUint8ArrayBE(array: Uint8Array): i128 {\n assert(array.length && (array.length & 15) == 0);\n var buffer = array.dataStart;\n return new i128(\n bswap(load(buffer, 1 * sizeof())),\n bswap(load(buffer, 0 * sizeof()))\n );\n }\n\n /**\n * Create 128-bit signed integer from generic type T\n * @param value\n * @return 128-bit signed integer\n */\n @inline\n static from(value: T): i128 {\n if (value instanceof bool) { return i128.fromU64(value); }\n else if (value instanceof i8) { return i128.fromI64(value); }\n else if (value instanceof u8) { return i128.fromU64(value); }\n else if (value instanceof i16) { return i128.fromI64(value); }\n else if (value instanceof u16) { return i128.fromU64(value); }\n else if (value instanceof i32) { return i128.fromI64(value); }\n else if (value instanceof u32) { return i128.fromU64(value); }\n else if (value instanceof i64) { return i128.fromI64(value); }\n else if (value instanceof u64) { return i128.fromU64(value); }\n else if (value instanceof f32) { return i128.fromF64(value); }\n else if (value instanceof f64) { return i128.fromF64(value); }\n else if (value instanceof i128) { return i128.fromI128(value); }\n else if (value instanceof u128) { return i128.fromU128(value); }\n else if (value instanceof i256) { return i128.fromI256(value); }\n else if (value instanceof u256) { return i128.fromU256(value); }\n else if (value instanceof u8[]) { return i128.fromBytes(value); }\n else { throw new TypeError(\"Unsupported generic type\"); }\n }\n\n constructor(\n public lo: u64 = 0,\n public hi: i64 = 0,\n ) {}\n\n @inline\n isPos(): bool {\n return this.hi >= 0;\n }\n\n @inline\n isNeg(): bool {\n return this.hi < 0;\n }\n\n @inline\n isZero(): bool {\n return !(this.lo | this.hi);\n }\n\n @inline @operator.prefix('~')\n not(): i128 {\n return new i128(~this.lo, ~this.hi);\n }\n\n @inline @operator.prefix('+')\n pos(): i128 {\n return this;\n }\n\n @inline @operator.prefix('-')\n neg(): i128 {\n var lo = ~this.lo;\n var hi = ~this.hi;\n var lo1 = lo + 1;\n return new i128(lo1, hi + i64(lo1 < 0));\n }\n\n @inline @operator.prefix('!')\n static isEmpty(value: i128): bool {\n return value === null || value.isZero();\n }\n\n @inline @operator('|')\n static or(a: i128, b: i128): i128 {\n return new i128(a.lo | b.lo, a.hi | b.hi);\n }\n\n @inline @operator('^')\n static xor(a: i128, b: u128): i128 {\n return new i128(a.lo ^ b.lo, a.hi ^ b.hi);\n }\n\n @inline @operator('&')\n static and(a: i128, b: i128): i128 {\n return new i128(a.lo & b.lo, a.hi & b.hi);\n }\n\n @inline @operator('<<')\n static shl(value: i128, shift: i32): i128 {\n shift &= 127;\n\n // need for preventing redundant i32 -> u64 extends\n var shift64: i64 = shift;\n\n var mod1: i64 = ((((shift64 + 127) | shift64) & 64) >>> 6) - 1;\n var mod2: i64 = (shift64 >>> 6) - 1;\n\n shift64 &= 63;\n\n var vl = value.lo;\n var lo = vl << shift64;\n var hi = lo & ~mod2;\n\n hi |= ((value.hi << shift64) | ((vl >>> (64 - shift64)) & mod1)) & mod2;\n\n return new i128(lo & mod2, hi);\n }\n\n @inline @operator('>>>')\n static shr_u(value: i128, shift: i32): i128 {\n shift &= 127;\n\n // need for preventing redundant i32 -> u64 extends\n var shift64: i64 = shift;\n\n var mod1: i64 = ((((shift64 + 127) | shift64) & 64) >>> 6) - 1;\n var mod2: i64 = (shift64 >>> 6) - 1;\n\n shift64 &= 63;\n\n var vh = value.hi;\n var hi = vh >>> shift64;\n var lo = hi & ~mod2;\n\n lo |= ((value.lo >>> shift64) | ((vh << (64 - shift64)) & mod1)) & mod2;\n\n return new i128(lo, hi & mod2);\n }\n\n @inline @operator('+')\n static add(a: i128, b: i128): i128 {\n var blo = b.lo;\n var bhi = b.hi;\n var lo = a.lo + blo - (bhi >>> 63);\n var hi = a.hi + bhi + i64(lo < blo);\n return new i128(lo, hi);\n }\n\n @inline @operator('-')\n static sub(a: i128, b: i128): i128 {\n var alo = a.lo;\n var bhi = b.hi;\n var lo = alo - b.lo + (bhi >>> 63);\n var hi = a.hi - bhi - i64(lo > alo);\n return new i128(lo, hi);\n }\n\n @inline @operator('==')\n static eq(a: i128, b: i128): bool {\n return a.hi == b.hi && a.lo == b.lo;\n }\n\n @inline @operator('!=')\n static ne(a: i128, b: i128): bool {\n return !i128.eq(a, b);\n }\n\n @inline @operator('<')\n static lt(a: i128, b: i128): bool {\n var ah = a.hi, bh = b.hi;\n return ah == bh ? a.lo < b.lo : ah < bh;\n }\n\n @inline @operator('>')\n static gt(a: i128, b: i128): bool {\n var ah = a.hi, bh = b.hi;\n return ah == bh ? a.lo > b.lo : ah > bh;\n }\n\n @inline @operator('<=')\n static le(a: i128, b: i128): bool {\n return !i128.gt(a, b);\n }\n\n @inline @operator('>=')\n static ge(a: i128, b: i128): bool {\n return !i128.lt(a, b);\n }\n\n @inline\n static ord(a: i128, b: i128): i32 {\n var dlo = a.lo - b.lo;\n var dhi = a.hi - b.hi;\n var cmp = select(dhi, dlo, dhi != 0);\n // normalize to [-1, 0, 1]\n return i32(cmp > 0) - i32(cmp < 0);\n }\n\n @inline\n static popcnt(value: i128): i32 {\n return (popcnt(value.lo) + popcnt(value.hi));\n }\n\n @inline\n static clz(value: i128): i32 {\n return __clz128(value.lo, value.hi);\n }\n\n @inline\n static ctz(value: i128): i32 {\n return __ctz128(value.lo, value.hi);\n }\n\n @inline\n static abs(value: i128): i128 {\n var lo = value.lo;\n var hi = value.hi;\n if (hi >>> 63) {\n lo = -lo;\n hi = ~hi + i64(lo == 0);\n }\n return new i128(lo, hi);\n }\n\n @inline\n private toArrayBufferLE(buffer: usize): void {\n store(buffer, this.lo, 0 * sizeof());\n store(buffer, this.hi, 1 * sizeof());\n }\n\n @inline\n private toArrayBufferBE(buffer: usize): void {\n store(buffer, bswap(this.hi), 0 * sizeof());\n store(buffer, bswap(this.lo), 1 * sizeof());\n }\n\n @inline\n private toArrayBuffer(buffer: usize, bigEndian: bool = false): void {\n if (bigEndian) {\n this.toArrayBufferBE(buffer);\n } else {\n this.toArrayBufferLE(buffer);\n }\n }\n\n /**\n * Convert to byte array\n * @param bigEndian Little or Big Endian? Default: false\n * @returns Array of bytes\n */\n @inline\n toBytes(bigEndian: bool = false): u8[] {\n var result = new Array(16);\n this.toArrayBuffer(result.dataStart, bigEndian);\n return result;\n }\n\n\n /**\n * Convert to byte static array\n * @param bigEndian Little or Big Endian? Default: false\n * @returns StaticArray of bytes\n */\n @inline\n toStaticBytes(bigEndian: bool = false): StaticArray {\n var result = new StaticArray(16);\n this.toArrayBuffer(changetype(result), bigEndian);\n return result;\n }\n\n /**\n * Convert to Uint8Array\n * @param bigEndian Little or Big Endian? Default: false\n * @returns Uint8Array\n */\n @inline\n toUint8Array(bigEndian: bool = false): Uint8Array {\n var result = new Uint8Array(16);\n this.toArrayBuffer(result.dataStart, bigEndian);\n return result;\n }\n\n // TODO\n}\n","type auto = i32;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isInteger(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isFloat(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isBoolean(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isSigned(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isReference(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isString(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isArray(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isArrayLike(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isFunction(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isNullable(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isDefined(expression: auto): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isConstant(expression: auto): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isManaged(value?: T): bool;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isVoid(): bool;\n\n// @ts-ignore\n@builtin\nexport declare function lengthof(func?: T): i32;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function clz(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function ctz(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function popcnt(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function rotl(value: T, shift: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function rotr(value: T, shift: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function abs(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function max(left: T, right: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function min(left: T, right: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function ceil(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function floor(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function copysign(left: T, right: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function nearest(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function reinterpret(value: number): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function sqrt(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function trunc(value: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function add(left: T, right: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function sub(left: T, right: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function mul(left: T, right: T): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function div(left: T, right: T): T;\n\n// @ts-ignore: decorator\n@unsafe @builtin\nexport declare function load(ptr: usize, immOffset?: usize, immAlign?: usize): T;\n\n// @ts-ignore: decorator\n@unsafe @builtin\nexport declare function store(ptr: usize, value: auto, immOffset?: usize, immAlign?: usize): void;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function sizeof(): usize; // | u32 / u64\n\n// @ts-ignore: decorator\n@builtin\nexport declare function alignof(): usize; // | u32 / u64\n\n// @ts-ignore: decorator\n@builtin\nexport declare function offsetof(fieldName?: string): usize; // | u32 / u64\n\n// @ts-ignore: decorator\n@builtin\nexport declare function idof(): u32;\n\n// @ts-ignore\n@builtin\nexport declare function nameof(): string;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function select(ifTrue: T, ifFalse: T, condition: bool): T;\n\n// @ts-ignore: decorator\n@unsafe @builtin\nexport declare function unreachable(): auto;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function changetype(value: auto): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function assert(isTrueish: T, message?: string): T;\n\n// @ts-ignore: decorator\n@unsafe @builtin\nexport declare function unchecked(expr: T): T;\n\n// @ts-ignore: decorator\n@unsafe @builtin\nexport declare function call_indirect(index: u32, ...args: auto[]): T;\n\n// @ts-ignore: decorator\n@builtin\nexport declare function instantiate(...args: auto[]): T;\n\nexport namespace atomic {\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load(ptr: usize, immOffset?: usize): T;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store(ptr: usize, value: T, immOffset?: usize): void;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(ptr: usize, value: T, immOffset?: usize): T;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(ptr: usize, value: T, immOffset?: usize): T;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and(ptr: usize, value: T, immOffset?: usize): T;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or(ptr: usize, value: T, immOffset?: usize): T;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor(ptr: usize, value: T, immOffset?: usize): T;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function xchg(ptr: usize, value: T, immOffset?: usize): T;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function cmpxchg(ptr: usize, expected: T, replacement: T, immOffset?: usize): T;\n\n // @ts-ignore: decorator\n @builtin\n export declare function wait(ptr: usize, expected: T, timeout: i64): AtomicWaitResult;\n\n // @ts-ignore: decorator\n @builtin\n export declare function notify(ptr: usize, count: i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function fence(): void;\n}\n\n// @ts-ignore: decorator\n@lazy\nexport const enum AtomicWaitResult {\n OK = 0,\n NOT_EQUAL = 1,\n TIMED_OUT = 2\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function i8(value: auto): i8;\n\nexport namespace i8 {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: i8 = -128;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: i8 = 127;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function i16(value: auto): i16;\n\nexport namespace i16 {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: i16 = -32768;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: i16 = 32767;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function i32(value: auto): i32;\n\nexport namespace i32 {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: i32 = -2147483648;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: i32 = 2147483647;\n\n // @ts-ignore: decorator\n @builtin\n export declare function clz(value: i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ctz(value: i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function popcnt(value: i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(left: i32, right:i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(left: i32, right:i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(left: i32, right:i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div_s(left: i32, right:i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div_u(left: i32, right:i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function rotl(value: i32, shift: i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function rotr(value: i32, shift: i32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function reinterpret_f32(value: f32): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load8_s(ptr: usize, immOffset?: usize, immAlign?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load8_u(ptr: usize, immOffset?: usize, immAlign?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load16_s(ptr: usize, immOffset?: usize, immAlign?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load16_u(ptr: usize, immOffset?: usize, immAlign?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load(ptr: usize, immOffset?: usize, immAlign?: usize): i32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store8(ptr: usize, value: i32, immOffset?: usize, immAlign?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store16(ptr: usize, value: i32, immOffset?: usize, immAlign?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store(ptr: usize, value: i32, immOffset?: usize, immAlign?: usize): void;\n\n export namespace atomic {\n\n // @ts-ignore: decorator\n @builtin\n export declare function load8_u(ptr: usize, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load16_u(ptr: usize, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load(ptr: usize, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store8(ptr: usize, value: i32, immOffset?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store16(ptr: usize, value: i32, immOffset?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store(ptr: usize, value: i32, immOffset?: usize): void;\n\n // @ts-ignore: decorator\n @builtin\n export declare function wait(ptr: usize, expected: i32, timeout: i64): AtomicWaitResult;\n\n export namespace rmw8 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function xchg_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function cmpxchg_u(ptr: usize, expected: i32, replacement: i32, immOffset?: usize): i32;\n }\n\n export namespace rmw16 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function xchg_u(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function cmpxchg_u(ptr: usize, expected: i32, replacement: i32, immOffset?: usize): i32;\n }\n\n export namespace rmw {\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function xchg(ptr: usize, value: i32, immOffset?: usize): i32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function cmpxchg(ptr: usize, expected: i32, replacement: i32, immOffset?: usize): i32;\n }\n }\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function i64(value: auto): i64;\n\nexport namespace i64 {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: i64 = -9223372036854775808;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: i64 = 9223372036854775807;\n\n // @ts-ignore: decorator\n @builtin\n export declare function clz(value: i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ctz(value: i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(left: i64, right:i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(left: i64, right:i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(left: i64, right:i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div_s(left: i64, right:i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div_u(left: i64, right:i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load8_s(ptr: usize, immOffset?: usize, immAlign?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load8_u(ptr: usize, immOffset?: usize, immAlign?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load16_s(ptr: usize, immOffset?: usize, immAlign?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load16_u(ptr: usize, immOffset?: usize, immAlign?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load32_s(ptr: usize, immOffset?: usize, immAlign?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load32_u(ptr: usize, immOffset?: usize, immAlign?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load(ptr: usize, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function popcnt(value: i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function rotl(value: i64, shift: i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function rotr(value: i64, shift: i64): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function reinterpret_f64(value: f64): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store8(ptr: usize, value: i64, immOffset?: usize, immAlign?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store16(ptr: usize, value: i64, immOffset?: usize, immAlign?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store32(ptr: usize, value: i64, immOffset?: usize, immAlign?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store(ptr: usize, value: i64, immOffset?: usize, immAlign?: usize): void;\n\n export namespace atomic {\n\n // @ts-ignore: decorator\n @builtin\n export declare function load8_u(ptr: usize, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load16_u(ptr: usize, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load32_u(ptr: usize, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load(ptr: usize, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store8(ptr: usize, value: i64, immOffset?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store16(ptr: usize, value: i64, immOffset?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store32(ptr: usize, value: i64, immOffset?: usize): void;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store(ptr: usize, value: i64, immOffset?: usize): void;\n\n // @ts-ignore: decorator\n @builtin\n export declare function wait(ptr: usize, expected: i64, timeout: i64): AtomicWaitResult;\n\n export namespace rmw8 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function xchg_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function cmpxchg_u(ptr: usize, expected: i64, replacement: i64, immOffset?: usize): i64;\n }\n\n export namespace rmw16 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function xchg_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function cmpxchg_u(ptr: usize, expected: i64, replacement: i64, immOffset?: usize): i64;\n }\n\n export namespace rmw32 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function xchg_u(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function cmpxchg_u(ptr: usize, expected: i64, replacement: i64, immOffset?: usize): i64;\n }\n\n export namespace rmw {\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function xchg(ptr: usize, value: i64, immOffset?: usize): i64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function cmpxchg(ptr: usize, expected: i64, replacement: i64, immOffset?: usize): i64;\n }\n }\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function isize(value: auto): isize;\n\nexport namespace isize {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: isize = sizeof() == sizeof()\n ? -2147483648\n : -9223372036854775808;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: isize = sizeof() == sizeof()\n ? 2147483647\n : 9223372036854775807;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function u8(value: auto): u8;\n\nexport namespace u8 {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: u8 = 0;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: u8 = 255;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function u16(value: auto): u16;\n\nexport namespace u16 {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: u16 = 0;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: u16 = 65535;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function u32(value: auto): u32;\n\nexport namespace u32 {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: u32 = 0;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: u32 = 4294967295;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function u64(value: auto): u64;\n\nexport namespace u64 {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: u64 = 0;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: u64 = 18446744073709551615;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function usize(value: auto): usize;\n\nexport namespace usize {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: usize = 0;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: usize = sizeof() == sizeof()\n ? 4294967295\n : 18446744073709551615;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function bool(value: auto): bool;\n\nexport namespace bool {\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE: bool = false;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE: bool = true;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function f32(value: auto): f32;\n\nexport namespace f32 {\n\n // @ts-ignore: decorator\n @lazy\n export const EPSILON = reinterpret(0x34000000); // 0x1p-23f\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE = reinterpret(0x00000001); // 0x0.000001p+0f\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE = reinterpret(0x7F7FFFFF); // 0x1.fffffep+127f\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_NORMAL_VALUE = reinterpret(0x00800000); // 0x1p-126f\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_SAFE_INTEGER: f32 = -16777215;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_SAFE_INTEGER: f32 = 16777215;\n\n // @ts-ignore: decorator\n @lazy\n export const POSITIVE_INFINITY: f32 = Infinity;\n\n // @ts-ignore: decorator\n @lazy\n export const NEGATIVE_INFINITY: f32 = -Infinity;\n\n // @ts-ignore: decorator\n @lazy\n export const NaN: f32 = 0.0 / 0.0;\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(value: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ceil(value: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function copysign(x: f32, y: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function floor(value: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load(ptr: usize, immOffset?: usize, immAlign?: usize): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max(left: f32, right: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min(left: f32, right: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function nearest(value: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function reinterpret_i32(value: i32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sqrt(value: f32): f32;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store(ptr: usize, value: f32, immOffset?: usize, immAlign?: usize): void;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc(value: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(left: f32, right: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(left: f32, right: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(left: f32, right: f32): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div(left: f32, right: f32): f32;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function f64(value: auto): f64;\n\nexport namespace f64 {\n\n // @ts-ignore: decorator\n @lazy\n export const EPSILON = reinterpret(0x3CB0000000000000); // 0x1p-52\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_VALUE = reinterpret(0x0000000000000001); // 0x0.0000000000001p+0\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_VALUE = reinterpret(0x7FEFFFFFFFFFFFFF); // 0x1.fffffffffffffp+1023\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_NORMAL_VALUE = reinterpret(0x0010000000000000); // 0x1p-1022\n\n // @ts-ignore: decorator\n @lazy\n export const MIN_SAFE_INTEGER: f64 = -9007199254740991;\n\n // @ts-ignore: decorator\n @lazy\n export const MAX_SAFE_INTEGER: f64 = 9007199254740991;\n\n // @ts-ignore: decorator\n @lazy\n export const POSITIVE_INFINITY: f64 = Infinity;\n\n // @ts-ignore: decorator\n @lazy\n export const NEGATIVE_INFINITY: f64 = -Infinity;\n\n // @ts-ignore: decorator\n @lazy\n export const NaN: f64 = 0.0 / 0.0;\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(value: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ceil(value: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function copysign(x: f64, y: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function floor(value: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load(ptr: usize, immOffset?: usize, immAlign?: usize): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max(left: f64, right: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min(left: f64, right: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function nearest(value: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function reinterpret_i64(value: i64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sqrt(value: f64): f64;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store(ptr: usize, value: f64, immOffset?: usize, immAlign?: usize): void;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc(value: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(left: f64, right: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(left: f64, right: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(left: f64, right: f64): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div(left: f64, right: f64): f64;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function v128(\n a: i8, b: i8, c: i8, d: i8, e: i8, f: i8, g: i8, h: i8,\n i: i8, j: i8, k: i8, l: i8, m: i8, n: i8, o: i8, p: i8\n): v128;\n\nexport namespace v128 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function splat(x: T): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane(x: v128, idx: u8): T;\n\n // @ts-ignore: decorator\n @builtin\n export declare function replace_lane(x: v128, idx: u8, value: T): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shuffle(a: v128, b: v128, ...lanes: u8[]): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function swizzle(a: v128, s: v128): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load(ptr: usize, immOffset?: usize, immAlign?: usize): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load_ext(ptr: usize, immOffset?: usize, immAlign?: usize): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load_zero(ptr: usize, immOffset?: usize, immAlign?: usize): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load_lane(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store_lane(ptr: usize, vec: v128, idx: u8, immOffset?: usize, immAlign?: usize): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load8x8_s(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load8x8_u(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load16x4_s(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load16x4_u(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load32x2_s(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function load32x2_u(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load_splat(ptr: usize, immOffset?: usize, immAlign?: usize): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load8_splat(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load16_splat(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load32_splat(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load64_splat(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load32_zero(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load64_zero(ptr: usize, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load8_lane(ptr: usize, vec: v128, idx: u8, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load16_lane(ptr: usize, vec: v128, idx: u8, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load32_lane(ptr: usize, vec: v128, idx: u8, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function load64_lane(ptr: usize, vec: v128, idx: u8, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store8_lane(ptr: usize, vec: v128, idx: u8, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store16_lane(ptr: usize, vec: v128, idx: u8, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store32_lane(ptr: usize, vec: v128, idx: u8, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store64_lane(ptr: usize, vec: v128, idx: u8, immOffset?: u32, immAlign?: u32): v128;\n\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function store(ptr: usize, value: v128, immOffset?: usize, immAlign?: usize): void;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div(a: v128, b: v128): v128; // f32, f64 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function neg(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_sat(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_sat(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shl(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function and(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function or(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function xor(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function andnot(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function not(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function bitselect(v1: v128, v2: v128, c: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function any_true(a: v128): bool;\n\n // @ts-ignore: decorator\n @builtin\n export declare function all_true(a: v128): bool;\n\n // @ts-ignore: decorator\n @builtin\n export declare function bitmask(a: v128): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function popcnt(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function pmin(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function pmax(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function dot(a: v128, b: v128): v128; // i16 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function avgr(a: v128, b: v128): v128; // u8, u16 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(a: v128): v128; // f32, f64 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function sqrt(a: v128): v128; // f32, f64 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function ceil(a: v128): v128; // f32, f64 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function floor(a: v128): v128; // f32, f64 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc(a: v128): v128; // f32, f64 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function nearest(a: v128): v128; // f32, f64 only\n\n // @ts-ignore: decorator\n @builtin\n export declare function eq(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ne(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function convert(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function convert_low(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc_sat(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc_sat_zero(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function narrow(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_low(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_high(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extadd_pairwise(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function demote_zero(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function promote_low(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function q15mulr_sat(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extmul_low(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extmul_high(a: v128, b: v128): v128;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function i8x16(\n a: i8, b: i8, c: i8, d: i8, e: i8, f: i8, g: i8, h: i8,\n i: i8, j: i8, k: i8, l: i8, m: i8, n: i8, o: i8, p: i8\n): v128;\n\nexport namespace i8x16 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function splat(x: i8): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane_s(x: v128, idx: u8): i8;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane_u(x: v128, idx: u8): u8;\n\n // @ts-ignore: decorator\n @builtin\n export declare function replace_lane(x: v128, idx: u8, value: i8): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function avgr_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function neg(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_sat_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_sat_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_sat_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_sat_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shl(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr_s(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr_u(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function all_true(a: v128): bool;\n\n // @ts-ignore: decorator\n @builtin\n export declare function bitmask(a: v128): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function popcnt(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function eq(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ne(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function narrow_i16x8_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function narrow_i16x8_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shuffle(\n a: v128, b: v128,\n l0: u8, l1: u8, l2: u8, l3: u8, l4: u8, l5: u8, l6: u8, l7: u8,\n l8: u8, l9: u8, l10: u8, l11: u8, l12: u8, l13: u8, l14: u8, l15: u8\n ): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function swizzle(a: v128, s: v128): v128;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function i16x8(a: i16, b: i16, c: i16, d: i16, e: i16, f: i16, g: i16, h: i16): v128;\n\nexport namespace i16x8 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function splat(x: i16): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane_s(x: v128, idx: u8): i16;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane_u(x: v128, idx: u8): u16;\n\n // @ts-ignore: decorator\n @builtin\n export declare function replace_lane(x: v128, idx: u8, value: i16): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function avgr_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function neg(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_sat_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add_sat_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_sat_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub_sat_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shl(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr_s(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr_u(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function all_true(a: v128): bool;\n\n // @ts-ignore: decorator\n @builtin\n export declare function bitmask(a: v128): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function eq(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ne(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function narrow_i32x4_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function narrow_i32x4_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_low_i8x16_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_low_i8x16_u(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_high_i8x16_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_high_i8x16_u(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extadd_pairwise_i8x16_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extadd_pairwise_i8x16_u(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function q15mulr_sat_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extmul_low_i8x16_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extmul_low_i8x16_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extmul_high_i8x16_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extmul_high_i8x16_u(a: v128, b: v128): v128;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function i32x4(a: i32, b: i32, c: i32, d: i32): v128;\n\nexport namespace i32x4 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function splat(x: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane(x: v128, idx: u8): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function replace_lane(x: v128, idx: u8, value: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function dot_i16x8_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function neg(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shl(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr_s(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr_u(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function all_true(a: v128): bool;\n\n // @ts-ignore: decorator\n @builtin\n export declare function bitmask(a: v128): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function eq(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ne(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc_sat_f32x4_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc_sat_f32x4_u(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc_sat_f64x2_s_zero(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc_sat_f64x2_u_zero(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_low_i16x8_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_low_i16x8_u(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_high_i16x8_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_high_i16x8_u(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extadd_pairwise_i16x8_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extadd_pairwise_i16x8_u(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extmul_low_i16x8_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extmul_low_i16x8_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extmul_high_i16x8_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extmul_high_i16x8_u(a: v128, b: v128): v128;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function i64x2(a: i64, b: i64): v128;\n\nexport namespace i64x2 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function splat(x: i64): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane(x: v128, idx: u8): i64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function replace_lane(x: v128, idx: u8, value: i64): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function neg(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shl(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr_s(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function shr_u(a: v128, b: i32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function all_true(a: v128): bool;\n\n // @ts-ignore: decorator\n @builtin\n export declare function bitmask(a: v128): i32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function eq(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ne(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_low_i32x4_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_low_i32x4_u(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_high_i32x4_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extend_high_i32x4_u(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extmul_low_i32x4_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extmul_low_i32x4_u(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extmul_high_i32x4_s(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extmul_high_i32x4_u(a: v128, b: v128): v128;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function f32x4(a: f32, b: f32, c: f32, d: f32): v128;\n\nexport namespace f32x4 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function splat(x: f32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane(x: v128, idx: u8): f32;\n\n // @ts-ignore: decorator\n @builtin\n export declare function replace_lane(x: v128, idx: u8, value: f32): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function neg(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function pmin(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function pmax(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sqrt(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ceil(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function floor(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function nearest(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function eq(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ne(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function convert_i32x4_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function convert_i32x4_u(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function demote_f64x2_zero(a: v128): v128;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare function f64x2(a: f64, b: f64): v128;\n\nexport namespace f64x2 {\n\n // @ts-ignore: decorator\n @builtin\n export declare function splat(x: f64): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function extract_lane(x: v128, idx: u8): f64;\n\n // @ts-ignore: decorator\n @builtin\n export declare function replace_lane(x: v128, idx: u8, value: f64): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function add(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sub(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function mul(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function div(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function neg(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function min(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function max(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function pmin(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function pmax(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function abs(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function sqrt(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ceil(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function floor(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function trunc(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function nearest(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function eq(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ne(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function lt(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function le(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function gt(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function ge(a: v128, b: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function convert_low_i32x4_s(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function convert_low_i32x4_u(a: v128): v128;\n\n // @ts-ignore: decorator\n @builtin\n export declare function promote_low_f32x4(a: v128): v128;\n}\n\n@final\nexport abstract class i31 { // FIXME: usage of 'new' requires a class :(\n\n // @ts-ignore: decorator\n @builtin\n static new(value: i32): i31ref { return changetype(unreachable()); }\n\n // @ts-ignore: decorator\n @builtin\n static get(i31expr: i31ref): i32 { return unreachable(); }\n}\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n// @ts-ignore: decorator\n@external(\"env\", \"abort\")\ndeclare function abort(\n message?: string | null,\n fileName?: string | null,\n lineNumber?: u32,\n columnNumber?: u32\n): void;\n\n// @ts-ignore: decorator\n@external(\"env\", \"trace\")\ndeclare function trace(\n message: string,\n n?: i32,\n a0?: f64,\n a1?: f64,\n a2?: f64,\n a3?: f64,\n a4?: f64\n): void;\n\n// @ts-ignore: decorator\n@external(\"env\", \"seed\")\ndeclare function seed(): f64;\n\n/* eslint-enable @typescript-eslint/no-unused-vars */\n","import { CharCode } from \"util/string\";\nimport { u128 } from \"./integer/u128\";\nimport { u256 } from \"./integer/u256\";\n\n// @ts-ignore: decorator\n@lazy const HEX_CHARS = '0123456789abcdef';\n\n// @ts-ignore: decorator\n@lazy const MaxBaseForExponent128: u64[] = [\n u64.MAX_VALUE, // 0\n u64.MAX_VALUE, // 1\n u64.MAX_VALUE, // 2\n 0x000006597FA94F5B, // 3\n 0x00000000FFFFFFFF, // 4\n 0x0000000003080C00, // 5\n 0x0000000000285145, // 6\n 0x000000000004E045, // 7\n 0x000000000000FFFF, // 8\n 0x0000000000004AA8, // 9\n 0x0000000000001BDB, // 10\n 0x0000000000000C6F, // 11\n 0x0000000000000659, // 12\n 0x0000000000000398, // 13\n 0x0000000000000235, // 14\n 0x0000000000000172, // 15\n 0x00000000000000FF, // 16\n 0x00000000000000B8, // 17\n 0x000000000000008A, // 18\n 0x000000000000006A, // 19\n 0x0000000000000054, // 20\n 0x0000000000000044, // 21\n 0x0000000000000038, // 22\n 0x000000000000002F, // 23\n 0x0000000000000028, // 24\n 0x0000000000000022, // 25\n 0x000000000000001E, // 26\n 0x000000000000001A, // 27\n 0x0000000000000017, // 28\n 0x0000000000000015, // 29\n 0x0000000000000013, // 30\n 0x0000000000000011, // 31\n 0x000000000000000F, // 32\n 0x000000000000000E, // 33\n 0x000000000000000D, // 34\n 0x000000000000000C, // 35\n 0x000000000000000B, // 36\n 0x000000000000000B, // 37\n 0x000000000000000A, // 38\n];\n\n// Use LUT wrapped by function for lazy compilation\n// @ts-ignore: decorator\n@lazy const RadixCharsTable: u8[] = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 36, 36, 36, 36, 36, 36,\n 36, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,\n 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 36, 36, 36, 36,\n 36, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,\n 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35\n];\n\n@inline\nexport function isPowerOverflow128(base: u128, exponent: i32): bool {\n if (!(exponent > 1 && base > u128.One)) return false;\n if (base.hi != 0 || exponent >= 128) return true;\n\n var low = base.lo;\n if (low <= 9) {\n switch (low) {\n case 2: return exponent > 127;\n case 3: return exponent > 80;\n case 4: return exponent > 63;\n case 5: return exponent > 55;\n case 6: return exponent > 49;\n case 7: return exponent > 45;\n case 8: return exponent > 42;\n case 9: return exponent > 40;\n }\n }\n return low > MaxBaseForExponent128[exponent];\n}\n\n// helper function for utoa\nfunction processU64(digits: Int8Array, value: u64): void {\n var length = digits.length - 1;\n for (let i = 63; i != -1; i--) {\n for (let j = 0; j <= length; j++) {\n digits[j] = digits[j] + (i8(digits[j] >= 5) * 3);\n }\n for (let j = length; j != -1; j--) {\n digits[j] = digits[j] << 1;\n if (j < length) digits[j + 1] = (digits[j+1] | i8(digits[j] > 15));\n digits[j] = digits[j] & 15;\n }\n digits[0] = digits[0] + i8((value & (1 << i)) != 0);\n }\n}\n\nexport function u128toa10(value: u128): string {\n var length = 40;\n var digits = new Int8Array(length);\n\n processU64(digits, value.hi);\n processU64(digits, value.lo);\n\n var result = \"\";\n var start = false;\n for (let i = length - 1; i != -1; i--) {\n if (!start && digits[i] > 0) start = true;\n if (start) result = result.concat(HEX_CHARS.charAt(digits[i]));\n }\n return result;\n}\n\nexport function u256toa10(value: u256): string {\n var length = 78;\n var digits = new Int8Array(length);\n\n processU64(digits, value.hi2);\n processU64(digits, value.hi1);\n processU64(digits, value.lo2);\n processU64(digits, value.lo1);\n\n var result = \"\";\n var start = false;\n for (let i = length - 1; i != -1; i--) {\n if (!start && digits[i] > 0) start = true;\n if (start) result = result.concat(HEX_CHARS.charAt(digits[i]));\n }\n return result;\n}\n\nexport function atou128(str: string, radix: i32 = 10): u128 {\n if (radix < 2 || radix > 36) {\n throw new Error(\"Invalid radix\");\n }\n var len = str.length;\n if (!len) return u128.Zero;\n\n var first = str.charCodeAt(0);\n if (len == 1 && first == CharCode._0) {\n return u128.Zero;\n }\n var isNeg = first == CharCode.MINUS;\n // @ts-ignore\n var index = (isNeg | (first == CharCode.PLUS));\n\n if (str.charCodeAt(index) == CharCode._0) {\n let second = str.charCodeAt(++index);\n if (second == CharCode.x || second == CharCode.X) {\n radix = 16; ++index;\n } else if (second == CharCode.o || second == CharCode.O) {\n radix = 8; ++index;\n } else if (second == CharCode.b || second == CharCode.B) {\n radix = 2; ++index;\n }\n }\n var result = u128.Zero;\n var table = RadixCharsTable;\n\n if (ASC_SHRINK_LEVEL >= 1) {\n let radix128 = u128.fromU64(radix);\n do {\n let n: u32 = str.charCodeAt(index) - CharCode._0;\n if (n > (CharCode.z - CharCode._0)) break;\n\n let num = unchecked(table[n]);\n if (num >= radix) break;\n\n // @ts-ignore\n result *= radix128;\n // @ts-ignore\n result += u128.fromU64(num);\n } while (++index < len);\n } else {\n switch (radix) {\n case 2: {\n do {\n let num: u32 = str.charCodeAt(index) - CharCode._0;\n if (num >= 2) break;\n // @ts-ignore\n result <<= 1;\n // @ts-ignore\n result |= u128.fromU64(num);\n } while (++index < len);\n break;\n }\n case 10: {\n do {\n let num: u32 = str.charCodeAt(index) - CharCode._0;\n if (num >= 10) break;\n // @ts-ignore\n result = (result << 3) + (result << 1);\n // @ts-ignore\n result += u128.fromU64(num);\n } while (++index < len);\n break;\n }\n case 16: {\n do {\n let n: u32 = str.charCodeAt(index) - CharCode._0;\n if (n > (CharCode.z - CharCode._0)) break;\n\n let num = unchecked(table[n]);\n if (num >= 16) break;\n\n // @ts-ignore\n result <<= 4;\n // @ts-ignore\n result |= u128.fromU64(num);\n } while (++index < len);\n break;\n }\n default: {\n let radix128 = u128.fromU64(radix);\n do {\n let n: u32 = str.charCodeAt(index) - CharCode._0;\n if (n > (CharCode.z - CharCode._0)) break;\n\n let num = unchecked(table[n]);\n if (num >= radix) break;\n\n // @ts-ignore\n result *= radix128;\n // @ts-ignore\n result += u128.fromU64(num);\n } while (++index < len);\n break;\n }\n }\n }\n // @ts-ignore\n return isNeg ? -result : result;\n}\n","/// \n\nimport { OBJECT, BLOCK_MAXSIZE, TOTAL_OVERHEAD } from \"./rt/common\";\nimport { compareImpl, strtol, strtod, isSpace, isAscii, isFinalSigma, toLower8, toUpper8 } from \"./util/string\";\nimport { SPECIALS_UPPER, casemap, bsearch } from \"./util/casemap\";\nimport { E_INDEXOUTOFRANGE, E_INVALIDLENGTH, E_UNPAIRED_SURROGATE } from \"./util/error\";\nimport { idof } from \"./builtins\";\nimport { Array } from \"./array\";\n\n@final export abstract class String {\n\n @lazy static readonly MAX_LENGTH: i32 = (BLOCK_MAXSIZE >>> alignof());\n\n static fromCharCode(unit: i32, surr: i32 = -1): String {\n var hasSur = surr > 0;\n var out = changetype(__new(2 << i32(hasSur), idof()));\n store(changetype(out), unit);\n if (hasSur) store(changetype(out), surr, 2);\n return out;\n }\n\n static fromCharCodes(units: Array): String {\n var length = units.length;\n var out = changetype(__new(length << 1, idof()));\n var ptr = units.dataStart;\n for (let i = 0; i < length; ++i) {\n store(changetype(out) + (i << 1), load(ptr + (i << 2)));\n }\n return out;\n }\n\n static fromCodePoint(code: i32): String {\n var hasSur = code > 0xFFFF;\n var out = changetype(__new(2 << i32(hasSur), idof()));\n if (!hasSur) {\n store(changetype(out), code);\n } else {\n // Checks valid code point range\n assert(code <= 0x10FFFF);\n code -= 0x10000;\n let hi = (code & 0x03FF) | 0xDC00;\n let lo = code >>> 10 | 0xD800;\n store(changetype(out), lo | hi << 16);\n }\n return out;\n }\n\n @builtin static raw(parts: TemplateStringsArray, ...args: unknown[]): string { return unreachable(); }\n\n get length(): i32 {\n return changetype(changetype(this) - TOTAL_OVERHEAD).rtSize >> 1;\n }\n\n at(pos: i32): String {\n var len = this.length;\n pos += select(0, len, pos >= 0);\n if (pos >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n var out = __new(2, idof());\n store(out, load(changetype(this) + (pos << 1)));\n return changetype(out); // retains\n }\n\n @operator(\"[]\") charAt(pos: i32): String {\n if (pos >= this.length) return changetype(\"\");\n var out = changetype(__new(2, idof()));\n store(changetype(out), load(changetype(this) + (pos << 1)));\n return out;\n }\n\n charCodeAt(pos: i32): i32 {\n if (pos >= this.length) return -1; // (NaN)\n return load(changetype(this) + (pos << 1));\n }\n\n codePointAt(pos: i32): i32 {\n var len = this.length;\n if (pos >= len) return -1; // (undefined)\n var first = load(changetype(this) + (pos << 1));\n if ((first & 0xFC00) != 0xD800 || pos + 1 == len) return first;\n var second = load(changetype(this) + (pos << 1), 2);\n if ((second & 0xFC00) != 0xDC00) return first;\n return (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;\n }\n\n @operator(\"+\") private static __concat(left: String, right: String): String {\n return left.concat(right);\n }\n\n concat(other: String): String {\n var thisSize: isize = this.length << 1;\n var otherSize: isize = other.length << 1;\n var outSize: usize = thisSize + otherSize;\n if (outSize == 0) return changetype(\"\");\n var out = changetype(__new(outSize, idof()));\n memory.copy(changetype(out), changetype(this), thisSize);\n memory.copy(changetype(out) + thisSize, changetype(other), otherSize);\n return out;\n }\n\n endsWith(search: String, end: i32 = String.MAX_LENGTH): bool {\n end = min(max(end, 0), this.length);\n var searchLength = search.length;\n var searchStart = end - searchLength;\n if (searchStart < 0) return false;\n // @ts-ignore: string <-> String\n return !compareImpl(this, searchStart, search, 0, searchLength);\n }\n\n @operator(\"==\") private static __eq(left: String | null, right: String | null): bool {\n if (left === right) return true;\n if (left === null || right === null) return false;\n var leftLength = left.length;\n if (leftLength != right.length) return false;\n // @ts-ignore: string <-> String\n return !compareImpl(left, 0, right, 0, leftLength);\n }\n\n @operator.prefix(\"!\")\n private static __not(str: String | null): bool {\n return str === null || !str.length;\n }\n\n @operator(\"!=\")\n private static __ne(left: String | null, right: String | null): bool {\n return !this.__eq(left, right);\n }\n\n @operator(\">\") private static __gt(left: String, right: String): bool {\n if (left === right) return false;\n var leftLength = left.length;\n if (!leftLength) return false;\n var rightLength = right.length;\n if (!rightLength) return true;\n // @ts-ignore: string <-> String\n var res = compareImpl(left, 0, right, 0, min(leftLength, rightLength));\n return res ? res > 0 : leftLength > rightLength;\n }\n\n @operator(\">=\") private static __gte(left: String, right: String): bool {\n return !this.__lt(left, right);\n }\n\n @operator(\"<\") private static __lt(left: String, right: String): bool {\n if (left === right) return false;\n var rightLength = right.length;\n if (!rightLength) return false;\n var leftLength = left.length;\n if (!leftLength) return true;\n // @ts-ignore: string <-> String\n var res = compareImpl(left, 0, right, 0, min(leftLength, rightLength));\n return res ? res < 0 : leftLength < rightLength;\n }\n\n @operator(\"<=\") private static __lte(left: String, right: String): bool {\n return !this.__gt(left, right);\n }\n\n includes(search: String, start: i32 = 0): bool {\n return this.indexOf(search, start) != -1;\n }\n\n indexOf(search: String, start: i32 = 0): i32 {\n var searchLen = search.length;\n if (!searchLen) return 0;\n var len = this.length;\n if (!len) return -1;\n var searchStart = min(max(start, 0), len);\n for (len -= searchLen; searchStart <= len; ++searchStart) {\n // @ts-ignore: string <-> String\n if (!compareImpl(this, searchStart, search, 0, searchLen)) return searchStart;\n }\n return -1;\n }\n\n lastIndexOf(search: String, start: i32 = i32.MAX_VALUE): i32 {\n var searchLen = search.length;\n if (!searchLen) return this.length;\n var len = this.length;\n if (!len) return -1;\n var searchStart = min(max(start, 0), len - searchLen);\n for (; searchStart >= 0; --searchStart) {\n // @ts-ignore: string <-> String\n if (!compareImpl(this, searchStart, search, 0, searchLen)) return searchStart;\n }\n return -1;\n }\n\n // TODO: implement full locale comparison with locales and Collator options\n localeCompare(other: String): i32 {\n if (other === this) return 0; // compare pointers\n var len: isize = this.length;\n var otherLen: isize = other.length;\n if (otherLen != len) return select(1, -1, len > otherLen);\n if (!otherLen) return 0; // \"\" == \"\"\n // @ts-ignore: string <-> String\n return compareImpl(this, 0, other, 0, otherLen);\n }\n\n startsWith(search: String, start: i32 = 0): bool {\n var len = this.length;\n var searchStart = min(max(start, 0), len);\n var searchLength = search.length;\n if (searchLength + searchStart > len) return false;\n // @ts-ignore: string <-> String\n return !compareImpl(this, searchStart, search, 0, searchLength);\n }\n\n substr(start: i32, length: i32 = i32.MAX_VALUE): String { // legacy\n var intStart: isize = start;\n var end: isize = length;\n var len: isize = this.length;\n if (intStart < 0) intStart = max(len + intStart, 0);\n var size = min(max(end, 0), len - intStart) << 1;\n if (size <= 0) return changetype(\"\");\n var out = changetype(__new(size, idof()));\n memory.copy(changetype(out), changetype(this) + (intStart << 1), size);\n return out;\n }\n\n substring(start: i32, end: i32 = i32.MAX_VALUE): String {\n var len: isize = this.length;\n var finalStart = min(max(start, 0), len);\n var finalEnd = min(max(end, 0), len);\n var fromPos = min(finalStart, finalEnd) << 1;\n var toPos = max(finalStart, finalEnd) << 1;\n var size = toPos - fromPos;\n if (!size) return changetype(\"\");\n if (!fromPos && toPos == len << 1) return this;\n var out = changetype(__new(size, idof()));\n memory.copy(changetype(out), changetype(this) + fromPos, size);\n return out;\n }\n\n trim(): String {\n var len = this.length;\n var size: usize = len << 1;\n while (size && isSpace(load(changetype(this) + size - 2))) {\n size -= 2;\n }\n var offset: usize = 0;\n while (offset < size && isSpace(load(changetype(this) + offset))) {\n offset += 2; size -= 2;\n }\n if (!size) return changetype(\"\");\n if (!offset && size == len << 1) return this;\n var out = changetype(__new(size, idof()));\n memory.copy(changetype(out), changetype(this) + offset, size);\n return out;\n }\n\n @inline\n trimLeft(): String {\n return this.trimStart();\n }\n\n @inline\n trimRight(): String {\n return this.trimEnd();\n }\n\n trimStart(): String {\n var size = this.length << 1;\n var offset: usize = 0;\n while (offset < size && isSpace(load(changetype(this) + offset))) {\n offset += 2;\n }\n if (!offset) return this;\n size -= offset;\n if (!size) return changetype(\"\");\n var out = changetype(__new(size, idof()));\n memory.copy(changetype(out), changetype(this) + offset, size);\n return out;\n }\n\n trimEnd(): String {\n var originalSize = this.length << 1;\n var size = originalSize;\n while (size && isSpace(load(changetype(this) + size - 2))) {\n size -= 2;\n }\n if (!size) return changetype(\"\");\n if (size == originalSize) return this;\n var out = changetype(__new(size, idof()));\n memory.copy(changetype(out), changetype(this), size);\n return out;\n }\n\n padStart(length: i32, pad: string = \" \"): String {\n var thisSize = this.length << 1;\n var targetSize = length << 1;\n var padSize = pad.length << 1;\n if (targetSize < thisSize || !padSize) return this;\n var prependSize = targetSize - thisSize;\n var out = changetype(__new(targetSize, idof()));\n if (prependSize > padSize) {\n let repeatCount = (prependSize - 2) / padSize;\n let restBase = repeatCount * padSize;\n let restSize = prependSize - restBase;\n memory.repeat(changetype(out), changetype(pad), padSize, repeatCount);\n memory.copy(changetype(out) + restBase, changetype(pad), restSize);\n } else {\n memory.copy(changetype(out), changetype(pad), prependSize);\n }\n memory.copy(changetype(out) + prependSize, changetype(this), thisSize);\n return out;\n }\n\n padEnd(length: i32, pad: string = \" \"): String {\n var thisSize = this.length << 1;\n var targetSize = length << 1;\n var padSize = pad.length << 1;\n if (targetSize < thisSize || !padSize) return this;\n var appendSize = targetSize - thisSize;\n var out = changetype(__new(targetSize, idof()));\n memory.copy(changetype(out), changetype(this), thisSize);\n if (appendSize > padSize) {\n let repeatCount = (appendSize - 2) / padSize;\n let restBase = repeatCount * padSize;\n let restSize = appendSize - restBase;\n memory.repeat(changetype(out) + thisSize, changetype(pad), padSize, repeatCount);\n memory.copy(changetype(out) + thisSize + restBase, changetype(pad), restSize);\n } else {\n memory.copy(changetype(out) + thisSize, changetype(pad), appendSize);\n }\n return out;\n }\n\n repeat(count: i32 = 0): String {\n var length = this.length;\n\n // Most browsers can't handle strings 1 << 28 chars or longer\n if (count < 0 || length * count > (1 << 28)) {\n throw new RangeError(E_INVALIDLENGTH);\n }\n\n if (count == 0 || !length) return changetype(\"\");\n if (count == 1) return this;\n var out = changetype(__new((length * count) << 1, idof()));\n memory.repeat(changetype(out), changetype(this), length << 1, count);\n return out;\n }\n\n replace(search: String, replacement: String): String {\n var len: usize = this.length;\n var slen: usize = search.length;\n if (len <= slen) {\n return len < slen ? this : select(replacement, this, search == this);\n }\n var index: isize = this.indexOf(search);\n if (~index) {\n let rlen: usize = replacement.length;\n len -= slen;\n let olen = len + rlen;\n if (olen) {\n let out = changetype(__new(olen << 1, idof()));\n memory.copy(changetype(out), changetype(this), index << 1);\n memory.copy(\n changetype(out) + (index << 1),\n changetype(replacement),\n rlen << 1\n );\n memory.copy(\n changetype(out) + ((index + rlen) << 1),\n changetype(this) + ((index + slen) << 1),\n (len - index) << 1\n );\n return out;\n }\n }\n return this;\n }\n\n replaceAll(search: String, replacement: String): String {\n var thisLen: usize = this.length;\n var searchLen: usize = search.length;\n if (thisLen <= searchLen) {\n return thisLen < searchLen\n ? this\n : select(replacement, this, search == this);\n }\n var replaceLen: usize = replacement.length;\n if (!searchLen) {\n if (!replaceLen) return this;\n // Special case: 'abc'.replaceAll('', '-') -> '-a-b-c-'\n let out = changetype(__new((thisLen + (thisLen + 1) * replaceLen) << 1, idof()));\n memory.copy(changetype(out), changetype(replacement), replaceLen << 1);\n let offset = replaceLen;\n for (let i: usize = 0; i < thisLen; ++i) {\n store(\n changetype(out) + (offset++ << 1),\n load(changetype(this) + (i << 1))\n );\n memory.copy(\n changetype(out) + (offset << 1),\n changetype(replacement),\n replaceLen << 1\n );\n offset += replaceLen;\n }\n return out;\n }\n var prev: isize = 0, next: isize = 0;\n if (searchLen == replaceLen) {\n // Fast path when search and replacement have same length\n let outSize = thisLen << 1;\n let out = changetype(__new(outSize, idof()));\n memory.copy(changetype(out), changetype(this), outSize);\n while (~(next = this.indexOf(search, prev))) {\n memory.copy(changetype(out) + (next << 1), changetype(replacement), replaceLen << 1);\n prev = next + searchLen;\n }\n return out;\n }\n var out: String | null = null, offset: usize = 0, outSize = thisLen;\n while (~(next = this.indexOf(search, prev))) {\n if (!out) out = changetype(__new(thisLen << 1, idof()));\n let chunk = next - prev;\n if (offset + chunk + replaceLen > outSize) {\n outSize <<= 1;\n out = changetype(__renew(changetype(out), outSize << 1));\n }\n memory.copy(\n changetype(out) + (offset << 1),\n changetype(this) + (prev << 1),\n chunk << 1\n );\n offset += chunk;\n memory.copy(\n changetype(out) + (offset << 1),\n changetype(replacement),\n replaceLen << 1\n );\n offset += replaceLen;\n prev = next + searchLen;\n }\n if (out) {\n let rest = thisLen - prev;\n if (offset + rest > outSize) {\n outSize <<= 1;\n out = changetype(__renew(changetype(out), outSize << 1));\n }\n if (rest) {\n memory.copy(\n changetype(out) + (offset << 1),\n changetype(this) + (prev << 1),\n rest << 1\n );\n }\n rest += offset;\n if (outSize > rest) {\n out = changetype(__renew(changetype(out), rest << 1));\n }\n return out;\n }\n return this;\n }\n\n slice(start: i32, end: i32 = i32.MAX_VALUE): String {\n var len = this.length;\n start = start < 0 ? max(start + len, 0) : min(start, len);\n end = end < 0 ? max(end + len, 0) : min(end, len);\n len = end - start;\n if (len <= 0) return changetype(\"\");\n var out = changetype(__new(len << 1, idof()));\n memory.copy(changetype(out), changetype(this) + (start << 1), len << 1);\n return out;\n }\n\n split(separator: String | null = null, limit: i32 = i32.MAX_VALUE): String[] {\n if (!limit) return changetype(__newArray(0, alignof(), idof>()));\n if (separator === null) return [this];\n var length: isize = this.length;\n var sepLen = separator.length;\n if (limit < 0) limit = i32.MAX_VALUE;\n if (!sepLen) {\n if (!length) return changetype(__newArray(0, alignof(), idof>()));\n // split by chars\n length = min(length, limit);\n let result = changetype(__newArray(length, alignof(), idof>()));\n // @ts-ignore: cast\n let resultStart = result.dataStart as usize;\n for (let i: isize = 0; i < length; ++i) {\n let charStr = changetype(__new(2, idof()));\n store(changetype(charStr), load(changetype(this) + (i << 1)));\n store(resultStart + (i << alignof()), changetype(charStr)); // result[i] = charStr\n __link(changetype(result), changetype(charStr), true);\n }\n return result;\n } else if (!length) {\n let result = changetype(__newArray(1, alignof(), idof>()));\n // @ts-ignore: cast\n store(result.dataStart as usize, changetype(\"\")); // static \"\"\n return result;\n }\n var result = changetype(__newArray(0, alignof(), idof>()));\n var end = 0, start = 0, i = 0;\n while (~(end = this.indexOf(separator, start))) {\n let len = end - start;\n if (len > 0) {\n let out = changetype(__new(len << 1, idof()));\n memory.copy(changetype(out), changetype(this) + (start << 1), len << 1);\n result.push(out);\n } else {\n result.push(changetype(\"\"));\n }\n if (++i == limit) return result;\n start = end + sepLen;\n }\n if (!start) { // also means: loop above didn't do anything\n result.push(this);\n return result;\n }\n var len = length - start;\n if (len > 0) {\n let out = changetype(__new(len << 1, idof()));\n memory.copy(changetype(out), changetype(this) + (start << 1), len << 1);\n result.push(out);\n } else {\n result.push(changetype(\"\")); // static \"\"\n }\n return result;\n }\n\n toLowerCase(): String {\n var len = this.length;\n if (!len) return this;\n var codes = changetype(__new(len * 2 * 2, idof()));\n var j: usize = 0;\n for (let i: usize = 0; i < len; ++i, ++j) {\n let c = load(changetype(this) + (i << 1));\n if (isAscii(c)) {\n store(changetype(codes) + (j << 1), toLower8(c));\n } else {\n // check and read surrogate pair\n if ((c - 0xD7FF < 0xDC00 - 0xD7FF) && i < len - 1) {\n let c1 = load(changetype(this) + (i << 1), 2);\n if (c1 - 0xDBFF < 0xE000 - 0xDBFF) {\n let c0 = c;\n c = (((c & 0x03FF) << 10) | (c1 & 0x03FF)) + 0x10000;\n ++i;\n if (c >= 0x20000) {\n store(changetype(codes) + (j << 1), c0 | (c1 << 16));\n ++j;\n continue;\n }\n }\n }\n // check special casing for lower table. It has one ently so instead lookup we just inline this.\n if (c == 0x0130) {\n // 0x0130 -> [0x0069, 0x0307]\n store(changetype(codes) + (j << 1), (0x0307 << 16) | 0x0069);\n ++j;\n } else if (c == 0x03A3) { // 'Σ'\n // Σ maps to σ but except at the end of a word where it maps to ς\n let sigma = 0x03C3; // σ\n if (len > 1 && isFinalSigma(changetype(this), i, len)) {\n sigma = 0x03C2; // ς\n }\n store(changetype(codes) + (j << 1), sigma);\n } else if (c - 0x24B6 <= 0x24CF - 0x24B6) {\n // Range 0x24B6 <= c <= 0x24CF not covered by casemap and require special early handling\n store(changetype(codes) + (j << 1), c + 26);\n } else {\n let code = casemap(c, 0) & 0x1FFFFF;\n if (code < 0x10000) {\n store(changetype(codes) + (j << 1), code);\n } else {\n // store as surrogare pair\n code -= 0x10000;\n let lo = (code >>> 10) | 0xD800;\n let hi = (code & 0x03FF) | 0xDC00;\n store(changetype(codes) + (j << 1), lo | (hi << 16));\n ++j;\n }\n }\n }\n }\n return changetype(__renew(changetype(codes), j << 1));\n }\n\n toUpperCase(): String {\n var len = this.length;\n if (!len) return this;\n var codes = changetype(__new(len * 3 * 2, idof()));\n var specialsPtr = changetype(SPECIALS_UPPER);\n var specialsLen = SPECIALS_UPPER.length;\n var j: usize = 0;\n for (let i: usize = 0; i < len; ++i, ++j) {\n let c = load(changetype(this) + (i << 1));\n if (isAscii(c)) {\n store(changetype(codes) + (j << 1), toUpper8(c));\n } else {\n // check and read surrogate pair\n if ((c - 0xD7FF < 0xDC00 - 0xD7FF) && i < len - 1) {\n let c1 = load(changetype(this) + (i << 1), 2);\n if (c1 - 0xDBFF < 0xE000 - 0xDBFF) {\n let c0 = c;\n c = (((c & 0x03FF) << 10) | (c1 & 0x03FF)) + 0x10000;\n ++i;\n if (c >= 0x20000) {\n store(changetype(codes) + (j << 1), c0 | (c1 << 16));\n ++j;\n continue;\n }\n }\n }\n // Range 0x24D0 <= c <= 0x24E9 not covered by casemap and require special early handling\n if (c - 0x24D0 <= 0x24E9 - 0x24D0) {\n // monkey patch\n store(changetype(codes) + (j << 1), c - 26);\n } else {\n let index: usize = -1;\n // Fast range check. See first and last rows in specialsUpper table\n if (c - 0x00DF <= 0xFB17 - 0x00DF) {\n index = bsearch(c, specialsPtr, specialsLen);\n }\n if (~index) {\n // load next 3 code points from row with `index` offset for specialsUpper table\n let ab = load(specialsPtr + (index << 1), 2);\n let cc = load(specialsPtr + (index << 1), 6);\n store(changetype(codes) + (j << 1), ab, 0);\n store(changetype(codes) + (j << 1), cc, 4);\n j += 1 + usize(cc != 0);\n } else {\n let code = casemap(c, 1) & 0x1FFFFF;\n if (code < 0x10000) {\n store(changetype(codes) + (j << 1), code);\n } else {\n // store as surrogare pair\n code -= 0x10000;\n let lo = (code >>> 10) | 0xD800;\n let hi = (code & 0x03FF) | 0xDC00;\n store(changetype(codes) + (j << 1), lo | (hi << 16));\n ++j;\n }\n }\n }\n }\n }\n return changetype(__renew(changetype(codes), j << 1));\n }\n\n toString(): String {\n return this;\n }\n}\n\n// @ts-ignore: nolib\nexport type string = String;\n\nexport function parseInt(str: string, radix: i32 = 0): f64 {\n return strtol(str, radix);\n}\n\nexport function parseFloat(str: string): f64 {\n return strtod(str);\n}\n\n// Encoding helpers\nexport namespace String {\n\n export namespace UTF8 {\n\n export const enum ErrorMode {\n WTF8,\n REPLACE,\n ERROR\n }\n\n export function byteLength(str: string, nullTerminated: bool = false): i32 {\n var strOff = changetype(str);\n var strEnd = strOff + changetype(changetype(str) - TOTAL_OVERHEAD).rtSize;\n var bufLen = i32(nullTerminated);\n while (strOff < strEnd) {\n let c1 = load(strOff);\n if (c1 < 128) {\n // @ts-ignore: cast\n if (nullTerminated & !c1) break;\n bufLen += 1;\n } else if (c1 < 2048) {\n bufLen += 2;\n } else {\n if ((c1 & 0xFC00) == 0xD800 && strOff + 2 < strEnd) {\n if ((load(strOff, 2) & 0xFC00) == 0xDC00) {\n bufLen += 4; strOff += 4;\n continue;\n }\n }\n bufLen += 3;\n }\n strOff += 2;\n }\n return bufLen;\n }\n\n export function encode(str: string, nullTerminated: bool = false, errorMode: ErrorMode = ErrorMode.WTF8): ArrayBuffer {\n var buf = changetype(__new(byteLength(str, nullTerminated), idof()));\n encodeUnsafe(changetype(str), str.length, changetype(buf), nullTerminated, errorMode);\n return buf;\n }\n\n // @ts-ignore: decorator\n @unsafe\n export function encodeUnsafe(str: usize, len: i32, buf: usize, nullTerminated: bool = false, errorMode: ErrorMode = ErrorMode.WTF8): usize {\n var strEnd = str + (len << 1);\n var bufOff = buf;\n while (str < strEnd) {\n let c1 = load(str);\n if (c1 < 128) {\n store(bufOff, c1);\n bufOff++;\n } else if (c1 < 2048) {\n let b0 = c1 >> 6 | 192;\n let b1 = c1 & 63 | 128;\n store(bufOff, b1 << 8 | b0);\n bufOff += 2;\n } else {\n // D800: 11011 0 0000000000 Lead\n // DBFF: 11011 0 1111111111\n // DC00: 11011 1 0000000000 Trail\n // DFFF: 11011 1 1111111111\n // F800: 11111 0 0000000000 Mask\n // FC00: 11111 1 0000000000\n if ((c1 & 0xF800) == 0xD800) {\n if (c1 < 0xDC00 && str + 2 < strEnd) {\n let c2 = load(str, 2);\n if ((c2 & 0xFC00) == 0xDC00) {\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) | (c2 & 0x03FF);\n let b0 = c1 >> 18 | 240;\n let b1 = c1 >> 12 & 63 | 128;\n let b2 = c1 >> 6 & 63 | 128;\n let b3 = c1 & 63 | 128;\n store(bufOff, b3 << 24 | b2 << 16 | b1 << 8 | b0);\n bufOff += 4; str += 4;\n continue;\n }\n }\n if (errorMode != ErrorMode.WTF8) { // unlikely\n if (errorMode == ErrorMode.ERROR) throw new Error(E_UNPAIRED_SURROGATE);\n c1 = 0xFFFD;\n }\n }\n let b0 = c1 >> 12 | 224;\n let b1 = c1 >> 6 & 63 | 128;\n let b2 = c1 & 63 | 128;\n store(bufOff, b1 << 8 | b0);\n store(bufOff, b2, 2);\n bufOff += 3;\n }\n str += 2;\n }\n if (nullTerminated) {\n store(bufOff++, 0);\n }\n return bufOff - buf;\n }\n\n export function decode(buf: ArrayBuffer, nullTerminated: bool = false): String {\n return decodeUnsafe(changetype(buf), buf.byteLength, nullTerminated);\n }\n\n // @ts-ignore: decorator\n @unsafe\n export function decodeUnsafe(buf: usize, len: usize, nullTerminated: bool = false): String {\n var bufOff = buf;\n var bufEnd = buf + len;\n assert(bufEnd >= bufOff); // guard wraparound\n var str = changetype(__new(len << 1, idof())); // max is one u16 char per u8 byte\n var strOff = changetype(str);\n while (bufOff < bufEnd) {\n let u0 = load(bufOff); ++bufOff;\n if (!(u0 & 128)) {\n // @ts-ignore: cast\n if (nullTerminated & !u0) break;\n store(strOff, u0);\n } else {\n if (bufEnd == bufOff) break;\n let u1 = load(bufOff) & 63; ++bufOff;\n if ((u0 & 224) == 192) {\n store(strOff, (u0 & 31) << 6 | u1);\n } else {\n if (bufEnd == bufOff) break;\n let u2 = load(bufOff) & 63; ++bufOff;\n if ((u0 & 240) == 224) {\n u0 = (u0 & 15) << 12 | u1 << 6 | u2;\n } else {\n if (bufEnd == bufOff) break;\n u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | load(bufOff) & 63;\n ++bufOff;\n }\n if (u0 < 0x10000) {\n store(strOff, u0);\n } else {\n u0 -= 0x10000;\n let lo = u0 >> 10 | 0xD800;\n let hi = (u0 & 0x03FF) | 0xDC00;\n store(strOff, lo | (hi << 16));\n strOff += 2;\n }\n }\n }\n strOff += 2;\n }\n return changetype(__renew(changetype(str), strOff - changetype(str)));\n }\n }\n\n export namespace UTF16 {\n\n export function byteLength(str: string): i32 {\n return changetype(changetype(str) - TOTAL_OVERHEAD).rtSize;\n }\n\n export function encode(str: string): ArrayBuffer {\n var buf = changetype(__new(byteLength(str), idof()));\n encodeUnsafe(changetype(str), str.length, changetype(buf));\n return buf;\n }\n\n // @ts-ignore: decorator\n @unsafe\n export function encodeUnsafe(str: usize, len: i32, buf: usize): usize {\n var size = len << 1;\n memory.copy(buf, changetype(str), size);\n return size;\n }\n\n export function decode(buf: ArrayBuffer): String {\n return decodeUnsafe(changetype(buf), buf.byteLength);\n }\n\n // @ts-ignore: decorator\n @unsafe\n export function decodeUnsafe(buf: usize, len: usize): String {\n var str = changetype(__new(len &= ~1, idof()));\n memory.copy(changetype(str), buf, len);\n return str;\n }\n }\n}\n\nexport class TemplateStringsArray extends Array {\n readonly raw: string[];\n}\n","import { i128 } from './i128';\nimport { i256 } from './i256';\nimport { u256 } from './u256';\n\n// TODO import this on top level 'index.ts'\nimport {\n __clz128,\n __ctz128,\n __floatuntidf,\n\n __multi3,\n __res128_hi,\n\n __udivmod128,\n __udivmod128_10,\n\n __divmod_quot_hi,\n __divmod_rem_lo,\n __divmod_rem_hi,\n} from '../globals';\n\nimport { atou128, u128toa10 } from '../utils';\n\n@lazy const HEX_CHARS = '0123456789abcdef';\n\nexport class u128 {\n\n @inline static get Zero(): u128 { return new u128(); }\n @inline static get One(): u128 { return new u128(1); }\n @inline static get Min(): u128 { return new u128(); }\n @inline static get Max(): u128 { return new u128(-1, -1); }\n\n @inline\n static fromString(value: string, radix: i32 = 10): u128 {\n return atou128(value, radix);\n }\n\n @inline\n static fromI256(value: i256): u128 {\n return new u128(value.lo1, value.lo2);\n }\n\n @inline\n static fromU256(value: u256): u128 {\n return new u128(value.lo1, value.lo2);\n }\n\n @inline\n static fromI128(value: i128): u128 {\n return new u128(value.lo, value.hi);\n }\n\n @inline\n static fromU128(value: u128): u128 {\n return new u128(value.lo, value.hi);\n }\n\n @inline\n static fromI64(value: i64): u128 {\n return new u128(value, value >> 63);\n }\n\n @inline\n static fromU64(value: u64): u128 {\n return new u128(value);\n }\n\n // TODO need improvement\n // max safe uint for f64 actually 53-bits\n @inline\n static fromF64(value: f64): u128 {\n return new u128(value, reinterpret(value) >> 63);\n }\n\n // TODO need improvement\n // max safe int for f32 actually 23-bits\n @inline\n static fromF32(value: f32): u128 {\n return new u128(value, (reinterpret(value) >> 31));\n }\n\n @inline\n static fromI32(value: i32): u128 {\n return new u128(value, value >> 31);\n }\n\n @inline\n static fromU32(value: u32): u128 {\n return new u128(value);\n }\n\n @inline\n static fromBool(value: bool): u128 {\n return new u128(value);\n }\n\n @inline\n static fromBits(lo1: u32, lo2: u32, hi1: u32, hi2: u32): u128 {\n return new u128(\n lo1 | ((lo2) << 32),\n hi1 | ((hi2) << 32),\n );\n }\n\n @inline\n static fromBytes(array: T, bigEndian: bool = false): u128 {\n if (array instanceof u8[]) {\n return bigEndian\n ? u128.fromBytesBE(array)\n : u128.fromBytesLE(array);\n } else if (array instanceof Uint8Array) {\n return bigEndian\n ? u128.fromUint8ArrayBE(array)\n : u128.fromUint8ArrayLE(array);\n } else {\n throw new TypeError(\"Unsupported generic type\");\n }\n }\n\n @inline\n static fromBytesLE(array: u8[]): u128 {\n return u128.fromUint8ArrayLE(changetype(array));\n }\n\n @inline\n static fromBytesBE(array: u8[]): u128 {\n return u128.fromUint8ArrayBE(changetype(array));\n }\n\n @inline\n static fromUint8ArrayLE(array: Uint8Array): u128 {\n assert(array.length && (array.length & 15) == 0);\n // @ts-ignore\n var buffer = array.dataStart;\n return new u128(\n load(buffer, 0 * sizeof()),\n load(buffer, 1 * sizeof())\n );\n }\n\n @inline\n static fromUint8ArrayBE(array: Uint8Array): u128 {\n assert(array.length && (array.length & 15) == 0);\n // @ts-ignore\n var buffer = array.dataStart;\n return new u128(\n bswap(load(buffer, 1 * sizeof())),\n bswap(load(buffer, 0 * sizeof()))\n );\n }\n\n /**\n * Create 128-bit unsigned integer from generic type T\n * @param value\n * @returns 128-bit unsigned integer\n */\n @inline\n static from(value: T): u128 {\n if (value instanceof bool) return u128.fromU64(value);\n else if (value instanceof i8) return u128.fromI64(value);\n else if (value instanceof u8) return u128.fromU64(value);\n else if (value instanceof i16) return u128.fromI64(value);\n else if (value instanceof u16) return u128.fromU64(value);\n else if (value instanceof i32) return u128.fromI64(value);\n else if (value instanceof u32) return u128.fromU64(value);\n else if (value instanceof i64) return u128.fromI64(value);\n else if (value instanceof u64) return u128.fromU64(value);\n else if (value instanceof f32) return u128.fromF64(value);\n else if (value instanceof f64) return u128.fromF64(value);\n else if (value instanceof i128) return u128.fromI128(value);\n else if (value instanceof u128) return u128.fromU128(value);\n else if (value instanceof i256) return u128.fromI256(value);\n else if (value instanceof u256) return u128.fromU256(value);\n else if (value instanceof u8[]) return u128.fromBytes(value);\n else if (value instanceof Uint8Array) return u128.fromBytes(value);\n else if (value instanceof String) return u128.fromString(value);\n else throw new TypeError(\"Unsupported generic type\");\n }\n\n /**\n * Create 128-bit unsigned integer from 64-bit parts\n * @param lo low 64-bit part of 128-bit unsigned integer\n * @param hi high 64-bit part of 128-bit unsigned integer\n */\n constructor(\n public lo: u64 = 0,\n public hi: u64 = 0,\n ) {}\n\n @inline\n set(value: u128): this {\n this.lo = value.lo;\n this.hi = value.hi;\n return this;\n }\n\n @inline\n setI64(value: i64): this {\n this.lo = value;\n this.hi = value >> 63;\n return this;\n }\n\n @inline\n setU64(value: u64): this {\n this.lo = value;\n this.hi = 0;\n return this;\n }\n\n @inline\n setI32(value: i32): this {\n this.lo = value;\n this.hi = value >> 63;\n return this;\n }\n\n @inline\n setU32(value: u32): this {\n this.lo = value;\n this.hi = 0;\n return this;\n }\n\n @inline\n isZero(): bool {\n return !(this.lo | this.hi);\n }\n\n @inline @operator.prefix('~')\n not(): u128 {\n return new u128(~this.lo, ~this.hi);\n }\n\n @inline @operator.prefix('+')\n pos(): u128 {\n return this;\n }\n\n @inline @operator.prefix('-')\n neg(): u128 {\n var lo = ~this.lo;\n var hi = ~this.hi;\n var lo1 = lo + 1;\n return new u128(lo1, hi + u64(lo1 < lo));\n }\n\n @operator.prefix('++')\n preInc(): this {\n var lo = this.lo;\n var lo1 = lo + 1;\n this.hi += u64(lo1 < lo);\n this.lo = lo1;\n return this;\n }\n\n @operator.prefix('--')\n preDec(): this {\n var lo = this.lo;\n var lo1 = lo - 1;\n this.hi -= u64(lo1 > lo);\n this.lo = lo1;\n return this;\n }\n\n @operator.postfix('++')\n postInc(): u128 {\n return this.clone().preInc();\n }\n\n @operator.postfix('--')\n postDec(): u128 {\n return this.clone().preDec();\n }\n\n @inline @operator.prefix('!')\n static isEmpty(value: u128): bool {\n return value === null || !(value.lo | value.hi);\n }\n\n @inline @operator('|')\n static or(a: u128, b: u128): u128 {\n return new u128(a.lo | b.lo, a.hi | b.hi);\n }\n\n @inline @operator('^')\n static xor(a: u128, b: u128): u128 {\n return new u128(a.lo ^ b.lo, a.hi ^ b.hi);\n }\n\n @inline @operator('&')\n static and(a: u128, b: u128): u128 {\n return new u128(a.lo & b.lo, a.hi & b.hi);\n }\n\n @inline @operator('<<')\n static shl(value: u128, shift: i32): u128 {\n shift &= 127;\n\n // need for preventing redundant i32 -> u64 extends\n var shift64 = shift as u64;\n\n var mod1 = ((((shift64 + 127) | shift64) & 64) >> 6) - 1;\n var mod2 = (shift64 >> 6) - 1;\n\n shift64 &= 63;\n\n var vl = value.lo;\n var lo = vl << shift64;\n var hi = lo & ~mod2;\n\n hi |= ((value.hi << shift64) | ((vl >> (64 - shift64)) & mod1)) & mod2;\n\n return new u128(lo & mod2, hi);\n }\n\n @inline @operator('>>')\n static shr(value: u128, shift: i32): u128 {\n shift &= 127;\n\n // need for preventing redundant i32 -> u64 extends\n var shift64 = shift as u64;\n\n var mod1 = ((((shift64 + 127) | shift64) & 64) >> 6) - 1;\n var mod2 = (shift64 >> 6) - 1;\n\n shift64 &= 63;\n\n var vh = value.hi;\n var hi = vh >> shift64;\n var lo = hi & ~mod2;\n\n lo |= ((value.lo >> shift64) | ((vh << (64 - shift64)) & mod1)) & mod2;\n\n return new u128(lo, hi & mod2);\n }\n\n @inline @operator('>>>')\n static shr_u(value: u128, shift: i32): u128 {\n return u128.shr(value, shift);\n }\n\n @inline\n static rotl(value: u128, shift: i32): u128 {\n let n = shift & 127;\n if (n == 0) return value.clone();\n\n let lo = value.lo;\n let hi = value.hi;\n if (n == 64) {\n return new u128(hi, lo);\n }\n if (n & 64) {\n let t = lo; lo = hi; hi = t;\n }\n let slo = lo << n;\n let shi = hi << n;\n let rlo = lo >> (64 - n);\n let rhi = hi >> (64 - n);\n return new u128(slo | rhi, shi | rlo);\n }\n\n @inline\n static rotr(value: u128, shift: i32): u128 {\n let n = shift & 127;\n if (n == 0) return value.clone();\n\n let lo = value.lo;\n let hi = value.hi;\n if (n == 64) {\n return new u128(hi, lo);\n }\n if (n & 64) {\n let t = lo; lo = hi; hi = t;\n }\n let slo = lo >> n;\n let shi = hi >> n;\n let rlo = lo << (64 - n);\n let rhi = hi << (64 - n);\n return new u128(slo | rhi, shi | rlo);\n }\n\n @inline @operator('+')\n static add(a: u128, b: u128): u128 {\n var alo = a.lo;\n var lo = alo + b.lo;\n var hi = a.hi + b.hi + u64(lo < alo);\n return new u128(lo, hi);\n }\n\n @inline @operator('-')\n static sub(a: u128, b: u128): u128 {\n var alo = a.lo;\n var lo = alo - b.lo;\n var hi = a.hi - b.hi - u64(lo > alo);\n return new u128(lo, hi);\n }\n\n // mul: u128 x u128 = u128\n @inline @operator('*')\n static mul(a: u128, b: u128): u128 {\n return new u128(\n __multi3(a.lo, a.hi, b.lo, b.hi),\n __res128_hi\n );\n }\n\n @inline @operator('/')\n static div(a: u128, b: u128): u128 {\n return new u128(\n __udivmod128(a.lo, a.hi, b.lo, b.hi),\n __divmod_quot_hi\n );\n }\n\n @inline @operator('%')\n static rem(a: u128, b: u128): u128 {\n __udivmod128(a.lo, a.hi, b.lo, b.hi);\n return new u128(__divmod_rem_lo, __divmod_rem_hi);\n }\n\n @inline\n static div10(value: u128): u128 {\n return new u128(\n __udivmod128_10(value.lo, value.hi),\n __divmod_quot_hi\n );\n }\n\n @inline\n static rem10(value: u128): u128 {\n __udivmod128_10(value.lo, value.hi);\n return new u128(__divmod_rem_lo, __divmod_rem_hi);\n }\n\n /**\n * Calculate power of base with exponent\n * @param base 128-bit unsigned integer\n * @param exponent 32-bit signed integer\n * @returns 128-bit unsigned integer\n */\n @operator('**')\n static pow(base: u128, exponent: i32): u128 {\n // any negative exponent produce zero\n\n var result = u128.One;\n\n if (base == result) return result;\n var tmp = base.clone();\n if (exponent <= 1) {\n if (exponent < 0) return u128.Zero;\n return exponent == 0 ? result : tmp;\n }\n\n if (ASC_SHRINK_LEVEL < 1) {\n var lo = base.lo;\n var hi = base.hi;\n // if base > u64::max and exp > 1 always return \"0\"\n if (!lo) return u128.Zero;\n if (!hi) {\n let lo1 = lo - 1;\n // \"1 ^ exponent\" always return \"1\"\n if (!lo1) return result;\n\n // if base is power of two do \"1 << log2(base) * exp\"\n if (!(lo & lo1)) {\n let shift = (64 - clz(lo1)) * exponent;\n // @ts-ignore\n return shift < 128 ? result << shift : u128.Zero;\n }\n }\n\n if (exponent <= 4) {\n let baseSq = tmp.sqr();\n switch (exponent) {\n case 2: return baseSq; // base ^ 2\n // @ts-ignore\n case 3: return baseSq * base; // base ^ 2 * base\n case 4: return baseSq.sqr(); // base ^ 2 * base ^ 2\n default: break;\n }\n }\n\n let log = 32 - clz(exponent);\n if (log <= 7) {\n // 128 = 2 ^ 7, so need usually only seven cases\n switch (log) {\n case 7:\n // @ts-ignore\n if (exponent & 1) result *= tmp;\n exponent >>= 1;\n tmp.sqr();\n case 6:\n // @ts-ignore\n if (exponent & 1) result *= tmp;\n exponent >>= 1;\n tmp.sqr();\n case 5:\n // @ts-ignore\n if (exponent & 1) result *= tmp;\n exponent >>= 1;\n tmp.sqr();\n case 4:\n // @ts-ignore\n if (exponent & 1) result *= tmp;\n exponent >>= 1;\n tmp.sqr();\n case 3:\n // @ts-ignore\n if (exponent & 1) result *= tmp;\n exponent >>= 1;\n tmp.sqr();\n case 2:\n // @ts-ignore\n if (exponent & 1) result *= tmp;\n exponent >>= 1;\n tmp.sqr();\n case 1:\n // @ts-ignore\n if (exponent & 1) result *= tmp;\n }\n return result;\n }\n }\n\n while (exponent > 0) {\n // @ts-ignore\n if (exponent & 1) result *= tmp;\n exponent >>= 1;\n tmp.sqr();\n }\n return result;\n }\n\n // compute floor(sqrt(x))\n static sqrt(value: u128): u128 {\n var rem = value.clone();\n if (value < new u128(2)) {\n return rem;\n }\n var res = u128.Zero;\n // @ts-ignore\n var pos = u128.One << (127 - (u128.clz(value) | 1));\n // @ts-ignore\n while (!pos.isZero()) {\n // @ts-ignore\n value = res + pos;\n if (rem >= value) {\n // @ts-ignore\n rem = rem - value;\n // @ts-ignore\n res = pos + value;\n }\n // @ts-ignore\n res >>= 1;\n pos >>= 2;\n }\n return res;\n }\n\n @inline @operator('==')\n static eq(a: u128, b: u128): bool {\n return a.hi == b.hi && a.lo == b.lo;\n }\n\n @inline @operator('!=')\n static ne(a: u128, b: u128): bool {\n return !u128.eq(a, b);\n }\n\n @inline @operator('<')\n static lt(a: u128, b: u128): bool {\n var ah = a.hi, bh = b.hi;\n return ah == bh ? a.lo < b.lo : ah < bh;\n }\n\n @inline @operator('>')\n static gt(a: u128, b: u128): bool {\n var ah = a.hi, bh = b.hi;\n return ah == bh ? a.lo > b.lo : ah > bh;\n }\n\n @inline @operator('<=')\n static le(a: u128, b: u128): bool {\n return !u128.gt(a, b);\n }\n\n @inline @operator('>=')\n static ge(a: u128, b: u128): bool {\n return !u128.lt(a, b);\n }\n\n /**\n * Get ordering\n * if a > b then result is 1\n * if a < b then result is -1\n * if a = b then result is 0\n * @param a 128-bit unsigned integer\n * @param b 128-bit unsigned integer\n * @returns 32-bit signed integer\n */\n @inline\n static ord(a: u128, b: u128): i32 {\n var dlo = a.lo - b.lo;\n var dhi = a.hi - b.hi;\n var cmp = select(dhi, dlo, dhi != 0);\n // normalize to [-1, 0, 1]\n return i32(cmp > 0) - i32(cmp < 0);\n }\n\n /**\n * Compute count of set (populated) bits\n * @param value 128-bit unsigned integer\n * @returns 32-bit signed integer\n */\n @inline\n static popcnt(value: u128): i32 {\n return (popcnt(value.lo) + popcnt(value.hi));\n }\n\n /**\n * Compute bit count of leading zeros\n * @param value 128-bit unsigned integer\n * @returns 32-bit signed integer\n */\n @inline\n static clz(value: u128): i32 {\n return __clz128(value.lo, value.hi);\n }\n\n /**\n * Compute bit count of trailing zeros\n * @param value 128-bit unsigned integer\n * @returns 32-bit signed integer\n */\n @inline\n static ctz(value: u128): i32 {\n return __ctz128(value.lo, value.hi);\n }\n\n /**\n * Calculate squared value (value ** 2)\n * @param value 128-bit unsigned integer\n * @returns 128-bit unsigned integer\n */\n @inline\n static sqr(value: u128): u128 {\n return value.clone().sqr();\n }\n\n /**\n * Calculate inplace squared 128-bit unsigned integer (this ** 2)\n * @returns 128-bit unsigned integer\n */\n sqr(): this {\n var u = this.lo,\n v = this.hi;\n\n var u1 = u & 0xFFFFFFFF;\n var t = u1 * u1;\n var w = t & 0xFFFFFFFF;\n var k = t >> 32;\n\n u >>= 32;\n var m = u * u1;\n t = m + k;\n var w1 = t >> 32;\n\n t = m + (t & 0xFFFFFFFF);\n\n var lo = (t << 32) + w;\n var hi = u * u;\n hi += w1 + (t >> 32);\n hi += u * v << 1;\n\n this.lo = lo;\n this.hi = hi;\n\n return this;\n }\n\n /**\n * Calculate multiply and division as `number * numerator / denominator`\n * without overflow in multiplication part.\n *\n * @returns 128-bit unsigned integer\n */\n static muldiv(number: u128, numerator: u128, denominator: u128): u128 {\n let a = number;\n let b = numerator;\n let c = denominator;\n\n let ql = __udivmod128(b.lo, b.hi, c.lo, c.hi);\n\n let qn = new u128(ql, __divmod_quot_hi); // b / c\n let rn = new u128(__divmod_rem_lo, __divmod_rem_hi); // b % c\n\n let q = u128.Zero;\n let r = u128.Zero;\n let n = a.clone();\n\n while (!n.isZero()) {\n if (n.lo & 1) {\n // @ts-ignore\n q += qn;\n // @ts-ignore\n r += rn;\n if (r >= c) {\n // @ts-ignore\n ++q;\n // @ts-ignore\n r -= c;\n }\n }\n // @ts-ignore\n n >>= 1;\n // @ts-ignore\n qn <<= 1;\n // @ts-ignore\n rn <<= 1;\n\n if (rn >= c) {\n // @ts-ignore\n ++qn;\n // @ts-ignore\n rn -= c;\n }\n }\n return q;\n }\n\n /**\n * Convert to 256-bit signed integer\n * @returns 256-bit signed integer\n */\n @inline\n toI256(): i256 {\n return new i256(this.lo, this.hi);\n }\n\n /**\n * Convert to 256-bit unsigned integer\n * @returns 256-bit unsigned integer\n */\n @inline\n toU256(): u256 {\n return new u256(this.lo, this.hi);\n }\n\n /**\n * Convert to 128-bit signed integer\n * @returns 128-bit signed integer\n */\n @inline\n toI128(): i128 {\n return new i128(this.lo, this.hi);\n }\n\n /**\n * Convert to 128-bit unsigned integer\n * @returns 128-bit unsigned integer\n */\n @inline\n toU128(): this {\n return this;\n }\n\n /**\n * Convert to 64-bit signed integer\n * @returns 64-bit signed integer\n */\n @inline\n toI64(): i64 {\n return (\n (this.lo & 0x7FFFFFFFFFFFFFFF) |\n (this.hi & 0x8000000000000000)\n );\n }\n\n /**\n * Convert to 64-bit unsigned integer\n * @returns 64-bit unsigned integer\n */\n @inline\n toU64(): u64 {\n return this.lo;\n }\n\n /**\n * Convert to 32-bit signed integer\n * @returns 32-bit signed integer\n */\n @inline\n toI32(): i32 {\n return this.toI64();\n }\n\n /**\n * Convert to 32-bit unsigned integer\n * @returns 32-bit unsigned integer\n */\n @inline\n toU32(): u32 {\n return this.lo;\n }\n\n /**\n * Convert to 1-bit boolean\n * @returns 1-bit boolean\n */\n @inline\n toBool(): bool {\n return (this.lo | this.hi) != 0;\n }\n\n /**\n * Convert to 64-bit float number in deteministic way\n * @returns 64-bit float\n */\n @inline\n toF64(): f64 {\n return __floatuntidf(this.lo, this.hi);\n }\n\n /**\n * Convert to 32-bit float number\n * @returns 32-bit float\n */\n @inline\n toF32(): f32 {\n return this.toF64();\n }\n\n /**\n * Convert to generic type T. Useful inside other generics methods\n * @param T is \n * @returns type of T\n */\n @inline\n as(): T {\n var dummy: T;\n if (dummy instanceof bool) return this.toBool();\n else if (dummy instanceof i8) return this.toI64();\n else if (dummy instanceof u8) return this.toU64();\n else if (dummy instanceof i16) return this.toI64();\n else if (dummy instanceof u16) return this.toU64();\n else if (dummy instanceof i32) return this.toI64();\n else if (dummy instanceof i64) return this.toI64();\n else if (dummy instanceof u32) return this.toU64();\n else if (dummy instanceof u64) return this.toU64();\n else if (dummy instanceof f32) return this.toF64();\n else if (dummy instanceof f64) return this.toF64();\n else if (dummy instanceof i128) return this.toI128();\n else if (dummy instanceof u128) return this;\n else if (dummy instanceof u256) return this.toU256();\n else if (dummy instanceof u8[]) return this.toBytes();\n else if (dummy instanceof Uint8Array) return this.toUint8Array();\n else if (dummy instanceof StaticArray) return this.toStaticBytes();\n else if (dummy instanceof String) return this.toString();\n else throw new TypeError('Unsupported generic type');\n }\n\n @inline\n private toArrayBufferLE(buffer: usize): void {\n store(buffer, this.lo, 0 * sizeof());\n store(buffer, this.hi, 1 * sizeof());\n }\n\n @inline\n private toArrayBufferBE(buffer: usize): void {\n store(buffer, bswap(this.hi), 0 * sizeof());\n store(buffer, bswap(this.lo), 1 * sizeof());\n }\n\n @inline\n private toArrayBuffer(buffer: usize, bigEndian: bool = false): void {\n if (bigEndian) {\n this.toArrayBufferBE(buffer);\n } else {\n this.toArrayBufferLE(buffer);\n }\n }\n\n /**\n * Convert to byte array\n * @param bigEndian Little or Big Endian? Default: false\n * @returns Array of bytes\n */\n @inline\n toBytes(bigEndian: bool = false): u8[] {\n var result = new Array(16);\n this.toArrayBuffer(result.dataStart, bigEndian);\n return result;\n }\n\n /**\n * Convert to byte static array\n * @param bigEndian Little or Big Endian? Default: false\n * @returns StaticArray of bytes\n */\n @inline\n toStaticBytes(bigEndian: bool = false): StaticArray {\n var result = new StaticArray(16);\n this.toArrayBuffer(changetype(result), bigEndian);\n return result;\n }\n\n /**\n * Convert to Uint8Array\n * @param bigEndian Little or Big Endian? Default: false\n * @returns Uint8Array\n */\n @inline\n toUint8Array(bigEndian: bool = false): Uint8Array {\n var result = new Uint8Array(16);\n this.toArrayBuffer(result.dataStart, bigEndian);\n return result;\n }\n\n /**\n * Return copy of current 128-bit value\n * @returns 128-bit unsigned integer\n */\n clone(): u128 {\n return new u128(this.lo, this.hi);\n }\n\n toString(radix: i32 = 10): string {\n assert(radix == 10 || radix == 16, 'radix argument must be between 10 or 16');\n if (this.isZero()) return '0';\n\n var result = '';\n var it = this.clone();\n if (radix == 16) {\n let shift: i32 = 124 - (u128.clz(it) & ~3);\n while (shift >= 0) {\n // @ts-ignore\n it >>= shift;\n result = result.concat(HEX_CHARS.charAt((it.lo & 15)));\n shift -= 4;\n }\n return result;\n }\n return u128toa10(this);\n }\n}\n","/// \n\nimport { BLOCK_MAXSIZE } from \"./rt/common\";\nimport { COMPARATOR, SORT } from \"./util/sort\";\nimport { joinBooleanArray, joinIntegerArray, joinFloatArray, joinStringArray, joinReferenceArray } from \"./util/string\";\nimport { idof, isArray as builtin_isArray } from \"./builtins\";\nimport { E_INDEXOUTOFRANGE, E_INVALIDLENGTH, E_ILLEGALGENTYPE, E_EMPTYARRAY, E_HOLEYARRAY } from \"./util/error\";\n\n// @ts-ignore: decorator\n@inline @lazy const MIN_SIZE: usize = 8;\n\n/** Ensures that the given array has _at least_ the specified backing size. */\nfunction ensureCapacity(array: usize, newSize: usize, alignLog2: u32, canGrow: bool = true): void {\n // Depends on the fact that Arrays mimic ArrayBufferView\n var oldCapacity = changetype(array).byteLength;\n if (newSize > oldCapacity >>> alignLog2) {\n if (newSize > BLOCK_MAXSIZE >>> alignLog2) throw new RangeError(E_INVALIDLENGTH);\n let oldData = changetype(changetype(array).buffer);\n // Grows old capacity by factor of two.\n // Make sure we don't reach BLOCK_MAXSIZE for new growed capacity.\n let newCapacity = max(newSize, MIN_SIZE) << alignLog2;\n if (canGrow) newCapacity = max(min(oldCapacity << 1, BLOCK_MAXSIZE), newCapacity);\n let newData = __renew(oldData, newCapacity);\n memory.fill(newData + oldCapacity, 0, newCapacity - oldCapacity);\n if (newData !== oldData) { // oldData has been free'd\n store(array, newData, offsetof(\"buffer\"));\n store(array, newData, offsetof(\"dataStart\"));\n __link(array, changetype(newData), false);\n }\n store(array, newCapacity, offsetof(\"byteLength\"));\n }\n}\n\nexport class Array {\n [key: number]: T;\n\n // Mimicking ArrayBufferView isn't strictly necessary here but is done to allow glue code\n // to work with typed and normal arrays interchangeably. Technically, normal arrays do not need\n // `dataStart` (equals `buffer`) and `byteLength` (equals computed `buffer.byteLength`), but the\n // block is 16 bytes anyway so it's fine to have a couple extra fields in there.\n\n private buffer: ArrayBuffer;\n @unsafe readonly dataStart: usize;\n private byteLength: i32; // Uses here as capacity\n\n // Also note that Array with non-nullable T must guard against uninitialized null values\n // whenever an element is accessed. Otherwise, the compiler wouldn't be able to guarantee\n // type-safety anymore. For lack of a better word, such an array is \"holey\".\n\n private length_: i32;\n\n static isArray(value: U): bool {\n return isReference() ? builtin_isArray(value) && value !== null : false;\n }\n\n static create(capacity: i32 = 0): Array {\n WARNING(\"'Array.create' is deprecated. Use 'new Array' instead, making sure initial elements are initialized.\");\n var array = new Array(capacity);\n array.length = 0;\n return array;\n }\n\n constructor(length: i32 = 0) {\n if (length > BLOCK_MAXSIZE >>> alignof()) throw new RangeError(E_INVALIDLENGTH);\n // reserve capacity for at least MIN_SIZE elements\n var bufferSize = max(length, MIN_SIZE) << alignof();\n var buffer = changetype(__new(bufferSize, idof()));\n memory.fill(changetype(buffer), 0, bufferSize);\n this.buffer = buffer; // links\n this.dataStart = changetype(buffer);\n this.byteLength = bufferSize;\n this.length_ = length;\n }\n\n get length(): i32 {\n return this.length_;\n }\n\n set length(newLength: i32) {\n ensureCapacity(changetype(this), newLength, alignof(), false);\n this.length_ = newLength;\n }\n\n every(fn: (value: T, index: i32, array: Array) => bool): bool {\n for (let index = 0, length = this.length_; index < min(length, this.length_); ++index) {\n if (!fn(load(this.dataStart + (index << alignof())), index, this)) return false;\n }\n return true;\n }\n\n findIndex(predicate: (value: T, index: i32, array: Array) => bool): i32 {\n for (let index = 0, length = this.length_; index < min(length, this.length_); ++index) {\n if (predicate(load(this.dataStart + (index << alignof())), index, this)) return index;\n }\n return -1;\n }\n\n @operator(\"[]\") private __get(index: i32): T {\n if (index >= this.length_) throw new RangeError(E_INDEXOUTOFRANGE);\n var value = load(this.dataStart + (index << alignof()));\n if (isReference()) {\n if (!isNullable()) {\n if (!changetype(value)) throw new Error(E_HOLEYARRAY);\n }\n }\n return value;\n }\n\n @unsafe @operator(\"{}\") private __uget(index: i32): T {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\") private __set(index: i32, value: T): void {\n if (index >= this.length_) {\n if (index < 0) throw new RangeError(E_INDEXOUTOFRANGE);\n ensureCapacity(changetype(this), index + 1, alignof());\n this.length_ = index + 1;\n }\n this.__uset(index, value);\n }\n\n @unsafe @operator(\"{}=\") private __uset(index: i32, value: T): void {\n store(this.dataStart + (index << alignof()), value);\n if (isManaged()) {\n __link(changetype(this), changetype(value), true);\n }\n }\n\n at(index: i32): T {\n var len = this.length_;\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n var value = load(this.dataStart + (index << alignof()));\n if (isReference()) {\n if (!isNullable()) {\n if (!changetype(value)) throw new Error(E_HOLEYARRAY);\n }\n }\n return value;\n }\n\n fill(value: T, start: i32 = 0, end: i32 = i32.MAX_VALUE): this {\n var dataStart = this.dataStart;\n var length = this.length_;\n start = start < 0 ? max(length + start, 0) : min(start, length);\n end = end < 0 ? max(length + end, 0) : min(end, length);\n if (isManaged()) {\n for (; start < end; ++start) {\n store(dataStart + (start << alignof()), changetype(value));\n __link(changetype(this), changetype(value), true);\n }\n } else if (sizeof() == 1) {\n if (start < end) {\n memory.fill(\n dataStart + start,\n u8(value),\n (end - start)\n );\n }\n } else {\n for (; start < end; ++start) {\n store(dataStart + (start << alignof()), value);\n }\n }\n return this;\n }\n\n includes(value: T, fromIndex: i32 = 0): bool {\n if (isFloat()) {\n let length = this.length_;\n if (length == 0 || fromIndex >= length) return false;\n if (fromIndex < 0) fromIndex = max(length + fromIndex, 0);\n let dataStart = this.dataStart;\n while (fromIndex < length) {\n let elem = load(dataStart + (fromIndex << alignof()));\n // @ts-ignore\n if (elem == value || isNaN(elem) & isNaN(value)) return true;\n ++fromIndex;\n }\n return false;\n } else {\n return this.indexOf(value, fromIndex) >= 0;\n }\n }\n\n indexOf(value: T, fromIndex: i32 = 0): i32 {\n var length = this.length_;\n if (length == 0 || fromIndex >= length) return -1;\n if (fromIndex < 0) fromIndex = max(length + fromIndex, 0);\n var dataStart = this.dataStart;\n while (fromIndex < length) {\n if (load(dataStart + (fromIndex << alignof())) == value) return fromIndex;\n ++fromIndex;\n }\n return -1;\n }\n\n lastIndexOf(value: T, fromIndex: i32 = this.length_): i32 {\n var length = this.length_;\n if (length == 0) return -1;\n if (fromIndex < 0) fromIndex = length + fromIndex;\n else if (fromIndex >= length) fromIndex = length - 1;\n var dataStart = this.dataStart;\n while (fromIndex >= 0) {\n if (load(dataStart + (fromIndex << alignof())) == value) return fromIndex;\n --fromIndex;\n }\n return -1;\n }\n\n push(value: T): i32 {\n var length = this.length_;\n var newLength = length + 1;\n ensureCapacity(changetype(this), newLength, alignof());\n if (isManaged()) {\n store(this.dataStart + (length << alignof()), changetype(value));\n __link(changetype(this), changetype(value), true);\n } else {\n store(this.dataStart + (length << alignof()), value);\n }\n this.length_ = newLength;\n return newLength;\n }\n\n concat(other: Array): Array {\n var thisLen = this.length_;\n var otherLen = select(0, other.length_, other === null);\n var outLen = thisLen + otherLen;\n if (outLen > BLOCK_MAXSIZE >>> alignof()) throw new Error(E_INVALIDLENGTH);\n var out = changetype>(__newArray(outLen, alignof(), idof>()));\n var outStart = out.dataStart;\n var thisSize = thisLen << alignof();\n if (isManaged()) {\n let thisStart = this.dataStart;\n for (let offset: usize = 0; offset < thisSize; offset += sizeof()) {\n let ref = load(thisStart + offset);\n store(outStart + offset, ref);\n __link(changetype(out), ref, true);\n }\n outStart += thisSize;\n let otherStart = other.dataStart;\n let otherSize = otherLen << alignof();\n for (let offset: usize = 0; offset < otherSize; offset += sizeof()) {\n let ref = load(otherStart + offset);\n store(outStart + offset, ref);\n __link(changetype(out), ref, true);\n }\n } else {\n memory.copy(outStart, this.dataStart, thisSize);\n memory.copy(outStart + thisSize, other.dataStart, otherLen << alignof());\n }\n return out;\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): this {\n var dataStart = this.dataStart;\n var len = this.length_;\n\n end = min(end, len);\n\n var to = target < 0 ? max(len + target, 0) : min(target, len);\n var from = start < 0 ? max(len + start, 0) : min(start, len);\n var last = end < 0 ? max(len + end, 0) : min(end, len);\n var count = min(last - from, len - to);\n\n memory.copy( // is memmove\n dataStart + (to << alignof()),\n dataStart + (from << alignof()),\n count << alignof()\n );\n return this;\n }\n\n pop(): T {\n var length = this.length_;\n if (length < 1) throw new RangeError(E_EMPTYARRAY);\n var element = load(this.dataStart + ((--length) << alignof()));\n this.length_ = length;\n return element;\n }\n\n forEach(fn: (value: T, index: i32, array: Array) => void): void {\n for (let index = 0, length = this.length_; index < min(length, this.length_); ++index) {\n fn(load(this.dataStart + (index << alignof())), index, this);\n }\n }\n\n map(fn: (value: T, index: i32, array: Array) => U): Array {\n var length = this.length_;\n var out = changetype>(__newArray(length, alignof(), idof>()));\n var outStart = out.dataStart;\n for (let index = 0; index < min(length, this.length_); ++index) {\n let result = fn(load(this.dataStart + (index << alignof())), index, this);\n store(outStart + (index << alignof()), result);\n if (isManaged()) {\n __link(changetype(out), changetype(result), true);\n }\n }\n return out;\n }\n\n filter(fn: (value: T, index: i32, array: Array) => bool): Array {\n var result = changetype>(__newArray(0, alignof(), idof>()));\n for (let index = 0, length = this.length_; index < min(length, this.length_); ++index) {\n let value = load(this.dataStart + (index << alignof()));\n if (fn(value, index, this)) result.push(value);\n }\n return result;\n }\n\n reduce(\n fn: (previousValue: U, currentValue: T, currentIndex: i32, array: Array) => U,\n initialValue: U\n ): U {\n var accum = initialValue;\n for (let index = 0, length = this.length_; index < min(length, this.length_); ++index) {\n accum = fn(accum, load(this.dataStart + (index << alignof())), index, this);\n }\n return accum;\n }\n\n reduceRight(\n fn: (previousValue: U, currentValue: T, currentIndex: i32, array: Array) => U,\n initialValue: U\n ): U {\n var accum = initialValue;\n for (let index = this.length_ - 1; index >= 0; --index) {\n accum = fn(accum, load(this.dataStart + (index << alignof())), index, this);\n }\n return accum;\n }\n\n shift(): T {\n var length = this.length_;\n if (length < 1) throw new RangeError(E_EMPTYARRAY);\n var base = this.dataStart;\n var element = load(base);\n var lastIndex = length - 1;\n memory.copy(\n base,\n base + sizeof(),\n lastIndex << alignof()\n );\n if (isReference()) {\n store(base + (lastIndex << alignof()), 0);\n } else {\n // @ts-ignore\n store(base + (lastIndex << alignof()), 0);\n }\n this.length_ = lastIndex;\n return element;\n }\n\n some(fn: (value: T, index: i32, array: Array) => bool): bool {\n for (let index = 0, length = this.length_; index < min(length, this.length_); ++index) {\n if (fn(load(this.dataStart + (index << alignof())), index, this)) return true;\n }\n return false;\n }\n\n unshift(value: T): i32 {\n var newLength = this.length_ + 1;\n ensureCapacity(changetype(this), newLength, alignof());\n var dataStart = this.dataStart;\n memory.copy(\n dataStart + sizeof(),\n dataStart,\n (newLength - 1) << alignof()\n );\n store(dataStart, value);\n if (isManaged()) {\n __link(changetype(this), changetype(value), true);\n }\n this.length_ = newLength;\n return newLength;\n }\n\n slice(start: i32 = 0, end: i32 = i32.MAX_VALUE): Array {\n var length = this.length_;\n start = start < 0 ? max(start + length, 0) : min(start, length);\n end = end < 0 ? max(end + length, 0) : min(end , length);\n length = max(end - start, 0);\n var slice = changetype>(__newArray(length, alignof(), idof>()));\n var sliceBase = slice.dataStart;\n var thisBase = this.dataStart + (start << alignof());\n if (isManaged()) {\n let off = 0;\n let end = length << alignof();\n while (off < end) {\n let ref = load(thisBase + off);\n store(sliceBase + off, ref);\n __link(changetype(slice), ref, true);\n off += sizeof();\n }\n } else {\n memory.copy(sliceBase, thisBase, length << alignof());\n }\n return slice;\n }\n\n splice(start: i32, deleteCount: i32 = i32.MAX_VALUE): Array {\n var length = this.length_;\n start = start < 0 ? max(length + start, 0) : min(start, length);\n deleteCount = max(min(deleteCount, length - start), 0);\n var result = changetype>(__newArray(deleteCount, alignof(), idof>()));\n var resultStart = result.dataStart;\n var thisStart = this.dataStart;\n var thisBase = thisStart + (start << alignof());\n memory.copy(\n resultStart,\n thisBase,\n deleteCount << alignof()\n );\n var offset = start + deleteCount;\n if (length != offset) {\n memory.copy(\n thisBase,\n thisStart + (offset << alignof()),\n (length - offset) << alignof()\n );\n }\n this.length_ = length - deleteCount;\n return result;\n }\n\n reverse(): Array {\n var length = this.length_;\n if (length) {\n let front = this.dataStart;\n let back = this.dataStart + ((length - 1) << alignof());\n while (front < back) {\n let temp = load(front);\n store(front, load(back));\n store(back, temp);\n front += sizeof();\n back -= sizeof();\n }\n }\n return this;\n }\n\n sort(comparator: (a: T, b: T) => i32 = COMPARATOR()): this {\n var length = this.length_;\n if (length <= 1) return this;\n var base = this.dataStart;\n if (length == 2) {\n let a: T = load(base, sizeof()); // a = arr[1]\n let b: T = load(base); // b = arr[0]\n if (comparator(a, b) < 0) {\n store(base, b, sizeof()); // arr[1] = b;\n store(base, a); // arr[0] = a;\n }\n return this;\n }\n SORT(base, length, comparator);\n return this;\n }\n\n join(separator: string = \",\"): string {\n var dataStart = this.dataStart;\n var length = this.length_;\n if (isBoolean()) return joinBooleanArray(dataStart, length, separator);\n if (isInteger()) return joinIntegerArray(dataStart, length, separator);\n if (isFloat()) return joinFloatArray(dataStart, length, separator);\n\n if (ASC_SHRINK_LEVEL < 1) {\n if (isString()) return joinStringArray(dataStart, length, separator);\n }\n // For rest objects and arrays use general join routine\n if (isReference()) return joinReferenceArray(dataStart, length, separator);\n ERROR(\"unspported element type\");\n return unreachable();\n }\n\n flat(): T {\n if (!isArray()) {\n throw new TypeError(E_ILLEGALGENTYPE);\n }\n // Get the length and data start values\n var length = this.length_;\n var selfDataStart = this.dataStart;\n\n // calculate the end size with an initial pass\n var size = 0;\n for (let i = 0; i < length; i++) {\n let child = load(selfDataStart + (i << alignof()));\n size += child == 0 ? 0 : load(child, offsetof(\"length_\"));\n }\n\n // calculate the byteLength of the resulting backing ArrayBuffer\n var byteLength = size << usize(alignof>());\n var outBuffer = changetype(__new(byteLength, idof()));\n\n // create the return value and initialize it\n var outArray = changetype(__new(offsetof(), idof()));\n store(changetype(outArray), size, offsetof(\"length_\"));\n\n // byteLength, dataStart, and buffer are all readonly\n store(changetype(outArray), byteLength, offsetof(\"byteLength\"));\n store(changetype(outArray), changetype(outBuffer), offsetof(\"dataStart\"));\n store(changetype(outArray), changetype(outBuffer), offsetof(\"buffer\"));\n __link(changetype(outArray), changetype(outBuffer), false);\n\n // set the elements\n var resultOffset: usize = 0;\n for (let i = 0; i < length; i++) { // for each child\n let child = load(selfDataStart + (i << alignof()));\n\n // ignore null arrays\n if (child == 0) continue;\n\n // copy the underlying buffer data to the result buffer\n let childDataLength = load(child, offsetof(\"byteLength\"));\n memory.copy(\n changetype(outBuffer) + resultOffset,\n load(child, offsetof(\"dataStart\")),\n childDataLength\n );\n\n // advance the result length\n resultOffset += childDataLength;\n }\n\n // if the `valueof` type is managed, we must link each reference\n if (isManaged>()) {\n for (let i = 0; i < size; i++) {\n let ref = load(changetype(outBuffer) + (i << usize(alignof>())));\n __link(changetype(outBuffer), ref, true);\n }\n }\n\n return outArray;\n }\n\n toString(): string {\n return this.join();\n }\n\n // RT integration\n\n @unsafe private __visit(cookie: u32): void {\n if (isManaged()) {\n let cur = this.dataStart;\n let end = cur + (this.length_ << alignof());\n while (cur < end) {\n let val = load(cur);\n if (val) __visit(val, cookie);\n cur += sizeof();\n }\n }\n __visit(changetype(this.buffer), cookie);\n }\n}\n","import { u128 } from './integer/u128';\n\n// used for returning quotient and reminder from __divmod128\n@lazy export var __divmod_quot_hi: u64 = 0;\n@lazy export var __divmod_rem_lo: u64 = 0;\n@lazy export var __divmod_rem_hi: u64 = 0;\n\n// used for returning low and high part of __mulq64, __multi3 etc\n@lazy export var __res128_hi: u64 = 0;\n\n/**\n * Convert 128-bit unsigned integer to 64-bit float\n * @param lo lower 64-bit part of unsigned 128-bit integer\n * @param hi higher 64-bit part of unsigned 128-bit integer\n * @return 64-bit float result\n */\n// @ts-ignore: decorator\n@global\nexport function __floatuntidf(lo: u64, hi: u64): f64 {\n // __floatuntidf ported from LLVM sources\n if (!(lo | hi)) return 0.0;\n\n var v = new u128(lo, hi);\n var sd = 128 - __clz128(lo, hi);\n var e = sd - 1;\n\n if (sd > 53) {\n if (sd != 55) {\n if (sd == 54) {\n v = u128.shl(v, 1);\n } else {\n v = u128.or(\n u128.shr(v, sd - 55),\n u128.fromBool(u128.and(v, u128.shr(u128.Max, 128 + 55 - sd)).toBool())\n );\n }\n }\n\n v.lo |= (v.lo & 4) >> 2;\n v.preInc();\n\n v = u128.shr(v, 2);\n\n if (v.lo & (1 << 53)) {\n v = u128.shr(v, 1);\n ++e;\n }\n\n } else {\n v = u128.shl(v, 53 - sd);\n }\n\n var w: u64 = u128.shr(v, 32).lo & 0x000FFFFF;\n var u: u64 = (((e + 1023) << 20) | w) << 32;\n return reinterpret(u | (v.lo & 0xFFFFFFFF));\n}\n\n// @ts-ignore: decorator\n@global\nexport function __umulh64(a: u64, b: u64): u64 {\n var u = a & 0xFFFFFFFF; a >>= 32;\n var v = b & 0xFFFFFFFF; b >>= 32;\n\n var uv = u * v;\n var uv = a * v + (uv >> 32);\n var w0 = u * b + (uv & 0xFFFFFFFF);\n return a * b + (uv >> 32) + (w0 >> 32);\n}\n\n// @ts-ignore: decorator\n@global\nexport function __umulq64(a: u64, b: u64): u64 {\n var u = a & 0xFFFFFFFF; a >>= 32;\n var v = b & 0xFFFFFFFF; b >>= 32;\n\n var uv = u * v;\n var w0 = uv & 0xFFFFFFFF;\n uv = a * v + (uv >> 32);\n var w1 = uv >> 32;\n uv = u * b + (uv & 0xFFFFFFFF);\n\n __res128_hi = a * b + w1 + (uv >> 32);\n return (uv << 32) | w0;\n}\n\n// @ts-ignore: decorator\n@global\nexport function __multi3(al: u64, ah: u64, bl: u64, bh: u64): u64 {\n var u = al, v = bl;\n var w: u64, k: u64;\n\n var u1 = u & 0xFFFFFFFF; u >>= 32;\n var v1 = v & 0xFFFFFFFF; v >>= 32;\n var t = u1 * v1;\n var w1 = t & 0xFFFFFFFF;\n\n t = u * v1 + (t >> 32);\n k = t & 0xFFFFFFFF;\n w = t >> 32;\n t = u1 * v + k;\n\n var lo = (t << 32) | w1;\n var hi = u * v + w;\n hi += ah * bl;\n hi += al * bh;\n hi += t >> 32;\n\n __res128_hi = hi;\n return lo;\n}\n\n// @ts-ignore: decorator\n@global\nexport function __floatuntfdi(value: f64): u64 {\n var u = reinterpret(value);\n\n // if (value < -1.7014118346046e38) { // -(2^127-1)\n if (value < reinterpret(0xC7F0000000000000)) { // -(2^128-1)\n // __float_u128_hi = -1; // for i128\n __res128_hi = 0;\n // overflow negative\n return 0;\n // } else if (value < -9.2233720368547e18) { // -2^63-1 // for i128\n } else if (value < reinterpret(0xC3F0000000000000)) { // // -(2^64-1)\n let lo: u64, hi: u64, m: u64;\n\n m = (u & 0x000FFFFFFFFFFFFF) | (1 << 52);\n u = (u & 0x7FFFFFFFFFFFFFFF) >> 52;\n\n u -= 1075;\n if (u > 64) {\n lo = 0;\n hi = m << (u - 64);\n } else {\n lo = m << u;\n hi = m >> (64 - u);\n }\n __res128_hi = ~hi;\n return ~lo;\n // } else if (value < 9.2233720368547e18) { // 2^63-1 // for i128\n } else if (value < reinterpret(0x43F0000000000000)) { // 2^64-1\n // __float_u128_hi = (value < 0) ? -1 : 0; // for int\n __res128_hi = 0;\n // fit in a u64\n return value;\n // } else if (value < 1.7014118346046e38) {\n } else if (value < reinterpret(0x47F0000000000000)) { // 2^128-1\n let lo: u64, hi: u64, m: u64;\n\n m = (u & 0x000FFFFFFFFFFFFF) | (1 << 52);\n u = (u & 0x7FFFFFFFFFFFFFFF) >> 52;\n u -= 1075;\n if (u > 64) {\n lo = 0;\n hi = m << (u - 64);\n } else {\n lo = m << u;\n hi = m >> (64 - u);\n }\n __res128_hi = hi;\n return lo;\n } else {\n // overflow positive\n __res128_hi = -1; // 0x7FFFFFFFFFFFFFFF for i128\n return -1;\n }\n}\n\n// @ts-ignore: decorator\n@global @inline\nexport function __clz128(lo: u64, hi: u64): i32 {\n var mask: u64 = (hi ^ (hi - 1)) >> 63;\n return clz((hi & ~mask) | (lo & mask)) + (mask & 64);\n}\n\n// @ts-ignore: decorator\n@global @inline\nexport function __ctz128(lo: u64, hi: u64): i32 {\n var mask: u64 = (lo ^ (lo - 1)) >> 63;\n return ctz((hi & mask) | (lo & ~mask)) + (mask & 64);\n}\n\n// @ts-ignore: decorator\n@global\nexport function __udivmod128(alo: u64, ahi: u64, blo: u64, bhi: u64): u64 {\n var bzn = __clz128(blo, bhi); // N\n\n // b == 0\n if (bzn == 128) {\n throw new RangeError(\"Division by zero\"); // division by zero\n }\n\n // var azn = __clz128(alo, ahi); // M\n var btz = __ctz128(blo, bhi); // N\n\n // a == 0\n if (!(alo | ahi)) {\n __divmod_quot_hi = 0;\n __divmod_rem_lo = 0;\n __divmod_rem_hi = 0;\n return 0;\n }\n\n // a / 1\n if (bzn == 127) {\n __divmod_quot_hi = ahi;\n __divmod_rem_lo = 0;\n __divmod_rem_hi = 0;\n return alo;\n }\n\n // a == b\n if (alo == blo && ahi == bhi) {\n __divmod_quot_hi = 0;\n __divmod_rem_lo = 0;\n __divmod_rem_hi = 0;\n return 1;\n }\n\n // if (btz + bzn == 127) {\n // // TODO\n // // __divmod_quot = a >> btz\n // // b++\n // // __divmod_rem = a & b\n // return;\n // }\n\n if (!(ahi | bhi)) {\n __divmod_quot_hi = 0;\n __divmod_rem_hi = 0;\n // if `b.lo` is power of two\n if (!(blo & (blo - 1))) {\n __divmod_rem_lo = 0;\n return alo >> btz;\n } else {\n let dlo = alo / blo;\n __divmod_rem_lo = alo - dlo * blo;\n return dlo;\n }\n }\n\n // if b.lo == 0 and `b.hi` is power of two\n // if (!blo && !(bhi & (bhi - 1))) {\n // __divmod_rem = 0;\n\n // // TODO\n\n // return 0;\n // }\n\n // var diff: i64 = ahi - bhi;\n // var cmp = (diff != 0 ? diff : alo - blo); // TODO optimize this\n\n // if (cmp <= 0) {\n // __divmod_quot_hi = 0;\n // __divmod_rem = 0;\n // return u64(cmp == 0);\n // }\n\n // if (bzn - azn <= 5) {\n // // TODO\n // // fast path\n // return __udivmod128core(alo, ahi, blo, bhi);\n // }\n return __udivmod128core(alo, ahi, blo, bhi);\n}\n\nfunction __udivmod128core(alo: u64, ahi: u64, blo: u64, bhi: u64): u64 {\n var a = new u128(alo, ahi);\n var b = new u128(blo, bhi);\n // get leading zeros for left alignment\n var alz = __clz128(alo, ahi);\n var blz = __clz128(blo, bhi);\n var off = blz - alz;\n var nb = b << off;\n var q = u128.Zero;\n var n = a.clone();\n\n // create a mask with the length of b\n var mask = u128.One;\n mask <<= 128 - blz;\n --mask;\n mask <<= off;\n\n var i = 0;\n while (n >= b) {\n ++i;\n q <<= 1;\n if ((n & mask) >= nb) {\n ++q;\n n -= nb;\n }\n\n mask |= mask >> 1;\n nb >>= 1;\n }\n q <<= (blz - alz - i + 1);\n\n __divmod_quot_hi = q.hi;\n __divmod_rem_lo = n.lo;\n __divmod_rem_hi = n.hi;\n return q.lo;\n}\n\n// @ts-ignore: decorator\n@global\nexport function __udivmod128_10(lo: u64, hi: u64): u64 {\n if (!hi) {\n __divmod_quot_hi = 0;\n if (lo < 10) {\n __divmod_rem_lo = 0;\n __divmod_rem_hi = 0;\n return 0;\n } else {\n let qlo = lo / 10;\n __divmod_rem_lo = lo - qlo * 10;\n __divmod_rem_hi = 0;\n return qlo;\n }\n }\n\n var q: u128, r: u128;\n var n = new u128(lo, hi);\n\n q = n >> 1;\n q += n >> 2;\n q += q >> 4;\n q += q >> 8;\n q += q >> 16;\n q += q >> 32;\n q += u128.fromU64(q.hi); // q >> 64\n q >>= 3;\n r = n - (((q << 2) + q) << 1);\n n = q + u128.fromBool(r.lo > 9);\n\n __divmod_quot_hi = n.hi;\n __divmod_rem_lo = r.lo;\n __divmod_rem_hi = r.hi;\n return n.lo;\n}\n","import { COMPARATOR, SORT as SORT_IMPL } from \"./util/sort\";\nimport { E_INDEXOUTOFRANGE, E_INVALIDLENGTH, E_NOTIMPLEMENTED } from \"./util/error\";\nimport { joinIntegerArray, joinFloatArray } from \"./util/string\";\nimport { idof } from \"./builtins\";\nimport { ArrayBufferView } from \"./arraybuffer\";\n\nexport class Int8Array extends ArrayBufferView {\n [key: number]: i8;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength;\n }\n\n @operator(\"[]\")\n private __get(index: i32): i8 {\n if (index >= this.byteLength) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + index);\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): i8 {\n return load(this.dataStart + index);\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: native): void {\n if (index >= this.byteLength) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + index, value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: native): void {\n store(this.dataStart + index, value);\n }\n\n at(index: i32): i8 {\n var len = this.byteLength;\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + index);\n }\n\n includes(searchElement: i8, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: i8, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: i8, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int8Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: i8, b: i8) => i32 = COMPARATOR()): Int8Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Int8Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Int8Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Int8Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: i8, index: i32, array: Int8Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: i8, index: i32, array: Int8Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: i8, index: i32, self: Int8Array) => i8): Int8Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: i8, index: i32, self: Int8Array) => bool): Int8Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: i8, index: i32, self: Int8Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: i8, index: i32, self: Int8Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: i8, index: i32, self: Int8Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: i8, index: i32, self: Int8Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n toString(): string {\n return this.join();\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Int8Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Uint8Array extends ArrayBufferView {\n [key: number]: u8;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength;\n }\n\n @operator(\"[]\")\n private __get(index: i32): u8 {\n if (index >= this.byteLength) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + index);\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): u8 {\n return load(this.dataStart + index);\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: native): void {\n if (index >= this.byteLength) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + index, value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: native): void {\n store(this.dataStart + index, value);\n }\n\n at(index: i32): u8 {\n var len = this.byteLength;\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + index);\n }\n\n includes(searchElement: u8, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: u8, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: u8, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: u8, b: u8) => i32 = COMPARATOR()): Uint8Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Uint8Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: u8, index: i32, array: Uint8Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: u8, index: i32, array: Uint8Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: u8, index: i32, self: Uint8Array) => u8): Uint8Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: u8, index: i32, self: Uint8Array) => bool): Uint8Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: u8, index: i32, self: Uint8Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: u8, index: i32, self: Uint8Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: u8, index: i32, self: Uint8Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: u8, index: i32, self: Uint8Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Uint8Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Uint8ClampedArray extends ArrayBufferView {\n [key: number]: u8;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength;\n }\n\n @operator(\"[]\")\n private __get(index: i32): u8 {\n if (index >= this.byteLength) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + index);\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): u8 {\n return load(this.dataStart + index);\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: native): void {\n if (index >= this.byteLength) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + index, ~(value >> 31) & (((255 - value) >> 31) | value));\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: native): void {\n store(this.dataStart + index, ~(value >> 31) & (((255 - value) >> 31) | value));\n }\n\n at(index: i32): u8 {\n var len = this.byteLength;\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + index);\n }\n\n includes(searchElement: u8, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: u8, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: u8, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8ClampedArray {\n return FILL(this, value, start, end);\n }\n\n sort(fn: (a: u8, b: u8) => i32 = COMPARATOR()): Uint8ClampedArray {\n return SORT(this, fn);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8ClampedArray {\n return SLICE(this, begin, end);\n }\n\n subarray(start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8ClampedArray {\n return SUBARRAY(this, start, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Uint8ClampedArray {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: u8, index: i32, array: Uint8ClampedArray) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: u8, index: i32, array: Uint8ClampedArray) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: u8, index: i32, self: Uint8ClampedArray) => u8): Uint8ClampedArray {\n return MAP(this, fn);\n }\n\n filter(fn: (value: u8, index: i32, self: Uint8ClampedArray) => bool): Uint8ClampedArray {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: u8, index: i32, self: Uint8ClampedArray) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: u8, index: i32, self: Uint8ClampedArray) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: u8, index: i32, self: Uint8ClampedArray) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: u8, index: i32, self: Uint8ClampedArray) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Uint8ClampedArray {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Int16Array extends ArrayBufferView {\n [key: number]: i16;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength >>> alignof();\n }\n\n @operator(\"[]\")\n private __get(index: i32): i16 {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): i16 {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: native): void {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + (index << alignof()), value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: native): void {\n store(this.dataStart + (index << alignof()), value);\n }\n\n at(index: i32): i16 {\n var len = this.byteLength >>> alignof();\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n includes(searchElement: i16, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: i16, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: i16, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int16Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: i16, b: i16) => i32 = COMPARATOR()): Int16Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Int16Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Int16Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Int16Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: i16, index: i32, array: Int16Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: i16, index: i32, array: Int16Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: i16, index: i32, self: Int16Array) => i16): Int16Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: i16, index: i32, self: Int16Array) => bool): Int16Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: i16, index: i32, self: Int16Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: i16, index: i32, self: Int16Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: i16, index: i32, self: Int16Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: i16, index: i32, self: Int16Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Int16Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Uint16Array extends ArrayBufferView {\n [key: number]: u16;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength >>> alignof();\n }\n\n @operator(\"[]\")\n private __get(index: i32): u16 {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): u16 {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: native): void {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + (index << alignof()), value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: native): void {\n store(this.dataStart + (index << alignof()), value);\n }\n\n at(index: i32): u16 {\n var len = this.byteLength >>> alignof();\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n includes(searchElement: u16, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: u16, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: u16, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint16Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: u16, b: u16) => i32 = COMPARATOR()): Uint16Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint16Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint16Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Uint16Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: u16, index: i32, array: Uint16Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: u16, index: i32, array: Uint16Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: u16, index: i32, self: Uint16Array) => u16): Uint16Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: u16, index: i32, self: Uint16Array) => bool): Uint16Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: u16, index: i32, self: Uint16Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: u16, index: i32, self: Uint16Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: u16, index: i32, self: Uint16Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: u16, index: i32, self: Uint16Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Uint16Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Int32Array extends ArrayBufferView {\n [key: number]: i32;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength >>> alignof();\n }\n\n @operator(\"[]\")\n private __get(index: i32): i32 {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): i32 {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: i32): void {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + (index << alignof()), value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: i32): void {\n store(this.dataStart + (index << alignof()), value);\n }\n\n at(index: i32): i32 {\n var len = this.byteLength >>> alignof();\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n includes(searchElement: i32, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: i32, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: i32, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int32Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: i32, b: i32) => i32 = COMPARATOR()): Int32Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Int32Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Int32Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Int32Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: i32, index: i32, array: Int32Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: i32, index: i32, array: Int32Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: i32, index: i32, self: Int32Array) => i32): Int32Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: i32, index: i32, self: Int32Array) => bool): Int32Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: i32, index: i32, self: Int32Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: i32, index: i32, self: Int32Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: i32, index: i32, self: Int32Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: i32, index: i32, self: Int32Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Int32Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Uint32Array extends ArrayBufferView {\n [key: number]: u32;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength >>> alignof();\n }\n\n @operator(\"[]\")\n private __get(index: i32): u32 {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): u32 {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: u32): void {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + (index << alignof()), value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: u32): void {\n store(this.dataStart + (index << alignof()), value);\n }\n\n at(index: i32): u32 {\n var len = this.byteLength >>> alignof();\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n includes(searchElement: u32, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: u32, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: u32, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint32Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: u32, b: u32) => i32 = COMPARATOR()): Uint32Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint32Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint32Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Uint32Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: u32, index: i32, array: Uint32Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: u32, index: i32, array: Uint32Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: u32, index: i32, self: Uint32Array) => u32): Uint32Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: u32, index: i32, self: Uint32Array) => bool): Uint32Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: u32, index: i32, self: Uint32Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: u32, index: i32, self: Uint32Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: u32, index: i32, self: Uint32Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: u32, index: i32, self: Uint32Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Uint32Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Int64Array extends ArrayBufferView {\n [key: number]: i64;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength >>> alignof();\n }\n\n @operator(\"[]\")\n private __get(index: i32): i64 {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): i64 {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: i64): void {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + (index << alignof()), value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: i64): void {\n store(this.dataStart + (index << alignof()), value);\n }\n\n at(index: i32): i64 {\n var len = this.byteLength >>> alignof();\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n includes(searchElement: i64, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: i64, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: i64, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: i64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int64Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: i64, b: i64) => i32 = COMPARATOR()): Int64Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Int64Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Int64Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Int64Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: i64, index: i32, array: Int64Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: i64, index: i32, array: Int64Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: i64, index: i32, self: Int64Array) => i64): Int64Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: i64, index: i32, self: Int64Array) => bool): Int64Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: i64, index: i32, self: Int64Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: i64, index: i32, self: Int64Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: i64, index: i32, self: Int64Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: i64, index: i32, self: Int64Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Int64Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Uint64Array extends ArrayBufferView {\n [key: number]: u64;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength >>> alignof();\n }\n\n @operator(\"[]\")\n private __get(index: i32): u64 {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): u64 {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: u64): void {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + (index << alignof()), value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: u64): void {\n store(this.dataStart + (index << alignof()), value);\n }\n\n at(index: i32): u64 {\n var len = this.byteLength >>> alignof();\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n includes(searchElement: u64, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: u64, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: u64, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: u64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint64Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: u64, b: u64) => i32 = COMPARATOR()): Uint64Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint64Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Uint64Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Uint64Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: u64, index: i32, array: Uint64Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: u64, index: i32, array: Uint64Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: u64, index: i32, self: Uint64Array) => u64): Uint64Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: u64, index: i32, self: Uint64Array) => bool): Uint64Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: u64, index: i32, self: Uint64Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: u64, index: i32, self: Uint64Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: u64, index: i32, self: Uint64Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: u64, index: i32, self: Uint64Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinIntegerArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Uint64Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Float32Array extends ArrayBufferView {\n [key: number]: f32;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength >>> alignof();\n }\n\n @operator(\"[]\")\n private __get(index: i32): f32 {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): f32 {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: f32): void {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + (index << alignof()), value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: f32): void {\n store(this.dataStart + (index << alignof()), value);\n }\n\n at(index: i32): f32 {\n var len = this.byteLength >>> alignof();\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n includes(searchElement: f32, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: f32, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: f32, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: f32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Float32Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: f32, b: f32) => i32 = COMPARATOR()): Float32Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Float32Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Float32Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Float32Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: f32, index: i32, array: Float32Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: f32, index: i32, array: Float32Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: f32, index: i32, self: Float32Array) => f32): Float32Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: f32, index: i32, self: Float32Array) => bool): Float32Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: f32, index: i32, self: Float32Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: f32, index: i32, self: Float32Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: f32, index: i32, self: Float32Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: f32, index: i32, self: Float32Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinFloatArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Float32Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\nexport class Float64Array extends ArrayBufferView {\n [key: number]: f64;\n\n // @ts-ignore: decorator\n @lazy\n static readonly BYTES_PER_ELEMENT: i32 = sizeof();\n\n constructor(length: i32) {\n super(length, alignof());\n }\n\n get length(): i32 {\n return this.byteLength >>> alignof();\n }\n\n @operator(\"[]\")\n private __get(index: i32): f64 {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n @unsafe @operator(\"{}\")\n private __uget(index: i32): f64 {\n return load(this.dataStart + (index << alignof()));\n }\n\n @operator(\"[]=\")\n private __set(index: i32, value: f64): void {\n if (index >= this.byteLength >>> alignof()) throw new RangeError(E_INDEXOUTOFRANGE);\n store(this.dataStart + (index << alignof()), value);\n }\n\n @unsafe @operator(\"{}=\")\n private __uset(index: i32, value: f64): void {\n store(this.dataStart + (index << alignof()), value);\n }\n\n at(index: i32): f64 {\n var len = this.byteLength >>> alignof();\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n return load(this.dataStart + (index << alignof()));\n }\n\n includes(searchElement: f64, fromIndex: i32 = 0): bool {\n return INCLUDES(this, searchElement, fromIndex);\n }\n\n indexOf(searchElement: f64, fromIndex: i32 = 0): i32 {\n return INDEX_OF(this, searchElement, fromIndex);\n }\n\n lastIndexOf(searchElement: f64, fromIndex: i32 = this.length): i32 {\n return LAST_INDEX_OF(this, searchElement, fromIndex);\n }\n\n fill(value: f64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Float64Array {\n return FILL(this, value, start, end);\n }\n\n sort(comparator: (a: f64, b: f64) => i32 = COMPARATOR()): Float64Array {\n return SORT(this, comparator);\n }\n\n slice(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Float64Array {\n return SLICE(this, begin, end);\n }\n\n subarray(begin: i32 = 0, end: i32 = i32.MAX_VALUE): Float64Array {\n return SUBARRAY(this, begin, end);\n }\n\n copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Float64Array {\n return COPY_WITHIN(this, target, start, end);\n }\n\n reduce(\n fn: (accumulator: T, value: f64, index: i32, array: Float64Array) => T,\n initialValue: T,\n ): T {\n return REDUCE(this, fn, initialValue);\n }\n\n reduceRight(\n fn: (accumulator: T, value: f64, index: i32, array: Float64Array) => T,\n initialValue: T,\n ): T {\n return REDUCE_RIGHT(this, fn, initialValue);\n }\n\n map(fn: (value: f64, index: i32, self: Float64Array) => f64): Float64Array {\n return MAP(this, fn);\n }\n\n filter(fn: (value: f64, index: i32, self: Float64Array) => bool): Float64Array {\n return FILTER(this, fn);\n }\n\n findIndex(fn: (value: f64, index: i32, self: Float64Array) => bool): i32 {\n return FIND_INDEX(this, fn);\n }\n\n some(fn: (value: f64, index: i32, self: Float64Array) => bool): bool {\n return SOME(this, fn);\n }\n\n every(fn: (value: f64, index: i32, self: Float64Array) => bool): bool {\n return EVERY(this, fn);\n }\n\n forEach(fn: (value: f64, index: i32, self: Float64Array) => void): void {\n FOREACH(this, fn);\n }\n\n reverse(): this {\n return REVERSE(this);\n }\n\n join(separator: string = \",\"): string {\n return joinFloatArray(this.dataStart, this.length, separator);\n }\n\n set(source: U, offset: i32 = 0): void {\n SET>(this, source, offset);\n }\n\n toString(): string {\n return this.join();\n }\n\n static wrap(buffer: ArrayBuffer, byteOffset: i32 = 0, length: i32 = -1): Float64Array {\n return WRAP(buffer, byteOffset, length);\n }\n}\n\n// @ts-ignore: decorator\n@inline\nfunction FILL(\n array: TArray,\n value: native,\n start: i32,\n end: i32\n): TArray {\n var dataStart = array.dataStart;\n var len = array.length;\n start = start < 0 ? max(len + start, 0) : min(start, len);\n end = end < 0 ? max(len + end, 0) : min(end, len);\n if (sizeof() == 1) {\n if (start < end) memory.fill(dataStart + start, value, (end - start));\n } else {\n for (; start < end; ++start) {\n store(dataStart + (start << alignof()), value);\n }\n }\n return array;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction SORT(\n array: TArray,\n comparator: (a: T, b: T) => i32\n): TArray {\n var len = array.length;\n if (len <= 1) return array;\n var base = array.dataStart;\n if (len == 2) {\n let a: T = load(base, sizeof()); // a = arr[1]\n let b: T = load(base); // b = arr[0]\n if (comparator(a, b) < 0) {\n store(base, b, sizeof()); // arr[1] = b\n store(base, a); // arr[0] = a\n }\n return array;\n }\n SORT_IMPL(base, len, comparator);\n return array;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction SLICE(\n array: TArray,\n start: i32,\n end: i32\n): TArray {\n var len = array.length;\n start = start < 0 ? max(start + len, 0) : min(start, len);\n end = end < 0 ? max(end + len, 0) : min(end , len);\n len = max(end - start, 0);\n var slice = instantiate(len);\n memory.copy(\n slice.dataStart,\n array.dataStart + (start << alignof()),\n len << alignof()\n );\n return slice;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction SUBARRAY(\n array: TArray,\n begin: i32,\n end: i32\n): TArray {\n var len = array.length;\n begin = begin < 0 ? max(len + begin, 0) : min(begin, len);\n end = end < 0 ? max(len + end, 0) : min(end, len);\n end = max(end, begin);\n\n var out = changetype(__new(offsetof(), idof()));\n var buf = changetype(array.buffer);\n store(changetype(out), buf, offsetof(\"buffer\"));\n __link(changetype(out), buf, false);\n store(changetype(out), array.dataStart + (begin << alignof()), offsetof(\"dataStart\"));\n store(changetype(out), (end - begin) << alignof(), offsetof(\"byteLength\"));\n return out;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction COPY_WITHIN(\n array: TArray,\n target: i32,\n start: i32,\n end: i32\n): TArray {\n var len = array.length;\n var dataStart = array.dataStart;\n\n end = min(end, len);\n var to = target < 0 ? max(len + target, 0) : min(target, len);\n var from = start < 0 ? max(len + start, 0) : min(start, len);\n var last = end < 0 ? max(len + end, 0) : min(end, len);\n var count = min(last - from, len - to);\n\n memory.copy(\n dataStart + (to << alignof()),\n dataStart + (from << alignof()),\n count << alignof()\n );\n return array;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction REDUCE(\n array: TArray,\n fn: (accumulator: TRet, value: T, index: i32, array: TArray) => TRet,\n initialValue: TRet\n): TRet {\n var dataStart = array.dataStart;\n for (let i = 0, k = array.length; i < k; i++) {\n initialValue = fn(initialValue, load(dataStart + (i << alignof())), i, array);\n }\n return initialValue;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction REDUCE_RIGHT(\n array: TArray,\n fn: (accumulator: TRet, value: T, index: i32, array: TArray) => TRet,\n initialValue: TRet\n): TRet {\n var dataStart = array.dataStart;\n for (let i = array.length - 1; i >= 0; i--) {\n initialValue = fn(initialValue, load(dataStart + (i << alignof())), i, array);\n }\n return initialValue;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction MAP(\n array: TArray,\n fn: (value: T, index: i32, self: TArray) => T,\n): TArray {\n var len = array.length;\n var dataStart = array.dataStart;\n\n var byteLength = len << alignof();\n var out = changetype(__new(offsetof(), idof()));\n var buf = changetype(__new(byteLength, idof()));\n for (let i = 0; i < len; i++) {\n store(\n changetype(buf) + (i << alignof()),\n fn(load(dataStart + (i << alignof())), i, array)\n );\n }\n store(changetype(out), changetype(buf), offsetof(\"buffer\"));\n __link(changetype(out), changetype(buf), false);\n store(changetype(out), changetype(buf), offsetof(\"dataStart\"));\n store(changetype(out), byteLength, offsetof(\"byteLength\"));\n return out;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction FILTER(\n array: TArray,\n fn: (value: T, index: i32, self: TArray) => bool,\n): TArray {\n var len = array.length;\n var out = changetype(__new(offsetof(), idof()));\n var buf = changetype(__new(len << alignof(), idof()));\n var dataStart = array.dataStart;\n var j: usize = 0;\n for (let i = 0; i < len; i++) {\n let value = load(dataStart + (i << alignof()));\n if (fn(value, i, array)) {\n store(\n changetype(buf) + (j++ << alignof()),\n value\n );\n }\n }\n // shrink output buffer\n var byteLength = j << alignof();\n var data = __renew(changetype(buf), byteLength);\n store(changetype(out), data, offsetof(\"buffer\"));\n __link(changetype(out), data, false);\n store(changetype(out), byteLength, offsetof(\"byteLength\"));\n store(changetype(out), data, offsetof(\"dataStart\"));\n return out;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction FIND_INDEX(\n array: TArray,\n fn: (value: T, index: i32, array: TArray) => bool,\n): i32 {\n var dataStart = array.dataStart;\n for (let i = 0, k = array.length; i < k; i++) {\n if (fn(load(dataStart + (i << alignof())), i, array)) return i;\n }\n return -1;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction INCLUDES(\n array: TArray,\n searchElement: T,\n fromIndex: i32,\n): bool {\n if (isFloat()) {\n let index: isize = fromIndex;\n let length: isize = array.length;\n if (length == 0 || index >= length) return false;\n if (index < 0) index = max(length + index, 0);\n let dataStart = array.dataStart;\n while (index < length) {\n let elem = load(dataStart + (index << alignof()));\n // @ts-ignore\n if (elem == searchElement || isNaN(elem) & isNaN(searchElement)) return true;\n ++index;\n }\n return false;\n } else {\n return INDEX_OF(array, searchElement, fromIndex) >= 0;\n }\n}\n\n// @ts-ignore: decorator\n@inline\nfunction INDEX_OF(\n array: TArray,\n searchElement: T,\n fromIndex: i32,\n): i32 {\n var index: isize = fromIndex;\n var length: isize = array.length;\n if (length == 0 || index >= length) return -1;\n if (index < 0) index = max(length + index, 0);\n var dataStart = array.dataStart;\n while (index < length) {\n if (load(dataStart + (index << alignof())) == searchElement) return index;\n ++index;\n }\n return -1;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction LAST_INDEX_OF(\n array: TArray,\n searchElement: T,\n fromIndex: i32,\n): i32 {\n var index: isize = fromIndex;\n var length: isize = array.length;\n if (length == 0) return -1;\n if (index < 0) index = length + index; // no need to clamp\n else if (index >= length) index = length - 1;\n var dataStart = array.dataStart;\n while (index >= 0) {\n if (load(dataStart + (index << alignof())) == searchElement) return index;\n --index;\n }\n return -1;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction SOME(\n array: TArray,\n fn: (value: T, index: i32, array: TArray) => bool,\n): bool {\n var dataStart = array.dataStart;\n for (let i = 0, k = array.length; i < k; i++) {\n if (fn(load(dataStart + (i << alignof())), i, array)) return true;\n }\n return false;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction EVERY(\n array: TArray,\n fn: (value: T, index: i32, array: TArray) => bool,\n): bool {\n var dataStart = array.dataStart;\n for (let i = 0, k = array.length; i < k; i++) {\n if (fn(load(dataStart + (i << alignof())), i, array)) continue;\n return false;\n }\n return true;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction FOREACH(\n array: TArray,\n fn: (value: T, index: i32, array: TArray) => void,\n): void {\n var dataStart = array.dataStart;\n for (let i = 0, k = array.length; i < k; i++) {\n fn(load(dataStart + (i << alignof())), i, array);\n }\n}\n\n// @ts-ignore: decorator\n@inline\nfunction REVERSE(array: TArray): TArray {\n var dataStart = array.dataStart;\n for (let front: usize = 0, back: usize = array.length - 1; front < back; ++front, --back) {\n let frontPtr = dataStart + (front << alignof());\n let backPtr = dataStart + (back << alignof());\n let temp = load(frontPtr);\n store(frontPtr, load(backPtr));\n store(backPtr, temp);\n }\n return array;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction WRAP(\n buffer: ArrayBuffer,\n byteOffset: i32 = 0,\n length: i32 = -1\n): TArray {\n var byteLength: i32;\n var bufferByteLength = buffer.byteLength;\n const mask: u32 = sizeof() - 1;\n if (i32(byteOffset > bufferByteLength) | (byteOffset & mask)) {\n throw new RangeError(E_INDEXOUTOFRANGE);\n }\n if (length < 0) {\n if (length == -1) {\n if (bufferByteLength & mask) {\n throw new RangeError(E_INVALIDLENGTH);\n }\n byteLength = bufferByteLength - byteOffset;\n } else {\n throw new RangeError(E_INVALIDLENGTH);\n }\n } else {\n byteLength = length << alignof();\n if (byteOffset + byteLength > bufferByteLength) {\n throw new RangeError(E_INVALIDLENGTH);\n }\n }\n var out = changetype(__new(offsetof(), idof()));\n store(changetype(out), changetype(buffer), offsetof(\"buffer\"));\n __link(changetype(out), changetype(buffer), false);\n store(changetype(out), byteLength, offsetof(\"byteLength\"));\n store(changetype(out), changetype(buffer) + byteOffset, offsetof(\"dataStart\"));\n return out;\n}\n\n// @ts-ignore: decorator\n@inline\nfunction SET(\n target: TArray,\n source: UArray,\n offset: i32 = 0\n): void {\n // need to assert at compile time that U is not a reference or a function\n if (isReference()) {\n ERROR(E_NOTIMPLEMENTED);\n }\n\n // Uncaught RangeError: offset is out of bounds\n if (offset < 0) throw new RangeError(E_INDEXOUTOFRANGE);\n if (source.length + offset > target.length) throw new RangeError(E_INDEXOUTOFRANGE);\n\n // if the types align and match, use memory.copy() instead of manual loop\n if (isInteger() == isInteger() && alignof() == alignof() &&\n !(target instanceof Uint8ClampedArray && isSigned())) {\n memory.copy(\n target.dataStart + (offset << alignof()),\n source.dataStart,\n source.byteLength\n );\n } else {\n let targetDataStart = target.dataStart + (offset << alignof());\n let sourceDataStart = source.dataStart;\n let count = source.length;\n for (let i = 0; i < count; i++) {\n // if TArray is Uint8ClampedArray, then values must be clamped\n if (target instanceof Uint8ClampedArray) {\n if (isFloat()) {\n let value = load(sourceDataStart + (i << alignof()));\n store(\n targetDataStart + (i << alignof()),\n isFinite(value) ? max(0, min(255, value)) : 0\n );\n } else {\n let value = load(sourceDataStart + (i << alignof()));\n if (!isSigned()) {\n store(\n targetDataStart + (i << alignof()),\n // @ts-ignore: cast to T is valid for numeric types here\n min(255, value)\n );\n } else if (sizeof() <= 4) {\n store(\n targetDataStart + (i << alignof()),\n // @ts-ignore: cast to T is valid for numeric types here\n ~(value >> 31) & (((255 - value) >> 31) | value)\n );\n } else {\n store(\n targetDataStart + (i << alignof()),\n // @ts-ignore: cast to T is valid for numeric types here\n ~(value >> 63) & (((255 - value) >> 63) | value)\n );\n }\n }\n // if U is a float, then casting float to int must include a finite check\n } else if (isFloat() && !isFloat()) {\n let value = load(sourceDataStart + (i << alignof()));\n // @ts-ignore: cast to T is valid for numeric types here\n store(targetDataStart + (i << alignof()), isFinite(value) ? value : 0);\n } else if (isFloat() && !isFloat()) {\n // @ts-ignore: In this case the conversion is required\n store(targetDataStart + (i << alignof()), load(sourceDataStart + (i << alignof())));\n } else {\n store(targetDataStart + (i << alignof()), load(sourceDataStart + (i << alignof())));\n }\n }\n }\n}\n","export function bswap(value: T): T {\n if (isInteger()) {\n if (sizeof() == 2) {\n return ((value << 8) | ((value >>> 8) & 0x00FF));\n }\n if (sizeof() == 4) {\n return (\n rotl(value & 0xFF00FF00, 8) |\n rotr(value & 0x00FF00FF, 8)\n );\n }\n if (sizeof() == 8) {\n let a = (value >> 8) & 0x00FF00FF00FF00FF;\n let b = (value & 0x00FF00FF00FF00FF) << 8;\n let v = a | b;\n\n a = (v >> 16) & 0x0000FFFF0000FFFF;\n b = (v & 0x0000FFFF0000FFFF) << 16;\n\n return rotr(a | b, 32);\n }\n return value;\n }\n assert(false);\n return value;\n}\n\nexport function bswap16(value: T): T {\n if (isInteger() && sizeof() <= 4) {\n if (sizeof() == 2) {\n return ((value << 8) | ((value >>> 8) & 0x00FF));\n } else if (sizeof() == 4) {\n return (((value << 8) & 0xFF00) | ((value >>> 8) & 0x00FF) | (value & 0xFFFF0000));\n }\n return value;\n }\n assert(false);\n return value;\n}\n","import { memcmp, memmove, memset } from \"./util/memory\";\nimport { E_NOTIMPLEMENTED } from \"./util/error\";\n\n/** Memory manager interface. */\nexport namespace memory {\n\n /** Gets the size of the memory in pages. */\n // @ts-ignore: decorator\n @builtin\n export declare function size(): i32;\n\n /** Grows the memory by the given size in pages and returns the previous size in pages. */\n // @ts-ignore: decorator\n @unsafe @builtin\n export declare function grow(pages: i32): i32;\n\n /** Fills a section in memory with the specified byte value. */\n // @ts-ignore: decorator\n @unsafe @builtin\n export function fill(dst: usize, c: u8, n: usize): void {\n memset(dst, c, n); // fallback if \"bulk-memory\" isn't enabled\n }\n\n /** Copies a section of memory to another. Has move semantics. */\n // @ts-ignore: decorator\n @unsafe @builtin\n export function copy(dst: usize, src: usize, n: usize): void {\n memmove(dst, src, n); // fallback if \"bulk-memory\" isn't enabled\n }\n\n /** Initializes a memory segment. */\n // @ts-ignore: decorator\n @unsafe\n export function init(segmentIndex: u32, srcOffset: usize, dstOffset: usize, n: usize): void {\n throw new Error(E_NOTIMPLEMENTED);\n }\n\n /** Drops a memory segment. */\n // @ts-ignore: decorator\n @unsafe\n export function drop(segmentIndex: u32): void {\n throw new Error(E_NOTIMPLEMENTED);\n }\n\n /** Repeats a section of memory at a specific address. */\n // @ts-ignore: decorator\n @unsafe\n export function repeat(dst: usize, src: usize, srcLength: usize, count: usize): void {\n var index: usize = 0;\n var total = srcLength * count;\n while (index < total) {\n memory.copy(dst + index, src, srcLength);\n index += srcLength;\n }\n }\n\n /** Compares a section of memory to another. */\n // @ts-ignore: decorator\n @inline\n export function compare(vl: usize, vr: usize, n: usize): i32 {\n return memcmp(vl, vr, n);\n }\n\n /** Gets a pointer to a static chunk of memory of the given size. */\n // @ts-ignore: decorator\n @builtin\n export declare function data(size: T, align?: i32): usize;\n}\n\n// @ts-ignore: decorator\n@builtin\nexport declare const __data_end: usize;\n\n// @ts-ignore: decorator\n@builtin\nexport declare var __stack_pointer: usize;\n\n// @ts-ignore: decorator\n@builtin\nexport declare const __heap_base: usize;\n\n/** Heap memory interface. */\nexport namespace heap {\n\n /** Allocates a chunk of memory of at least the specified size. */\n // @ts-ignore: decorator\n @unsafe export function alloc(size: usize): usize {\n return __alloc(size);\n }\n\n /** Reallocates a chunk of memory to have at least the specified size. */\n // @ts-ignore: decorator\n @unsafe export function realloc(ptr: usize, size: usize): usize {\n return __realloc(ptr, size);\n }\n\n /** Frees a chunk of memory. Does hardly anything (most recent block only) with the stub runtime. */\n // @ts-ignore: decorator\n @unsafe export function free(ptr: usize): void {\n __free(ptr);\n }\n\n /** Dangerously resets the entire heap. Specific to the stub runtime. */\n // @ts-ignore: decorator\n @unsafe export function reset(): void {\n if (isDefined(__reset)) {\n __reset();\n } else {\n throw new Error(E_NOTIMPLEMENTED);\n }\n }\n}\n","export function memcpy(dest: usize, src: usize, n: usize): void { // see: musl/src/string/memcpy.c\n var w: u32, x: u32;\n\n // copy 1 byte each until src is aligned to 4 bytes\n while (n && (src & 3)) {\n store(dest++, load(src++));\n n--;\n }\n\n // if dst is aligned to 4 bytes as well, copy 4 bytes each\n if ((dest & 3) == 0) {\n while (n >= 16) {\n store(dest , load(src ));\n store(dest + 4, load(src + 4));\n store(dest + 8, load(src + 8));\n store(dest + 12, load(src + 12));\n src += 16; dest += 16; n -= 16;\n }\n if (n & 8) {\n store(dest , load(src ));\n store(dest + 4, load(src + 4));\n dest += 8; src += 8;\n }\n if (n & 4) {\n store(dest, load(src));\n dest += 4; src += 4;\n }\n if (n & 2) { // drop to 2 bytes each\n store(dest, load(src));\n dest += 2; src += 2;\n }\n if (n & 1) { // drop to 1 byte\n store(dest++, load(src++));\n }\n return;\n }\n\n // if dst is not aligned to 4 bytes, use alternating shifts to copy 4 bytes each\n // doing shifts if faster when copying enough bytes (here: 32 or more)\n if (n >= 32) {\n switch (dest & 3) {\n // known to be != 0\n case 1: {\n w = load(src);\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n n -= 3;\n while (n >= 17) {\n x = load(src + 1);\n store(dest, w >> 24 | x << 8);\n w = load(src + 5);\n store(dest + 4, x >> 24 | w << 8);\n x = load(src + 9);\n store(dest + 8, w >> 24 | x << 8);\n w = load(src + 13);\n store(dest + 12, x >> 24 | w << 8);\n src += 16; dest += 16; n -= 16;\n }\n break;\n }\n case 2: {\n w = load(src);\n store(dest++, load(src++));\n store(dest++, load(src++));\n n -= 2;\n while (n >= 18) {\n x = load(src + 2);\n store(dest, w >> 16 | x << 16);\n w = load(src + 6);\n store(dest + 4, x >> 16 | w << 16);\n x = load(src + 10);\n store(dest + 8, w >> 16 | x << 16);\n w = load(src + 14);\n store(dest + 12, x >> 16 | w << 16);\n src += 16; dest += 16; n -= 16;\n }\n break;\n }\n case 3: {\n w = load(src);\n store(dest++, load(src++));\n n -= 1;\n while (n >= 19) {\n x = load(src + 3);\n store(dest, w >> 8 | x << 24);\n w = load(src + 7);\n store(dest + 4, x >> 8 | w << 24);\n x = load(src + 11);\n store(dest + 8, w >> 8 | x << 24);\n w = load(src + 15);\n store(dest + 12, x >> 8 | w << 24);\n src += 16; dest += 16; n -= 16;\n }\n break;\n }\n }\n }\n\n // copy remaining bytes one by one\n if (n & 16) {\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n }\n if (n & 8) {\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n }\n if (n & 4) {\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n store(dest++, load(src++));\n }\n if (n & 2) {\n store(dest++, load(src++));\n store(dest++, load(src++));\n }\n if (n & 1) {\n store(dest++, load(src++));\n }\n}\n\n// @ts-ignore: decorator\n@inline\nexport function memmove(dest: usize, src: usize, n: usize): void { // see: musl/src/string/memmove.c\n if (dest === src) return;\n if (ASC_SHRINK_LEVEL < 1) {\n if (src - dest - n <= -(n << 1)) {\n memcpy(dest, src, n);\n return;\n }\n }\n if (dest < src) {\n if (ASC_SHRINK_LEVEL < 2) {\n if ((src & 7) == (dest & 7)) {\n while (dest & 7) {\n if (!n) return;\n --n;\n store(dest++, load(src++));\n }\n while (n >= 8) {\n store(dest, load(src));\n n -= 8;\n dest += 8;\n src += 8;\n }\n }\n }\n while (n) {\n store(dest++, load(src++));\n --n;\n }\n } else {\n if (ASC_SHRINK_LEVEL < 2) {\n if ((src & 7) == (dest & 7)) {\n while ((dest + n) & 7) {\n if (!n) return;\n store(dest + --n, load(src + n));\n }\n while (n >= 8) {\n n -= 8;\n store(dest + n, load(src + n));\n }\n }\n }\n while (n) {\n store(dest + --n, load(src + n));\n }\n }\n}\n\n// @ts-ignore: decorator\n@inline\nexport function memset(dest: usize, c: u8, n: usize): void { // see: musl/src/string/memset\n if (ASC_SHRINK_LEVEL > 1) {\n while (n) {\n store(dest++, c);\n --n;\n }\n } else {\n // fill head and tail with minimal branching\n if (!n) return;\n let dend = dest + n;\n store(dest, c);\n store(dend - 1, c);\n if (n <= 2) return;\n store(dest, c, 1);\n store(dest, c, 2);\n store(dend - 2, c);\n store(dend - 3, c);\n if (n <= 6) return;\n store(dest, c, 3);\n store(dend - 4, c);\n if (n <= 8) return;\n\n // advance pointer to align it at 4-byte boundary\n let k: usize = -dest & 3;\n dest += k;\n n -= k;\n n &= -4;\n\n let c32: u32 = -1 / 255 * c;\n\n // fill head/tail up to 28 bytes each in preparation\n dend = dest + n;\n store(dest, c32);\n store(dend - 4, c32);\n if (n <= 8) return;\n store(dest, c32, 4);\n store(dest, c32, 8);\n store(dend - 12, c32);\n store(dend - 8, c32);\n if (n <= 24) return;\n store(dest, c32, 12);\n store(dest, c32, 16);\n store(dest, c32, 20);\n store(dest, c32, 24);\n store(dend - 28, c32);\n store(dend - 24, c32);\n store(dend - 20, c32);\n store(dend - 16, c32);\n\n // align to a multiple of 8\n k = 24 + (dest & 4);\n dest += k;\n n -= k;\n\n // copy 32 bytes each\n let c64: u64 = c32 | (c32 << 32);\n while (n >= 32) {\n store(dest, c64);\n store(dest, c64, 8);\n store(dest, c64, 16);\n store(dest, c64, 24);\n n -= 32;\n dest += 32;\n }\n }\n}\n\n// @ts-ignore: decorator\n@inline\nexport function memcmp(vl: usize, vr: usize, n: usize): i32 {\n if (vl == vr) return 0;\n if (ASC_SHRINK_LEVEL < 2) {\n if ((vl & 7) == (vr & 7)) {\n while (vl & 7) {\n if (!n) return 0;\n let a = load(vl);\n let b = load(vr);\n if (a != b) return a - b;\n n--; vl++; vr++;\n }\n while (n >= 8) {\n if (load(vl) != load(vr)) break;\n vl += 8;\n vr += 8;\n n -= 8;\n }\n }\n }\n while (n--) {\n let a = load(vl);\n let b = load(vr);\n if (a != b) return a - b;\n vl++; vr++;\n }\n return 0;\n}\n","/// \n\nimport { OBJECT, BLOCK_MAXSIZE, TOTAL_OVERHEAD } from \"./rt/common\";\nimport { idof } from \"./builtins\";\nimport { Array } from \"./array\";\nimport { E_INDEXOUTOFRANGE, E_INVALIDLENGTH, E_HOLEYARRAY } from \"./util/error\";\nimport { joinBooleanArray, joinIntegerArray, joinFloatArray, joinStringArray, joinReferenceArray } from \"./util/string\";\n\n@final\nexport class StaticArray {\n [key: number]: T;\n\n // Note that the interface of StaticArray instances must be a semantically\n // compatible subset of Array in order for syntax highlighting to work\n // properly, for instance when creating static arrays from array literals.\n // The additionally provided static methods take care of dealing with static\n // arrays exclusively, without having to convert to Array first.\n\n static fromArray(source: Array): StaticArray {\n var length = source.length;\n var outSize = length << alignof();\n var out = changetype>(__new(outSize, idof>()));\n if (isManaged()) {\n let sourcePtr = source.dataStart;\n for (let i = 0; i < length; ++i) {\n let off = i << alignof();\n let ref = load(sourcePtr + off);\n store(changetype(out) + off, ref);\n __link(changetype(out), ref, true);\n }\n } else {\n memory.copy(changetype(out), source.dataStart, outSize);\n }\n return out;\n }\n\n static concat(source: StaticArray, other: StaticArray): StaticArray {\n var sourceLen = source.length;\n var otherLen = select(0, other.length, other === null);\n var outLen = sourceLen + otherLen;\n if (outLen > BLOCK_MAXSIZE >>> alignof()) throw new Error(E_INVALIDLENGTH);\n var out = changetype>(__new(outLen << alignof(), idof>()));\n var outStart = changetype(out);\n var sourceSize = sourceLen << alignof();\n if (isManaged()) {\n for (let offset: usize = 0; offset < sourceSize; offset += sizeof()) {\n let ref = load(changetype(source) + offset);\n store(outStart + offset, ref);\n __link(changetype(out), ref, true);\n }\n outStart += sourceSize;\n let otherSize = otherLen << alignof();\n for (let offset: usize = 0; offset < otherSize; offset += sizeof()) {\n let ref = load(changetype(other) + offset);\n store(outStart + offset, ref);\n __link(changetype(out), ref, true);\n }\n } else {\n memory.copy(outStart, changetype(source), sourceSize);\n memory.copy(outStart + sourceSize, changetype(other), otherLen << alignof());\n }\n return out;\n }\n\n static slice(source: StaticArray, start: i32 = 0, end: i32 = i32.MAX_VALUE): StaticArray {\n var length = source.length;\n start = start < 0 ? max(start + length, 0) : min(start, length);\n end = end < 0 ? max(end + length, 0) : min(end , length);\n length = max(end - start, 0);\n var sliceSize = length << alignof();\n var slice = changetype>(__new(sliceSize, idof>()));\n var sourcePtr = changetype(source) + (start << alignof());\n if (isManaged()) {\n let off: usize = 0;\n while (off < sliceSize) {\n let ref = load(sourcePtr + off);\n store(changetype(slice) + off, ref);\n __link(changetype(slice), ref, true);\n off += sizeof();\n }\n } else {\n memory.copy(changetype(slice), sourcePtr, sliceSize);\n }\n return slice;\n }\n\n constructor(length: i32) {\n if (length > BLOCK_MAXSIZE >>> alignof()) throw new RangeError(E_INVALIDLENGTH);\n var outSize = length << alignof();\n var out = changetype>(__new(outSize, idof>()));\n memory.fill(changetype(out), 0, outSize);\n return out;\n }\n\n get length(): i32 {\n return changetype(changetype(this) - TOTAL_OVERHEAD).rtSize >>> alignof();\n }\n\n at(index: i32): T {\n var len = this.length;\n index += select(0, len, index >= 0);\n if (index >= len) throw new RangeError(E_INDEXOUTOFRANGE);\n var value = load(changetype(this) + (index << alignof()));\n if (isReference()) {\n if (!isNullable()) {\n if (!changetype(value)) throw new Error(E_HOLEYARRAY);\n }\n }\n return value;\n }\n\n @operator(\"[]\") private __get(index: i32): T {\n if (index >= this.length) throw new RangeError(E_INDEXOUTOFRANGE);\n var value = load(changetype(this) + (index << alignof()));\n if (isReference()) {\n if (!isNullable()) {\n if (!changetype(value)) throw new Error(E_HOLEYARRAY);\n }\n }\n return value;\n }\n\n @unsafe @operator(\"{}\") private __uget(index: i32): T {\n return load(changetype(this) + (index << alignof()));\n }\n\n @operator(\"[]=\") private __set(index: i32, value: T): void {\n if (index >= this.length) throw new RangeError(E_INDEXOUTOFRANGE);\n this.__uset(index, value);\n }\n\n @unsafe @operator(\"{}=\") private __uset(index: i32, value: T): void {\n store(changetype(this) + (index << alignof()), value);\n if (isManaged()) {\n __link(changetype(this), changetype(value), true);\n }\n }\n\n includes(value: T, fromIndex: i32 = 0): bool {\n if (isFloat()) {\n let length = this.length;\n if (length == 0 || fromIndex >= length) return false;\n if (fromIndex < 0) fromIndex = max(length + fromIndex, 0);\n while (fromIndex < length) {\n let elem = load(changetype(this) + (fromIndex << alignof()));\n // @ts-ignore\n if (elem == value || isNaN(elem) & isNaN(value)) return true;\n ++fromIndex;\n }\n return false;\n } else {\n return this.indexOf(value, fromIndex) >= 0;\n }\n }\n\n indexOf(value: T, fromIndex: i32 = 0): i32 {\n var length = this.length;\n if (length == 0 || fromIndex >= length) return -1;\n if (fromIndex < 0) fromIndex = max(length + fromIndex, 0);\n while (fromIndex < length) {\n if (load(changetype(this) + (fromIndex << alignof())) == value) return fromIndex;\n ++fromIndex;\n }\n return -1;\n }\n\n lastIndexOf(value: T, fromIndex: i32 = this.length): i32 {\n var length = this.length;\n if (length == 0) return -1;\n if (fromIndex < 0) fromIndex = length + fromIndex;\n else if (fromIndex >= length) fromIndex = length - 1;\n while (fromIndex >= 0) {\n if (load(changetype(this) + (fromIndex << alignof())) == value) return fromIndex;\n --fromIndex;\n }\n return -1;\n }\n\n concat(other: Array): Array {\n var thisLen = this.length;\n var otherLen = select(0, other.length, other === null);\n var outLen = thisLen + otherLen;\n if (outLen > BLOCK_MAXSIZE >>> alignof()) throw new Error(E_INVALIDLENGTH);\n var out = changetype>(__newArray(outLen, alignof(), idof>()));\n var outStart = out.dataStart;\n var thisSize = thisLen << alignof();\n if (isManaged()) {\n let thisStart = changetype(this);\n for (let offset: usize = 0; offset < thisSize; offset += sizeof()) {\n let ref = load(thisStart + offset);\n store(outStart + offset, ref);\n __link(changetype(out), ref, true);\n }\n outStart += thisSize;\n let otherStart = other.dataStart;\n let otherSize = otherLen << alignof();\n for (let offset: usize = 0; offset < otherSize; offset += sizeof()) {\n let ref = load(otherStart + offset);\n store(outStart + offset, ref);\n __link(changetype(out), ref, true);\n }\n } else {\n memory.copy(outStart, changetype(this), thisSize);\n memory.copy(outStart + thisSize, other.dataStart, otherLen << alignof());\n }\n return out;\n }\n\n slice(start: i32 = 0, end: i32 = i32.MAX_VALUE): Array {\n var length = this.length;\n start = start < 0 ? max(start + length, 0) : min(start, length);\n end = end < 0 ? max(end + length, 0) : min(end , length);\n length = max(end - start, 0);\n var slice = changetype>(__newArray(length, alignof(), idof>()));\n var sliceBase = slice.dataStart;\n var thisBase = changetype(this) + (start << alignof());\n if (isManaged()) {\n let off = 0;\n let end = length << alignof();\n while (off < end) {\n let ref = load(thisBase + off);\n store(sliceBase + off, ref);\n __link(changetype(slice), ref, true);\n off += sizeof();\n }\n } else {\n memory.copy(sliceBase, thisBase, length << alignof());\n }\n return slice;\n }\n\n join(separator: string = \",\"): string {\n if (isBoolean()) return joinBooleanArray(changetype(this), this.length, separator);\n if (isInteger()) return joinIntegerArray(changetype(this), this.length, separator);\n if (isFloat()) return joinFloatArray(changetype(this), this.length, separator);\n if (ASC_SHRINK_LEVEL < 1) {\n if (isString()) return joinStringArray(changetype(this), this.length, separator);\n }\n if (isReference()) return joinReferenceArray(changetype(this), this.length, separator);\n ERROR(\"unspported element type\");\n return unreachable();\n }\n\n toString(): string {\n return this.join();\n }\n\n // RT integration\n\n @unsafe private __visit(cookie: u32): void {\n if (isManaged()) {\n let cur = changetype(this);\n let end = cur + changetype(changetype(this) - TOTAL_OVERHEAD).rtSize;\n while (cur < end) {\n let val = load(cur);\n if (val) __visit(val, cookie);\n cur += sizeof();\n }\n }\n }\n}\n","/// \n\nimport { OBJECT, BLOCK_MAXSIZE, TOTAL_OVERHEAD } from \"./rt/common\";\nimport { idof } from \"./builtins\";\nimport { E_INVALIDLENGTH } from \"./util/error\";\n\nexport abstract class ArrayBufferView {\n\n readonly buffer: ArrayBuffer;\n @unsafe readonly dataStart: usize;\n readonly byteLength: i32;\n\n get byteOffset(): i32 {\n return (this.dataStart - changetype(this.buffer));\n }\n\n protected constructor(length: i32, alignLog2: i32) {\n if (length > BLOCK_MAXSIZE >>> alignLog2) throw new RangeError(E_INVALIDLENGTH);\n var buffer = changetype(__new(length = length << alignLog2, idof()));\n memory.fill(changetype(buffer), 0, length);\n this.buffer = buffer; // links\n this.dataStart = changetype(buffer);\n this.byteLength = length;\n }\n}\n\n@final export class ArrayBuffer {\n\n static isView(value: T): bool {\n if (isNullable()) {\n if (value === null) return false;\n }\n if (value instanceof Int8Array) return true;\n if (value instanceof Uint8Array) return true;\n if (value instanceof Uint8ClampedArray) return true;\n if (value instanceof Int16Array) return true;\n if (value instanceof Uint16Array) return true;\n if (value instanceof Int32Array) return true;\n if (value instanceof Uint32Array) return true;\n if (value instanceof Int64Array) return true;\n if (value instanceof Uint64Array) return true;\n if (value instanceof Float32Array) return true;\n if (value instanceof Float64Array) return true;\n if (value instanceof DataView) return true;\n return false;\n }\n\n constructor(length: i32) {\n if (length > BLOCK_MAXSIZE) throw new RangeError(E_INVALIDLENGTH);\n var buffer = changetype(__new(length, idof()));\n memory.fill(changetype(buffer), 0, length);\n return buffer;\n }\n\n get byteLength(): i32 {\n return changetype(changetype(this) - TOTAL_OVERHEAD).rtSize;\n }\n\n slice(begin: i32 = 0, end: i32 = BLOCK_MAXSIZE): ArrayBuffer {\n var length = this.byteLength;\n begin = begin < 0 ? max(length + begin, 0) : min(begin, length);\n end = end < 0 ? max(length + end , 0) : min(end , length);\n var outSize = max(end - begin, 0);\n var out = changetype(__new(outSize, idof()));\n memory.copy(changetype(out), changetype(this) + begin, outSize);\n return out;\n }\n\n toString(): string {\n return \"[object ArrayBuffer]\";\n }\n}\n","import { u256 } from './u256';\n\nexport class i256 {\n\n @inline static get Zero(): i256 { return new i256(); }\n @inline static get One(): i256 { return new i256(1); }\n @inline static get Min(): i256 { return new i256(0, 0, 0, 0x8000000000000000); }\n @inline static get Max(): i256 { return new i256(u64.MAX_VALUE, u64.MAX_VALUE, u64.MAX_VALUE, 0x7FFFFFFFFFFFFFFF); }\n\n constructor(\n public lo1: i64 = 0,\n public lo2: i64 = 0,\n public hi1: i64 = 0,\n public hi2: i64 = 0,\n ) {}\n\n @inline\n isNeg(): bool {\n return (this.hi2 >>> 63);\n }\n\n @inline\n isZero(): bool {\n return !(this.lo1 | this.lo2 | this.hi1 | this.hi2);\n }\n\n @inline @operator.prefix('!')\n static isEmpty(value: i256): bool {\n return value === null || !value.isZero();\n }\n\n /*\n @inline\n static abs(value: i128): i128 {\n return value < 0 ? value.neg() : value;\n }\n */\n\n // TODO\n}\n","import { i128 } from './i128';\nimport { u128 } from './u128';\nimport { u256toa10 } from \"../utils\";\n\n@lazy const HEX_CHARS = '0123456789abcdef';\n\nexport class u256 {\n\n @inline static get Zero(): u256 { return new u256(); }\n @inline static get One(): u256 { return new u256(1); }\n @inline static get Min(): u256 { return new u256(); }\n @inline static get Max(): u256 { return new u256(-1, -1, -1, -1); }\n\n // TODO: fromString\n\n @inline\n static fromU256(value: u256): u256 {\n return new u256(value.lo1, value.lo2, value.hi1, value.hi2);\n }\n\n @inline\n static fromU128(value: u128): u256 {\n return new u256(value.lo, value.hi);\n }\n\n @inline\n static fromU64(value: u64): u256 {\n return new u256(value);\n }\n\n @inline\n static fromI64(value: i64): u256 {\n var mask = value >> 63;\n return new u256(value, mask, mask, mask);\n }\n\n @inline\n static fromU32(value: u32): u256 {\n return new u256(value);\n }\n\n @inline\n static fromI32(value: i32): u256 {\n var mask: u64 = value >> 63;\n return new u256(value, mask, mask, mask);\n }\n\n @inline\n static fromBits(\n l0: u32, l1: u32, l2: u32, l3: u32,\n h0: u32, h1: u32, h2: u32, h3: u32,\n ): u256 {\n return new u256(\n l0 | ((l1) << 32),\n l2 | ((l3) << 32),\n h0 | ((h1) << 32),\n h2 | ((h3) << 32),\n );\n }\n\n @inline\n static fromBytes(array: T, bigEndian: bool = false): u256 {\n // @ts-ignore\n if (array instanceof u8[]) {\n return bigEndian\n // @ts-ignore\n ? u256.fromBytesBE(array)\n // @ts-ignore\n : u256.fromBytesLE(array);\n } else if (array instanceof Uint8Array) {\n return bigEndian\n ? u256.fromUint8ArrayBE(array)\n : u256.fromUint8ArrayLE(array);\n } else {\n throw new TypeError(\"Unsupported generic type\");\n }\n }\n\n @inline\n static fromBytesLE(array: u8[]): u256 {\n assert(array.length && (array.length & 31) == 0);\n // @ts-ignore\n var buffer = array.dataStart\n return new u256(\n load(buffer, 0 * sizeof()),\n load(buffer, 1 * sizeof()),\n load(buffer, 2 * sizeof()),\n load(buffer, 3 * sizeof()),\n );\n }\n\n @inline\n static fromBytesBE(array: u8[]): u256 {\n assert(array.length && (array.length & 31) == 0);\n var buffer = array.dataStart;\n return new u256(\n bswap(load(buffer, 3 * sizeof())),\n bswap(load(buffer, 2 * sizeof())),\n bswap(load(buffer, 1 * sizeof())),\n bswap(load(buffer, 0 * sizeof()))\n );\n }\n\n @inline\n static fromUint8ArrayLE(array: Uint8Array): u256 {\n assert(array.length && (array.length & 31) == 0);\n var buffer = array.dataStart;\n return new u256(\n load(buffer, 0 * sizeof()),\n load(buffer, 1 * sizeof()),\n load(buffer, 2 * sizeof()),\n load(buffer, 3 * sizeof())\n );\n }\n\n @inline\n static fromUint8ArrayBE(array: Uint8Array): u256 {\n assert(array.length && (array.length & 31) == 0);\n var buffer = array.dataStart;\n return new u256(\n bswap(load(buffer, 3 * sizeof())),\n bswap(load(buffer, 2 * sizeof())),\n bswap(load(buffer, 1 * sizeof())),\n bswap(load(buffer, 0 * sizeof()))\n );\n }\n\n // TODO need improvement\n // max safe uint for f64 actually 52-bits\n @inline\n static fromF64(value: f64): u256 {\n var mask = u64(reinterpret(value) >> 63);\n return new u256(value, mask, mask, mask);\n }\n\n // TODO need improvement\n // max safe int for f32 actually 23-bits\n @inline\n static fromF32(value: f32): u256 {\n var mask = u64(reinterpret(value) >> 31);\n return new u256(value, mask, mask, mask);\n }\n\n // TODO\n // static fromString(str: string): u256\n\n constructor(\n public lo1: u64 = 0,\n public lo2: u64 = 0,\n public hi1: u64 = 0,\n public hi2: u64 = 0,\n ) {}\n\n @inline\n set(value: u256): this {\n this.lo1 = value.lo1;\n this.lo2 = value.lo2;\n this.hi1 = value.hi1;\n this.hi2 = value.hi2;\n return this;\n }\n\n @inline\n setU128(value: u128): this {\n this.lo1 = value.lo;\n this.lo2 = value.hi;\n this.hi1 = 0;\n this.hi2 = 0;\n return this;\n }\n\n @inline\n setI64(value: i64): this {\n var mask: u64 = value >> 63;\n this.lo1 = value;\n this.lo2 = mask;\n this.hi1 = mask;\n this.hi2 = mask;\n return this;\n }\n\n @inline\n setU64(value: u64): this {\n this.lo1 = value;\n this.lo2 = 0;\n this.hi1 = 0;\n this.hi2 = 0;\n return this;\n }\n\n @inline\n setI32(value: i32): this {\n var mask: u64 = value >> 63;\n this.lo1 = value;\n this.lo2 = mask;\n this.hi1 = mask;\n this.hi2 = mask;\n return this;\n }\n\n @inline\n setU32(value: u32): this {\n this.lo1 = value;\n this.lo2 = 0;\n this.hi1 = 0;\n this.hi2 = 0;\n return this;\n }\n\n @inline\n isZero(): bool {\n return !(this.lo1 | this.lo2 | this.hi1 | this.hi2);\n }\n\n @inline @operator.prefix('!')\n static isEmpty(value: u256): bool {\n return value === null || value.isZero();\n }\n\n @inline @operator.prefix('~')\n not(): u256 {\n return new u256(~this.lo1, ~this.lo2, ~this.hi1, ~this.hi2);\n }\n\n @inline @operator.prefix('+')\n pos(): u256 {\n return this;\n }\n\n @operator.prefix('-')\n neg(): u256 {\n var\n lo1 = ~this.lo1,\n lo2 = ~this.lo2,\n hi1 = ~this.hi1,\n hi2 = ~this.hi2;\n\n var lo1p = lo1 + 1;\n var lo2p = lo2 + u64(lo1p < lo1);\n var hi1p = hi1 + ((lo2 & ~lo2p) >> 63);\n var hi2p = hi2 + ((hi1 & ~hi1p) >> 63);\n\n return new u256(lo1p, lo2p, hi1p, hi2p);\n }\n\n @operator.prefix('++')\n preInc(): this {\n var\n lo1 = this.lo1,\n lo2 = this.lo2,\n hi1 = this.hi1,\n hi2 = this.hi2;\n\n var lo1p = lo1 + 1;\n var lo2p = lo2 + u64(lo1p < lo1);\n var hi1p = hi1 + ((lo2 & ~lo2p) >> 63);\n var hi2p = hi2 + ((hi1 & ~hi1p) >> 63);\n\n this.lo1 = lo1p;\n this.lo2 = lo2p;\n this.hi1 = hi1p;\n this.hi2 = hi2p;\n\n return this;\n }\n\n @operator.prefix('--')\n preDec(): this {\n var\n lo1 = this.lo1,\n lo2 = this.lo2,\n hi1 = this.hi1,\n hi2 = this.hi2;\n\n var lo1p = lo1 - 1;\n var lo2p = lo2 - u64(lo1p > lo1);\n var hi1p = hi1 - ((~lo2 & lo2p) >> 63);\n var hi2p = hi2 - ((~hi1 & hi1p) >> 63);\n\n this.lo1 = lo1p;\n this.lo2 = lo2p;\n this.hi1 = hi1p;\n this.hi2 = hi2p;\n\n return this;\n }\n\n @inline @operator.postfix('++')\n postInc(): u256 {\n return this.clone().preInc();\n }\n\n @inline @operator.postfix('--')\n postDec(): u256 {\n return this.clone().preDec();\n }\n\n @operator('+')\n static add(a: u256, b: u256): u256 {\n var\n lo1a = a.lo1,\n lo2a = a.lo2,\n hi1a = a.hi1,\n hi2a = a.hi2;\n\n var\n lo1b = b.lo1,\n lo2b = b.lo2,\n hi1b = b.hi1,\n hi2b = b.hi2;\n\n var lo1 = lo1a + lo1b;\n var cy = u64(lo1 < lo1a);\n var lo2 = lo2a + lo2b + cy;\n // for a + b + c case we should calculate carry bit differently\n cy = ((lo2a & lo2b) | ((lo2a | lo2b) & ~lo2)) >> 63;\n var hi1 = hi1a + hi1b + cy;\n cy = ((hi1a & hi1b) | ((hi1a | hi1b) & ~hi1)) >> 63;\n var hi2 = hi2a + hi2b + cy;\n return new u256(lo1, lo2, hi1, hi2);\n }\n\n @operator('-')\n static sub(a: u256, b: u256): u256 {\n var\n lo1a = a.lo1,\n lo2a = a.lo2,\n hi1a = a.hi1,\n hi2a = a.hi2;\n\n var\n lo1b = b.lo1,\n lo2b = b.lo2,\n hi1b = b.hi1,\n hi2b = b.hi2;\n\n var lo1 = lo1a - lo1b;\n var cy = u64(lo1 > lo1a);\n var lo2 = lo2a - lo2b - cy;\n // for a - b - c case we should calculate carry bit differently\n cy = ((~lo2a & lo2b) | ((~lo2a | lo2b) & lo2)) >> 63;\n var hi1 = hi1a - hi1b - cy;\n cy = ((~hi1a & hi1b) | ((~hi1a | hi1b) & hi1)) >> 63;\n var hi2 = hi2a - hi2b - cy;\n return new u256(lo1, lo2, hi1, hi2);\n }\n\n @inline @operator('|')\n static or(a: u256, b: u256): u256 {\n return new u256(a.lo1 | b.lo1, a.lo2 | b.lo2, a.hi1 | b.hi1, a.hi2 | b.hi2);\n }\n\n @inline @operator('^')\n static xor(a: u256, b: u256): u256 {\n return new u256(a.lo1 ^ b.lo1, a.lo2 ^ b.lo2, a.hi1 ^ b.hi1, a.hi2 ^ b.hi2);\n }\n\n @inline @operator('&')\n static and(a: u256, b: u256): u256 {\n return new u256(a.lo1 & b.lo1, a.lo2 & b.lo2, a.hi1 & b.hi1, a.hi2 & b.hi2);\n }\n\n @operator('>>')\n static shr(value: u256, shift: i32): u256 {\n shift &= 255;\n var off = shift as u64;\n if (shift <= 64) {\n if (shift == 0) return value;\n let hi2 = value.hi2 >> off;\n let hi1 = (value.hi1 >> off) | (value.hi2 << 64 - off);\n let lo2 = (value.lo2 >> off) | (value.hi1 << 64 - off);\n let lo1 = (value.lo1 >> off) | (value.lo2 << 64 - off);\n return new u256(lo1, lo2, hi1, hi2);\n } else if (shift > 64 && shift <= 128) {\n let hi1 = value.hi2 >> 128 - off;\n return new u256(value.lo2, value.hi1, hi1);\n } else if (shift > 128 && shift <= 192) {\n let lo2 = value.hi2 >> 192 - off;\n return new u256(value.hi1, lo2);\n } else {\n return new u256(value.hi2 >> 256 - off);\n }\n }\n\n @inline @operator('>>>')\n static shr_u(value: u256, shift: i32): u256 {\n return u256.shr(value, shift);\n }\n\n @inline @operator('==')\n static eq(a: u256, b: u256): bool {\n return (\n a.lo1 == b.lo1 && a.lo2 == b.lo2 &&\n a.hi1 == b.hi1 && a.hi2 == b.hi2\n );\n }\n\n @inline @operator('!=')\n static ne(a: u256, b: u256): bool {\n return !u256.eq(a, b);\n }\n\n @operator('<')\n static lt(a: u256, b: u256): bool {\n var ah2 = a.hi2, ah1 = a.hi1,\n bh2 = b.hi2, bh1 = b.hi1,\n al2 = a.lo2, bl2 = b.lo2;\n if (ah2 == bh2) {\n if (ah1 == bh1) {\n return al2 == bl2 ? a.lo1 < b.lo1 : al2 < bl2\n } else {\n return ah1 < bh1;\n }\n } else {\n return ah2 < bh2;\n }\n }\n\n @inline @operator('>')\n static gt(a: u256, b: u256): bool {\n return b < a;\n }\n\n @inline @operator('<=')\n static le(a: u256, b: u256): bool {\n return !u256.gt(a, b);\n }\n\n @inline @operator('>=')\n static ge(a: u256, b: u256): bool {\n return !u256.lt(a, b);\n }\n\n @inline\n static popcnt(value: u256): i32 {\n var count = popcnt(value.lo1);\n if (value.lo2) count += popcnt(value.lo2);\n if (value.hi1) count += popcnt(value.hi1);\n if (value.hi2) count += popcnt(value.hi2);\n return count;\n }\n\n @inline\n static clz(value: u256): i32 {\n if (value.hi2) return (clz(value.hi2) + 0);\n else if (value.hi1) return (clz(value.hi1) + 64);\n else if (value.lo2) return (clz(value.lo2) + 128);\n else return (clz(value.lo1) + 192);\n }\n\n @inline\n static ctz(value: u256): i32 {\n if (value.lo1) return (ctz(value.lo1) + 0);\n else if (value.lo2) return (ctz(value.lo2) + 64);\n else if (value.hi1) return (ctz(value.hi1) + 128);\n else return (ctz(value.hi2) + 192);\n }\n\n /**\n * Convert to 128-bit signed integer\n * @return 256-bit signed integer\n */\n @inline\n toI128(): i128 {\n return new i128(\n this.lo1,\n (this.lo2 & 0x7FFFFFFFFFFFFFFF) |\n (this.hi2 & 0x8000000000000000)\n );\n }\n\n /**\n * Convert to 128-bit unsigned integer\n * @return 128-bit unsigned integer\n */\n @inline\n toU128(): u128 {\n return new u128(this.lo1, this.lo2);\n }\n\n /**\n * Convert to 256-bit unsigned integer\n * @returns 256-bit unsigned integer\n */\n @inline\n toU256(): this {\n return this;\n }\n\n /**\n * Convert to 64-bit signed integer\n * @return 64-bit signed integer\n */\n @inline\n toI64(): i64 {\n return (\n (this.lo1 & 0x7FFFFFFFFFFFFFFF) |\n (this.hi2 & 0x8000000000000000)\n );\n }\n\n /**\n * Convert to 64-bit unsigned integer\n * @return 64-bit unsigned integer\n */\n @inline\n toU64(): u64 {\n return this.lo1;\n }\n\n /**\n * Convert to 32-bit signed integer\n * @return 32-bit signed integer\n */\n @inline\n toI32(): i32 {\n return this.toI64();\n }\n\n /**\n * Convert to 32-bit unsigned integer\n * @return 32-bit unsigned integer\n */\n @inline\n toU32(): u32 {\n return this.lo1;\n }\n\n /**\n * Convert to 1-bit boolean\n * @return 1-bit boolean\n */\n @inline\n toBool(): bool {\n return (this.lo1 | this.lo2 | this.hi1 | this.hi2);\n }\n\n @inline\n private toArrayBufferLE(buffer: usize): void {\n store(buffer, this.lo1, 0 * sizeof());\n store(buffer, this.lo2, 1 * sizeof());\n store(buffer, this.hi1, 2 * sizeof());\n store(buffer, this.hi2, 3 * sizeof());\n }\n\n @inline\n private toArrayBufferBE(buffer: usize): void {\n store(buffer, bswap(this.hi2), 0 * sizeof());\n store(buffer, bswap(this.hi1), 1 * sizeof());\n store(buffer, bswap(this.lo2), 2 * sizeof());\n store(buffer, bswap(this.lo1), 3 * sizeof());\n }\n\n @inline\n private toArrayBuffer(buffer: usize, bigEndian: bool = false): void {\n if (bigEndian) {\n this.toArrayBufferBE(buffer);\n } else {\n this.toArrayBufferLE(buffer);\n }\n }\n\n /**\n * Convert to generic type T. Useful inside other generics methods\n * @param T is \n * @returns type of T\n */\n @inline\n as(): T {\n var dummy: T;\n if (dummy instanceof bool) return this.toBool();\n else if (dummy instanceof i8) return this.toI64();\n else if (dummy instanceof u8) return this.toU64();\n else if (dummy instanceof i16) return this.toI64();\n else if (dummy instanceof u16) return this.toU64();\n else if (dummy instanceof i32) return this.toI64();\n else if (dummy instanceof i64) return this.toI64();\n else if (dummy instanceof u32) return this.toU64();\n else if (dummy instanceof u64) return this.toU64();\n // else if (dummy instanceof f32) return this.toF64();\n // else if (dummy instanceof f64) return this.toF64();\n else if (dummy instanceof i128) return this.toI128();\n else if (dummy instanceof u128) return this.toU128();\n else if (dummy instanceof u256) return this.toU256();\n else if (dummy instanceof u8[]) return this.toBytes();\n else if (dummy instanceof Uint8Array) return this.toUint8Array();\n else if (dummy instanceof StaticArray) return this.toStaticBytes();\n else if (dummy instanceof String) return this.toString();\n else throw new TypeError('Unsupported generic type');\n }\n\n /**\n * Convert to byte array\n * @param bigEndian Little or Big Endian? Default: false\n * @returns Array of bytes\n */\n @inline\n toBytes(bigEndian: bool = false): u8[] {\n var result = new Array(32);\n this.toArrayBuffer(result.dataStart, bigEndian);\n return result;\n }\n\n /**\n * Convert to byte static array\n * @param bigEndian Little or Big Endian? Default: false\n * @returns StaticArray of bytes\n */\n @inline\n toStaticBytes(bigEndian: bool = false): StaticArray {\n var result = new StaticArray(32);\n this.toArrayBuffer(changetype(result), bigEndian);\n return result;\n }\n\n /**\n * Convert to Uint8Array\n * @param bigEndian Little or Big Endian? Default: false\n * @returns Uint8Array\n */\n @inline\n toUint8Array(bigEndian: bool = false): Uint8Array {\n var result = new Uint8Array(32);\n this.toArrayBuffer(result.dataStart, bigEndian);\n return result;\n }\n\n clone(): u256 {\n return new u256(this.lo1, this.lo2, this.hi1, this.hi2);\n }\n\n toString(radix: i32 = 10): string {\n assert(radix == 10 || radix == 16, 'radix argument must be between 10 or 16');\n if (this.isZero()) return '0';\n\n var result = '';\n var it = this.clone();\n if (radix == 16) {\n let shift: i32 = 252 - (u256.clz(it) & ~3);\n while (shift >= 0) {\n // @ts-ignore\n it >>= shift;\n result = result.concat(HEX_CHARS.charAt((it.lo1 & 15)));\n shift -= 4;\n }\n return result;\n }\n return u256toa10(this);\n }\n}\n","import { u256Safe as u256 } from './u256';\nimport { i128Safe } from './i128';\nimport { i256Safe } from './i256';\nimport { u128 as U128 } from '../u128';\nimport { u256 as U256 } from '../u256';\nimport { i128 as I128 } from '../i128';\nimport { i256 as I256 } from '../i256';\nimport { isPowerOverflow128, atou128 } from '../../utils';\n\n// @external(\"safe_u128.spec.as\", \"logStr\")\n// declare function logStr(str: string): void;\n\n// @external(\"safe_u128.spec.as\", \"logF64\")\n// declare function logF64(v: f64): void;\n\n// export namespace safe {\nclass u128 extends U128 {\n\n @inline static get Zero(): u128 { return new u128(); }\n @inline static get One(): u128 { return new u128(1); }\n @inline static get Min(): u128 { return new u128(); }\n @inline static get Max(): u128 { return new u128(-1, -1); }\n\n @inline\n static fromString(value: string, radix: i32 = 10): u128 {\n return changetype(atou128(value, radix));\n }\n\n @inline\n static fromI256(value: I256): u128 {\n return changetype(U128.fromI256(value));\n }\n\n @inline\n static fromI256Safe(value: i256Safe): u128 {\n return changetype(U128.fromI256(value));\n }\n\n @inline\n static fromU256(value: u256): u128 {\n return changetype(U128.fromU256(value));\n }\n\n @inline\n static fromI128(value: I128): u128 {\n return changetype(U128.fromI128(value));\n }\n\n @inline\n static fromI128Safe(value: i128Safe): u128 {\n return changetype(U128.fromI128(value));\n }\n\n @inline\n static fromU128(value: u128): u128 {\n return changetype(U128.fromU128(value));\n }\n\n @inline\n static fromI64(value: i64): u128 {\n return changetype(U128.fromI64(value));\n }\n\n @inline\n static fromU64(value: u64): u128 {\n return changetype(U128.fromU64(value));\n }\n\n @inline\n static fromF64(value: f64): u128 {\n return changetype(U128.fromF64(value));\n }\n\n @inline\n static fromF32(value: f32): u128 {\n return changetype(U128.fromF32(value));\n }\n\n @inline\n static fromI32(value: i32): u128 {\n return changetype(U128.fromI32(value));\n }\n\n @inline\n static fromU32(value: u32): u128 {\n return changetype(U128.fromU32(value));\n }\n\n @inline\n static fromBool(value: bool): u128 {\n return changetype(U128.fromBool(value));\n }\n\n @inline\n static fromBits(lo1: u32, lo2: u32, hi1: u32, hi2: u32): u128 {\n return changetype(U128.fromBits(lo1, lo2, hi1, hi2));\n }\n\n @inline\n static fromBytes(array: T, bigEndian: bool = false): u128 {\n return changetype(U128.fromBytes(array, bigEndian));\n }\n\n @inline\n static fromBytesLE(array: u8[]): u128 {\n return changetype(U128.fromBytesLE(array));\n }\n\n @inline\n static fromBytesBE(array: u8[]): u128 {\n return changetype(U128.fromBytesBE(array));\n }\n\n @inline\n static fromUint8ArrayLE(array: Uint8Array): u128 {\n return changetype(U128.fromUint8ArrayLE(array));\n }\n\n @inline\n static fromUint8ArrayBE(array: Uint8Array): u128 {\n return changetype(U128.fromUint8ArrayBE(array));\n }\n\n /**\n * Create 128-bit unsigned integer from generic type T\n * @param value\n * @returns 128-bit unsigned integer\n */\n @inline\n static from(value: T): u128 {\n if (value instanceof bool) return u128.fromU64(value);\n else if (value instanceof i8) return u128.fromI64(value);\n else if (value instanceof u8) return u128.fromU64(value);\n else if (value instanceof i16) return u128.fromI64(value);\n else if (value instanceof u16) return u128.fromU64(value);\n else if (value instanceof i32) return u128.fromI64(value);\n else if (value instanceof u32) return u128.fromU64(value);\n else if (value instanceof i64) return u128.fromI64(value);\n else if (value instanceof u64) return u128.fromU64(value);\n else if (value instanceof f32) return u128.fromF64(value);\n else if (value instanceof f64) return u128.fromF64(value);\n else if (value instanceof I128) return u128.fromI128(value);\n else if (value instanceof i128Safe) return u128.fromI128(value);\n else if (value instanceof u128) return u128.fromU128(value);\n else if (value instanceof U128) return u128.fromU128(value);\n else if (value instanceof I256) return u128.fromI128(value);\n else if (value instanceof i256Safe) return u128.fromI256(value);\n else if (value instanceof u256) return u128.fromU256(value);\n else if (value instanceof u8[]) return u128.fromBytes(value);\n else if (value instanceof Uint8Array) return u128.fromBytes(value);\n else if (value instanceof String) return u128.fromString(value);\n else throw new TypeError(\"Unsupported generic type\");\n }\n\n @inline @operator('|')\n static or(a: u128, b: u128): u128 {\n return changetype(U128.or(a, b));\n }\n\n @inline @operator('^')\n static xor(a: u128, b: u128): u128 {\n return changetype(U128.xor(a, b));\n }\n\n @inline @operator('&')\n static and(a: u128, b: u128): u128 {\n return changetype(U128.and(a, b));\n }\n\n @inline @operator('<<')\n static shl(value: u128, shift: i32): u128 {\n return changetype(U128.shl(value, shift));\n }\n\n @inline @operator('>>')\n static shr(value: u128, shift: i32): u128 {\n return changetype(U128.shr(value, shift));\n }\n\n @inline @operator('>>>')\n static shr_u(value: u128, shift: i32): u128 {\n return u128.shr(value, shift);\n }\n\n @inline\n static rotl(value: u128, shift: i32): u128 {\n return changetype(U128.rotl(value, shift));\n }\n\n @inline\n static rotr(value: u128, shift: i32): u128 {\n return changetype(U128.rotr(value, shift));\n }\n\n @operator.prefix('++')\n preInc(): this {\n if ((this.lo & this.hi) == -1) { // if this == max\n throw new RangeError('Overflow during prefix incrementing');\n }\n super.preInc();\n return this;\n }\n\n @operator.prefix('--')\n preDec(): this {\n if ((this.lo | this.hi) == 0) { // if this == 0\n throw new RangeError('Underflow during prefix decrementing');\n }\n super.preDec();\n return this;\n }\n\n @inline @operator.postfix('++')\n postInc(): u128 {\n return this.clone().preInc();\n }\n\n @inline @operator.postfix('--')\n postDec(): u128 {\n return this.clone().preDec();\n }\n\n @operator('+')\n static add(a: u128, b: u128): u128 {\n var bl = b.lo;\n var lo = a.lo + bl;\n var c = u64(lo < bl);\n var x = a.hi;\n var y = b.hi;\n var hi = x + y + c;\n if (((hi ^ x) & (hi ^ y)) < c) {\n throw new RangeError('Overflow during addision');\n }\n return new u128(lo, hi);\n }\n\n @operator('-')\n static sub(a: u128, b: u128): u128 {\n if (a < b) throw new RangeError(\"Underflow during substraction\");\n return changetype(\n U128.sub(changetype(a), changetype(b))\n );\n }\n\n @operator('*')\n static mul(a: u128, b: u128): u128 {\n if (a.isZero() || b.isZero()) {\n return u128.Zero;\n }\n var s = u128.clz(a) + u128.clz(b);\n if (s < 127) { // defenitely overflow\n throw new RangeError(\"Overflow during multiplication\");\n }\n if (s == 127) { // this may overflow or not. Need extra checks.\n // See Hacker's Delight, 2nd Edition. 2–13 Overflow Detection\n // @ts-ignore\n let tmp = U128.mul(changetype(a), changetype(b) >> 1);\n // @ts-ignore\n if (tmp.hi >>> 63) { // (signed)t < 0\n throw new RangeError(\"Overflow during multiplication\");\n }\n // @ts-ignore\n let z = tmp << 1;\n if (b.lo & 1) {\n // @ts-ignore\n z += a;\n // @ts-ignore\n if (z < a) {\n throw new RangeError(\"Overflow during multiplication\");\n }\n }\n return changetype(z);\n }\n return changetype(\n U128.mul(changetype(a), changetype(b))\n );\n }\n\n @inline @operator('/')\n static div(a: u128, b: u128): u128 {\n return changetype(U128.div(a, b));\n }\n\n @inline @operator('**')\n static pow(base: u128, exponent: i32): u128 {\n if (isPowerOverflow128(base, exponent)) {\n throw new Error(\"Overflow during exponentiation\");\n }\n return changetype(U128.pow(changetype(base), exponent));\n }\n\n @inline @operator('%')\n static rem(a: u128, b: u128): u128 {\n return changetype(U128.rem(a, b));\n }\n\n @inline\n static div10(value: u128): u128 {\n return changetype(U128.div10(value));\n }\n\n @inline\n static rem10(value: u128): u128 {\n return changetype(U128.rem10(value));\n }\n\n // compute floor(sqrt(x))\n @inline\n static sqrt(value: u128): u128 {\n return changetype(U128.sqrt(value));\n }\n\n @inline\n static muldiv(number: u128, numerator: u128, denominator: u128): u128 {\n // TODO: Need implement overflow checking\n return changetype(U128.muldiv(number, numerator, denominator));\n }\n\n @inline\n toUnchecked(): U128 {\n return changetype(this);\n }\n\n @inline\n as(): T {\n var dummy: T;\n\n if (dummy instanceof bool) return this.toBool();\n else if (dummy instanceof i8) return this.toI64();\n else if (dummy instanceof u8) return this.toU64();\n else if (dummy instanceof i16) return this.toI64();\n else if (dummy instanceof u16) return this.toU64();\n else if (dummy instanceof i32) return this.toI64();\n else if (dummy instanceof i64) return this.toI64();\n else if (dummy instanceof u32) return this.toU64();\n else if (dummy instanceof u64) return this.toU64();\n else if (dummy instanceof f32) return this.toF64();\n else if (dummy instanceof f64) return this.toF64();\n else if (dummy instanceof i128) return this.toI128();\n else if (dummy instanceof u128) return this;\n else if (dummy instanceof U128) return this.toUnchecked();\n else if (dummy instanceof u256) return this.toU256();\n else if (dummy instanceof U256) return this.toU256();\n else if (dummy instanceof u8[]) return this.toBytes();\n else if (dummy instanceof Uint8Array) return this.toUint8Array();\n else if (dummy instanceof String) return this.toString();\n else throw new TypeError('Unsupported generic type');\n }\n\n //\n // unsigned div and rem already contain traps\n //\n\n @inline\n clone(): u128 {\n return new u128(this.lo, this.hi);\n }\n}\n\nexport { u128 as u128Safe };\n"]} \ No newline at end of file diff --git a/build/release/bignum.wat b/build/release/bignum.wat index 49147ba..8d9da66 100644 --- a/build/release/bignum.wat +++ b/build/release/bignum.wat @@ -3,26 +3,26 @@ (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $none_=>_i32 (func (result i32))) (type $i32_=>_i64 (func (param i32) (result i64))) - (type $i64_=>_i32 (func (param i64) (result i32))) (type $i32_i64_i64_=>_i32 (func (param i32 i64 i64) (result i32))) + (type $i64_=>_i32 (func (param i64) (result i32))) (type $i32_i64_=>_none (func (param i32 i64))) (type $i32_i64_i64_i64_i64_=>_i32 (func (param i32 i64 i64 i64 i64) (result i32))) (type $i32_i64_=>_i32 (func (param i32 i64) (result i32))) - (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) - (type $f32_=>_i32 (func (param f32) (result i32))) (type $f64_=>_i32 (func (param f64) (result i32))) - (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (type $f32_=>_i32 (func (param f32) (result i32))) + (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32) (result i32))) (type $i64_i64_i64_i64_=>_i64 (func (param i64 i64 i64 i64) (result i64))) - (type $none_=>_none (func)) - (type $i32_=>_none (func (param i32))) - (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) - (type $i32_i32_i32_i32_i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32 i32 i32 i32 i32) (result i32))) + (type $i32_i32_=>_none (func (param i32 i32))) (type $i64_i64_=>_i64 (func (param i64 i64) (result i64))) - (type $i32_=>_f32 (func (param i32) (result f32))) - (type $i32_=>_f64 (func (param i32) (result f64))) (type $i64_i64_=>_f64 (func (param i64 i64) (result f64))) + (type $i32_=>_f64 (func (param i32) (result f64))) + (type $i32_=>_f32 (func (param i32) (result f32))) + (type $i32_i32_i32_i32_i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32 i32 i32 i32 i32) (result i32))) + (type $i32_=>_none (func (param i32))) + (type $none_=>_none (func)) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) (global $assembly/globals/__res128_hi (mut i64) (i64.const 0)) @@ -33,10 +33,10 @@ (global $~argumentsLength (mut i32) (i32.const 0)) (global $assembly/integer/u128/u128 i32 (i32.const 4)) (global $assembly/integer/u256/u256 i32 (i32.const 7)) - (global $assembly/integer/safe/i128/i128 i32 (i32.const 10)) - (global $assembly/integer/safe/i256/i256 i32 (i32.const 11)) - (global $assembly/integer/safe/u128/u128 i32 (i32.const 12)) - (global $assembly/integer/safe/u256/u256 i32 (i32.const 13)) + (global $assembly/integer/safe/i128/i128 i32 (i32.const 11)) + (global $assembly/integer/safe/i256/i256 i32 (i32.const 12)) + (global $assembly/integer/safe/u128/u128 i32 (i32.const 13)) + (global $assembly/integer/safe/u256/u256 i32 (i32.const 14)) (memory $0 1) (data (i32.const 1036) "<") (data (i32.const 1048) "\01\00\00\00(\00\00\00A\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e") @@ -57,45 +57,47 @@ (data (i32.const 1548) ",") (data (i32.const 1560) "\01\00\00\00\1a\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s") (data (i32.const 1596) "<") - (data (i32.const 1608) "\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") - (data (i32.const 1660) "L") - (data (i32.const 1672) "\01\00\00\000\00\00\00a\00s\00s\00e\00m\00b\00l\00y\00/\00i\00n\00t\00e\00g\00e\00r\00/\00u\001\002\008\00.\00t\00s") - (data (i32.const 1740) "<") - (data (i32.const 1752) "\01\00\00\00 \00\00\00D\00i\00v\00i\00s\00i\00o\00n\00 \00b\00y\00 \00z\00e\00r\00o") + (data (i32.const 1608) "\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00s\00t\00a\00t\00i\00c\00a\00r\00r\00a\00y\00.\00t\00s") + (data (i32.const 1660) "<") + (data (i32.const 1672) "\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") + (data (i32.const 1724) "L") + (data (i32.const 1736) "\01\00\00\000\00\00\00a\00s\00s\00e\00m\00b\00l\00y\00/\00i\00n\00t\00e\00g\00e\00r\00/\00u\001\002\008\00.\00t\00s") (data (i32.const 1804) "<") - (data (i32.const 1816) "\01\00\00\00&\00\00\00a\00s\00s\00e\00m\00b\00l\00y\00/\00g\00l\00o\00b\00a\00l\00s\00.\00t\00s") - (data (i32.const 1868) "l") - (data (i32.const 1880) "\01\00\00\00N\00\00\00r\00a\00d\00i\00x\00 \00a\00r\00g\00u\00m\00e\00n\00t\00 \00m\00u\00s\00t\00 \00b\00e\00 \00b\00e\00t\00w\00e\00e\00n\00 \001\000\00 \00o\00r\00 \001\006") - (data (i32.const 1980) "\1c") - (data (i32.const 1992) "\01\00\00\00\02\00\00\000") - (data (i32.const 2012) "\1c") - (data (i32.const 2024) "\01") - (data (i32.const 2044) "<") - (data (i32.const 2056) "\01\00\00\00 \00\00\000\001\002\003\004\005\006\007\008\009\00a\00b\00c\00d\00e\00f") + (data (i32.const 1816) "\01\00\00\00 \00\00\00D\00i\00v\00i\00s\00i\00o\00n\00 \00b\00y\00 \00z\00e\00r\00o") + (data (i32.const 1868) "<") + (data (i32.const 1880) "\01\00\00\00&\00\00\00a\00s\00s\00e\00m\00b\00l\00y\00/\00g\00l\00o\00b\00a\00l\00s\00.\00t\00s") + (data (i32.const 1932) "l") + (data (i32.const 1944) "\01\00\00\00N\00\00\00r\00a\00d\00i\00x\00 \00a\00r\00g\00u\00m\00e\00n\00t\00 \00m\00u\00s\00t\00 \00b\00e\00 \00b\00e\00t\00w\00e\00e\00n\00 \001\000\00 \00o\00r\00 \001\006") + (data (i32.const 2044) "\1c") + (data (i32.const 2056) "\01\00\00\00\02\00\00\000") + (data (i32.const 2076) "\1c") + (data (i32.const 2088) "\01") (data (i32.const 2108) "<") - (data (i32.const 2120) "\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e") + (data (i32.const 2120) "\01\00\00\00 \00\00\000\001\002\003\004\005\006\007\008\009\00a\00b\00c\00d\00e\00f") (data (i32.const 2172) "<") - (data (i32.const 2184) "\01\00\00\00$\00\00\00~\00l\00i\00b\00/\00t\00y\00p\00e\00d\00a\00r\00r\00a\00y\00.\00t\00s") - (data (i32.const 2236) "L") - (data (i32.const 2248) "\01\00\00\000\00\00\00a\00s\00s\00e\00m\00b\00l\00y\00/\00i\00n\00t\00e\00g\00e\00r\00/\00u\002\005\006\00.\00t\00s") - (data (i32.const 2316) "L") - (data (i32.const 2328) "\01\00\00\000\00\00\00O\00v\00e\00r\00f\00l\00o\00w\00 \00d\00u\00r\00i\00n\00g\00 \00a\00d\00d\00i\00s\00i\00o\00n") - (data (i32.const 2396) "L") - (data (i32.const 2408) "\01\00\00\00:\00\00\00a\00s\00s\00e\00m\00b\00l\00y\00/\00i\00n\00t\00e\00g\00e\00r\00/\00s\00a\00f\00e\00/\00u\001\002\008\00.\00t\00s") - (data (i32.const 2476) "L") - (data (i32.const 2488) "\01\00\00\00:\00\00\00U\00n\00d\00e\00r\00f\00l\00o\00w\00 \00d\00u\00r\00i\00n\00g\00 \00s\00u\00b\00s\00t\00r\00a\00c\00t\00i\00o\00n") - (data (i32.const 2556) "L") - (data (i32.const 2568) "\01\00\00\00<\00\00\00O\00v\00e\00r\00f\00l\00o\00w\00 \00d\00u\00r\00i\00n\00g\00 \00m\00u\00l\00t\00i\00p\00l\00i\00c\00a\00t\00i\00o\00n") - (data (i32.const 2636) "L\01") - (data (i32.const 2652) "8\01\00\00\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff[O\a9\7fY\06\00\00\ff\ff\ff\ff\00\00\00\00\00\0c\08\03\00\00\00\00EQ(\00\00\00\00\00E\e0\04\00\00\00\00\00\ff\ff\00\00\00\00\00\00\a8J\00\00\00\00\00\00\db\1b\00\00\00\00\00\00o\0c\00\00\00\00\00\00Y\06\00\00\00\00\00\00\98\03\00\00\00\00\00\005\02\00\00\00\00\00\00r\01\00\00\00\00\00\00\ff\00\00\00\00\00\00\00\b8\00\00\00\00\00\00\00\8a\00\00\00\00\00\00\00j\00\00\00\00\00\00\00T\00\00\00\00\00\00\00D\00\00\00\00\00\00\008\00\00\00\00\00\00\00/\00\00\00\00\00\00\00(\00\00\00\00\00\00\00\"\00\00\00\00\00\00\00\1e\00\00\00\00\00\00\00\1a\00\00\00\00\00\00\00\17\00\00\00\00\00\00\00\15\00\00\00\00\00\00\00\13\00\00\00\00\00\00\00\11\00\00\00\00\00\00\00\0f\00\00\00\00\00\00\00\0e\00\00\00\00\00\00\00\0d\00\00\00\00\00\00\00\0c\00\00\00\00\00\00\00\0b\00\00\00\00\00\00\00\0b\00\00\00\00\00\00\00\n") - (data (i32.const 2972) ",") - (data (i32.const 2984) "\0e\00\00\00\10\00\00\00`\n\00\00`\n\00\008\01\00\00\'") - (data (i32.const 3020) "L") - (data (i32.const 3032) "\01\00\00\00<\00\00\00O\00v\00e\00r\00f\00l\00o\00w\00 \00d\00u\00r\00i\00n\00g\00 \00e\00x\00p\00o\00n\00e\00n\00t\00i\00a\00t\00i\00o\00n") - (data (i32.const 3100) "\\") - (data (i32.const 3112) "\01\00\00\00F\00\00\00O\00v\00e\00r\00f\00l\00o\00w\00 \00d\00u\00r\00i\00n\00g\00 \00p\00r\00e\00f\00i\00x\00 \00i\00n\00c\00r\00e\00m\00e\00n\00t\00i\00n\00g") - (data (i32.const 3196) "\\") - (data (i32.const 3208) "\01\00\00\00H\00\00\00U\00n\00d\00e\00r\00f\00l\00o\00w\00 \00d\00u\00r\00i\00n\00g\00 \00p\00r\00e\00f\00i\00x\00 \00d\00e\00c\00r\00e\00m\00e\00n\00t\00i\00n\00g") + (data (i32.const 2184) "\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e") + (data (i32.const 2236) "<") + (data (i32.const 2248) "\01\00\00\00$\00\00\00~\00l\00i\00b\00/\00t\00y\00p\00e\00d\00a\00r\00r\00a\00y\00.\00t\00s") + (data (i32.const 2300) "L") + (data (i32.const 2312) "\01\00\00\000\00\00\00a\00s\00s\00e\00m\00b\00l\00y\00/\00i\00n\00t\00e\00g\00e\00r\00/\00u\002\005\006\00.\00t\00s") + (data (i32.const 2380) "L") + (data (i32.const 2392) "\01\00\00\000\00\00\00O\00v\00e\00r\00f\00l\00o\00w\00 \00d\00u\00r\00i\00n\00g\00 \00a\00d\00d\00i\00s\00i\00o\00n") + (data (i32.const 2460) "L") + (data (i32.const 2472) "\01\00\00\00:\00\00\00a\00s\00s\00e\00m\00b\00l\00y\00/\00i\00n\00t\00e\00g\00e\00r\00/\00s\00a\00f\00e\00/\00u\001\002\008\00.\00t\00s") + (data (i32.const 2540) "L") + (data (i32.const 2552) "\01\00\00\00:\00\00\00U\00n\00d\00e\00r\00f\00l\00o\00w\00 \00d\00u\00r\00i\00n\00g\00 \00s\00u\00b\00s\00t\00r\00a\00c\00t\00i\00o\00n") + (data (i32.const 2620) "L") + (data (i32.const 2632) "\01\00\00\00<\00\00\00O\00v\00e\00r\00f\00l\00o\00w\00 \00d\00u\00r\00i\00n\00g\00 \00m\00u\00l\00t\00i\00p\00l\00i\00c\00a\00t\00i\00o\00n") + (data (i32.const 2700) "L\01") + (data (i32.const 2716) "8\01\00\00\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff[O\a9\7fY\06\00\00\ff\ff\ff\ff\00\00\00\00\00\0c\08\03\00\00\00\00EQ(\00\00\00\00\00E\e0\04\00\00\00\00\00\ff\ff\00\00\00\00\00\00\a8J\00\00\00\00\00\00\db\1b\00\00\00\00\00\00o\0c\00\00\00\00\00\00Y\06\00\00\00\00\00\00\98\03\00\00\00\00\00\005\02\00\00\00\00\00\00r\01\00\00\00\00\00\00\ff\00\00\00\00\00\00\00\b8\00\00\00\00\00\00\00\8a\00\00\00\00\00\00\00j\00\00\00\00\00\00\00T\00\00\00\00\00\00\00D\00\00\00\00\00\00\008\00\00\00\00\00\00\00/\00\00\00\00\00\00\00(\00\00\00\00\00\00\00\"\00\00\00\00\00\00\00\1e\00\00\00\00\00\00\00\1a\00\00\00\00\00\00\00\17\00\00\00\00\00\00\00\15\00\00\00\00\00\00\00\13\00\00\00\00\00\00\00\11\00\00\00\00\00\00\00\0f\00\00\00\00\00\00\00\0e\00\00\00\00\00\00\00\0d\00\00\00\00\00\00\00\0c\00\00\00\00\00\00\00\0b\00\00\00\00\00\00\00\0b\00\00\00\00\00\00\00\n") + (data (i32.const 3036) ",") + (data (i32.const 3048) "\0f\00\00\00\10\00\00\00\a0\n\00\00\a0\n\00\008\01\00\00\'") + (data (i32.const 3084) "L") + (data (i32.const 3096) "\01\00\00\00<\00\00\00O\00v\00e\00r\00f\00l\00o\00w\00 \00d\00u\00r\00i\00n\00g\00 \00e\00x\00p\00o\00n\00e\00n\00t\00i\00a\00t\00i\00o\00n") + (data (i32.const 3164) "\\") + (data (i32.const 3176) "\01\00\00\00F\00\00\00O\00v\00e\00r\00f\00l\00o\00w\00 \00d\00u\00r\00i\00n\00g\00 \00p\00r\00e\00f\00i\00x\00 \00i\00n\00c\00r\00e\00m\00e\00n\00t\00i\00n\00g") + (data (i32.const 3260) "\\") + (data (i32.const 3272) "\01\00\00\00H\00\00\00U\00n\00d\00e\00r\00f\00l\00o\00w\00 \00d\00u\00r\00i\00n\00g\00 \00p\00r\00e\00f\00i\00x\00 \00d\00e\00c\00r\00e\00m\00e\00n\00t\00i\00n\00g") (export "i128" (global $assembly/integer/i128/i128)) (export "i128#get:lo" (func $assembly/integer/i128/i128#get:lo)) (export "i128#set:lo" (func $assembly/integer/i128/i128#set:lo)) @@ -109,6 +111,7 @@ (export "i128#pos" (func $assembly/integer/i128/i128#pos)) (export "i128#neg" (func $assembly/integer/i128/i128#neg)) (export "i128#toBytes" (func $assembly/integer/i128/i128#toBytes@varargs)) + (export "i128#toStaticBytes" (func $assembly/integer/i128/i128#toStaticBytes@varargs)) (export "i128#toUint8Array" (func $assembly/integer/i128/i128#toUint8Array@varargs)) (export "i128.get:Zero" (func $assembly/integer/i128/i128.get:Zero)) (export "i128.get:One" (func $assembly/integer/i128/i128.get:One)) @@ -181,6 +184,7 @@ (export "u128#toF64" (func $assembly/integer/u128/u128#toF64)) (export "u128#toF32" (func $assembly/integer/u128/u128#toF32)) (export "u128#toBytes" (func $assembly/integer/u128/u128#toBytes@varargs)) + (export "u128#toStaticBytes" (func $assembly/integer/u128/u128#toStaticBytes@varargs)) (export "u128#toUint8Array" (func $assembly/integer/u128/u128#toUint8Array@varargs)) (export "u128#clone" (func $assembly/integer/u128/u128.fromU256)) (export "u128#toString" (func $assembly/integer/u128/u128#toString@varargs)) @@ -268,6 +272,7 @@ (export "u256#toU32" (func $assembly/integer/u128/u128#toU32)) (export "u256#toBool" (func $assembly/integer/u256/u256#toBool)) (export "u256#toBytes" (func $assembly/integer/u256/u256#toBytes@varargs)) + (export "u256#toStaticBytes" (func $assembly/integer/u256/u256#toStaticBytes@varargs)) (export "u256#toUint8Array" (func $assembly/integer/u256/u256#toUint8Array@varargs)) (export "u256#clone" (func $assembly/integer/u256/u256.fromU256)) (export "u256#toString" (func $assembly/integer/u256/u256#toString@varargs)) @@ -318,6 +323,7 @@ (export "i128Safe#pos" (func $assembly/integer/i128/i128#pos)) (export "i128Safe#neg" (func $assembly/integer/i128/i128#neg)) (export "i128Safe#toBytes" (func $assembly/integer/i128/i128#toBytes@varargs)) + (export "i128Safe#toStaticBytes" (func $assembly/integer/i128/i128#toStaticBytes@varargs)) (export "i128Safe#toUint8Array" (func $assembly/integer/i128/i128#toUint8Array@varargs)) (export "i256Safe" (global $assembly/integer/safe/i256/i256)) (export "i256Safe#get:lo1" (func $assembly/integer/i256/i256#get:lo1)) @@ -363,6 +369,7 @@ (export "u128Safe#toF64" (func $assembly/integer/u128/u128#toF64)) (export "u128Safe#toF32" (func $assembly/integer/u128/u128#toF32)) (export "u128Safe#toBytes" (func $assembly/integer/u128/u128#toBytes@varargs)) + (export "u128Safe#toStaticBytes" (func $assembly/integer/u128/u128#toStaticBytes@varargs)) (export "u128Safe#toUint8Array" (func $assembly/integer/u128/u128#toUint8Array@varargs)) (export "u128Safe#clone" (func $assembly/integer/safe/u128/u128#clone)) (export "u128Safe#toString" (func $assembly/integer/u128/u128#toString@varargs)) @@ -441,6 +448,7 @@ (export "u256Safe#toU32" (func $assembly/integer/u128/u128#toU32)) (export "u256Safe#toBool" (func $assembly/integer/u256/u256#toBool)) (export "u256Safe#toBytes" (func $assembly/integer/u256/u256#toBytes@varargs)) + (export "u256Safe#toStaticBytes" (func $assembly/integer/u256/u256#toStaticBytes@varargs)) (export "u256Safe#toUint8Array" (func $assembly/integer/u256/u256#toUint8Array@varargs)) (export "u256Safe#clone" (func $assembly/integer/u256/u256.fromU256)) (export "u256Safe#toString" (func $assembly/integer/u256/u256#toString@varargs)) @@ -629,16 +637,17 @@ (local $2 i32) (local $3 i32) (local $4 i64) - (local $5 i64) - (local $6 i32) + (local $5 i32) + (local $6 i64) (local $7 i32) (local $8 i32) - (local $9 i64) + (local $9 i32) (local $10 i64) - (local $11 i32) + (local $11 i64) (local $12 i64) - (local $13 i64) + (local $13 i32) (local $14 i64) + (local $15 i64) i32.const 1 local.get $1 i32.const 36 @@ -662,52 +671,49 @@ i32.load offset=16 i32.const 1 i32.shr_u - local.tee $8 + local.tee $7 i32.eqz br_if $folding-inner0 - block $__inlined_func$~lib/string/String#charCodeAt (result i32) - i32.const -1 - local.get $0 - i32.const 20 - i32.sub - i32.load offset=16 - i32.const 1 - i32.shr_u - i32.eqz - br_if $__inlined_func$~lib/string/String#charCodeAt - drop + local.get $0 + i32.const 20 + i32.sub + i32.load offset=16 + i32.const 1 + i32.shr_u + if (result i32) local.get $0 i32.load16_u + else + i32.const -1 end local.tee $2 i32.const 48 i32.eq i32.const 0 - local.get $8 + local.get $7 i32.const 1 i32.eq select br_if $folding-inner0 - block $__inlined_func$~lib/string/String#charCodeAt1 (result i32) + local.get $2 + i32.const 45 + i32.eq + local.tee $13 + local.get $2 + i32.const 43 + i32.eq + i32.or + local.tee $3 + local.get $0 + i32.const 20 + i32.sub + i32.load offset=16 + i32.const 1 + i32.shr_u + i32.ge_u + if (result i32) i32.const -1 - local.get $2 - i32.const 45 - i32.eq - local.tee $11 - local.get $2 - i32.const 43 - i32.eq - i32.or - local.tee $3 - local.get $0 - i32.const 20 - i32.sub - i32.load offset=16 - i32.const 1 - i32.shr_u - i32.ge_u - br_if $__inlined_func$~lib/string/String#charCodeAt1 - drop + else local.get $0 local.get $3 i32.const 1 @@ -719,21 +725,20 @@ i32.eq if i32.const 1 - block $__inlined_func$~lib/string/String#charCodeAt3 (result i32) + local.get $3 + i32.const 1 + i32.add + local.tee $3 + local.get $0 + i32.const 20 + i32.sub + i32.load offset=16 + i32.const 1 + i32.shr_u + i32.ge_u + if (result i32) i32.const -1 - local.get $3 - i32.const 1 - i32.add - local.tee $3 - local.get $0 - i32.const 20 - i32.sub - i32.load offset=16 - i32.const 1 - i32.shr_u - i32.ge_u - br_if $__inlined_func$~lib/string/String#charCodeAt3 - drop + else local.get $0 local.get $3 i32.const 1 @@ -795,7 +800,7 @@ i64.const 0 i64.const 0 call $assembly/integer/u128/u128#constructor - local.set $2 + local.set $5 block $break|0 block $case3|0 block $case2|0 @@ -815,18 +820,17 @@ br $case3|0 end loop $do-continue|1 - block $__inlined_func$~lib/string/String#charCodeAt5 (result i32) + local.get $3 + local.get $0 + i32.const 20 + i32.sub + i32.load offset=16 + i32.const 1 + i32.shr_u + i32.ge_u + if (result i32) i32.const -1 - local.get $3 - local.get $0 - i32.const 20 - i32.sub - i32.load offset=16 - i32.const 1 - i32.shr_u - i32.ge_u - br_if $__inlined_func$~lib/string/String#charCodeAt5 - drop + else local.get $0 local.get $3 i32.const 1 @@ -836,17 +840,17 @@ end i32.const 48 i32.sub - local.tee $6 + local.tee $1 i32.const 2 i32.lt_u if i32.const 0 - local.get $2 + local.get $5 i64.load local.tee $4 i64.const 1 i64.shl - local.get $2 + local.get $5 i64.load offset=8 i64.const 1 i64.shl @@ -855,31 +859,31 @@ i64.shr_u i64.or call $assembly/integer/u128/u128#constructor - local.set $1 + local.set $2 i32.const 0 - local.get $6 + local.get $1 i64.extend_i32_u i64.const 0 call $assembly/integer/u128/u128#constructor - local.set $2 + local.set $1 i32.const 0 - local.get $1 - i64.load local.get $2 i64.load - i64.or local.get $1 - i64.load offset=8 + i64.load + i64.or local.get $2 i64.load offset=8 + local.get $1 + i64.load offset=8 i64.or call $assembly/integer/u128/u128#constructor - local.set $2 + local.set $5 local.get $3 i32.const 1 i32.add local.tee $3 - local.get $8 + local.get $7 i32.lt_s br_if $do-continue|1 end @@ -887,18 +891,17 @@ br $break|0 end loop $do-continue|2 - block $__inlined_func$~lib/string/String#charCodeAt7 (result i32) + local.get $3 + local.get $0 + i32.const 20 + i32.sub + i32.load offset=16 + i32.const 1 + i32.shr_u + i32.ge_u + if (result i32) i32.const -1 - local.get $3 - local.get $0 - i32.const 20 - i32.sub - i32.load offset=16 - i32.const 1 - i32.shr_u - i32.ge_u - br_if $__inlined_func$~lib/string/String#charCodeAt7 - drop + else local.get $0 local.get $3 i32.const 1 @@ -908,17 +911,17 @@ end i32.const 48 i32.sub - local.tee $6 + local.tee $1 i32.const 10 i32.lt_u if i32.const 0 - local.get $2 + local.get $5 i64.load local.tee $4 i64.const 3 i64.shl - local.get $2 + local.get $5 i64.load offset=8 i64.const 3 i64.shl @@ -927,14 +930,14 @@ i64.shr_u i64.or call $assembly/integer/u128/u128#constructor - local.set $1 + local.set $8 i32.const 0 - local.get $2 + local.get $5 i64.load local.tee $4 i64.const 1 i64.shl - local.get $2 + local.get $5 i64.load offset=8 i64.const 1 i64.shl @@ -945,56 +948,56 @@ call $assembly/integer/u128/u128#constructor local.set $2 i32.const 0 - local.get $1 + local.get $8 i64.load - local.tee $4 + local.tee $6 local.get $2 i64.load i64.add - local.tee $5 + local.tee $4 local.get $4 - local.get $5 - i64.gt_u + local.get $6 + i64.lt_u i64.extend_i32_u - local.get $1 + local.get $8 i64.load offset=8 local.get $2 i64.load offset=8 i64.add i64.add call $assembly/integer/u128/u128#constructor - local.set $1 + local.set $2 i32.const 0 - local.get $6 + local.get $1 i64.extend_i32_u i64.const 0 call $assembly/integer/u128/u128#constructor - local.set $2 + local.set $1 i32.const 0 - local.get $1 - i64.load - local.tee $4 local.get $2 i64.load + local.tee $6 + local.get $1 + i64.load i64.add - local.tee $5 + local.tee $4 local.get $4 - local.get $5 - i64.gt_u + local.get $6 + i64.lt_u i64.extend_i32_u - local.get $1 - i64.load offset=8 local.get $2 i64.load offset=8 + local.get $1 + i64.load offset=8 i64.add i64.add call $assembly/integer/u128/u128#constructor - local.set $2 + local.set $5 local.get $3 i32.const 1 i32.add local.tee $3 - local.get $8 + local.get $7 i32.lt_s br_if $do-continue|2 end @@ -1003,18 +1006,17 @@ end loop $do-continue|3 block $do-break|3 - block $__inlined_func$~lib/string/String#charCodeAt9 (result i32) + local.get $3 + local.get $0 + i32.const 20 + i32.sub + i32.load offset=16 + i32.const 1 + i32.shr_u + i32.ge_u + if (result i32) i32.const -1 - local.get $3 - local.get $0 - i32.const 20 - i32.sub - i32.load offset=16 - i32.const 1 - i32.shr_u - i32.ge_u - br_if $__inlined_func$~lib/string/String#charCodeAt9 - drop + else local.get $0 local.get $3 i32.const 1 @@ -1033,17 +1035,17 @@ i32.load i32.add i32.load8_u - local.tee $6 + local.tee $1 i32.const 16 i32.ge_u br_if $do-break|3 i32.const 0 - local.get $2 + local.get $5 i64.load local.tee $4 i64.const 4 i64.shl - local.get $2 + local.get $5 i64.load offset=8 i64.const 4 i64.shl @@ -1052,31 +1054,31 @@ i64.shr_u i64.or call $assembly/integer/u128/u128#constructor - local.set $1 + local.set $2 i32.const 0 - local.get $6 + local.get $1 i64.extend_i32_u i64.const 0 call $assembly/integer/u128/u128#constructor - local.set $2 + local.set $1 i32.const 0 - local.get $1 - i64.load local.get $2 i64.load - i64.or local.get $1 - i64.load offset=8 + i64.load + i64.or local.get $2 i64.load offset=8 + local.get $1 + i64.load offset=8 i64.or call $assembly/integer/u128/u128#constructor - local.set $2 + local.set $5 local.get $3 i32.const 1 i32.add local.tee $3 - local.get $8 + local.get $7 i32.lt_s br_if $do-continue|3 end @@ -1088,21 +1090,20 @@ i64.extend_i32_s i64.const 0 call $assembly/integer/u128/u128#constructor - local.set $6 + local.set $9 loop $do-continue|4 block $do-break|4 - block $__inlined_func$~lib/string/String#charCodeAt11 (result i32) + local.get $3 + local.get $0 + i32.const 20 + i32.sub + i32.load offset=16 + i32.const 1 + i32.shr_u + i32.ge_u + if (result i32) i32.const -1 - local.get $3 - local.get $0 - i32.const 20 - i32.sub - i32.load offset=16 - i32.const 1 - i32.shr_u - i32.ge_u - br_if $__inlined_func$~lib/string/String#charCodeAt11 - drop + else local.get $0 local.get $3 i32.const 1 @@ -1112,148 +1113,148 @@ end i32.const 48 i32.sub - local.tee $7 + local.tee $2 i32.const 74 i32.gt_u br_if $do-break|4 - local.get $7 + local.get $2 i32.const 1396 i32.load i32.add i32.load8_u - local.tee $7 + local.tee $2 local.get $1 i32.const 255 i32.and i32.ge_u br_if $do-break|4 - local.get $6 + local.get $9 i64.load - local.tee $4 + local.tee $10 i64.const 4294967295 i64.and - local.set $5 - local.get $2 + local.set $6 + local.get $5 i64.load - local.tee $10 + local.tee $11 i64.const 4294967295 i64.and - local.tee $9 - local.get $4 + local.tee $4 + local.get $10 i64.const 32 i64.shr_u - local.tee $12 + local.tee $14 i64.mul - local.get $5 - local.get $10 + local.get $6 + local.get $11 i64.const 32 i64.shr_u - local.tee $13 + local.tee $15 i64.mul - local.get $5 - local.get $9 + local.get $4 + local.get $6 i64.mul - local.tee $9 + local.tee $6 i64.const 32 i64.shr_u i64.add - local.tee $14 + local.tee $4 i64.const 4294967295 i64.and i64.add - local.set $5 - local.get $12 - local.get $13 - i64.mul + local.set $12 local.get $14 + local.get $15 + i64.mul + local.get $4 i64.const 32 i64.shr_u i64.add - local.get $2 + local.get $5 i64.load offset=8 - local.get $4 + local.get $10 i64.mul i64.add - local.get $10 - local.get $6 + local.get $11 + local.get $9 i64.load offset=8 i64.mul i64.add - local.get $5 + local.get $12 i64.const 32 i64.shr_u i64.add global.set $assembly/globals/__res128_hi i32.const 0 - local.get $9 + local.get $6 i64.const 4294967295 i64.and - local.get $5 + local.get $12 i64.const 32 i64.shl i64.or global.get $assembly/globals/__res128_hi call $assembly/integer/u128/u128#constructor - local.set $2 + local.set $8 i32.const 0 - local.get $7 + local.get $2 i64.extend_i32_u i64.const 0 call $assembly/integer/u128/u128#constructor - local.set $7 + local.set $2 i32.const 0 - local.get $2 + local.get $8 i64.load - local.tee $4 - local.get $7 + local.tee $6 + local.get $2 i64.load i64.add - local.tee $5 + local.tee $4 local.get $4 - local.get $5 - i64.gt_u + local.get $6 + i64.lt_u i64.extend_i32_u - local.get $2 + local.get $8 i64.load offset=8 - local.get $7 + local.get $2 i64.load offset=8 i64.add i64.add call $assembly/integer/u128/u128#constructor - local.set $2 + local.set $5 local.get $3 i32.const 1 i32.add local.tee $3 - local.get $8 + local.get $7 i32.lt_s br_if $do-continue|4 end end end - local.get $11 + local.get $13 if (result i32) i32.const 0 - local.get $2 + local.get $5 i64.load i64.const -1 i64.xor - local.tee $4 + local.tee $6 i64.const 1 i64.add - local.tee $5 + local.tee $4 local.get $4 - local.get $5 - i64.gt_u + local.get $6 + i64.lt_u i64.extend_i32_u - local.get $2 + local.get $5 i64.load offset=8 i64.const -1 i64.xor i64.add call $assembly/integer/u128/u128#constructor else - local.get $2 + local.get $5 end return end @@ -1364,11 +1365,9 @@ i32.load offset=8 i32.const 15 i32.and - i32.eqz else - i32.const 0 + i32.const 1 end - i32.eqz if i32.const 0 i32.const 1440 @@ -1395,11 +1394,9 @@ i32.load offset=8 i32.const 15 i32.and - i32.eqz else - i32.const 0 + i32.const 1 end - i32.eqz if i32.const 0 i32.const 1440 @@ -1471,16 +1468,16 @@ ) (func $assembly/integer/i128/i128.isEmpty (param $0 i32) (result i32) local.get $0 - if (result i32) + if (result i64) local.get $0 i64.load local.get $0 i64.load offset=8 i64.or - i64.eqz else - i32.const 1 + i64.const 0 end + i64.eqz ) (func $assembly/integer/i128/i128.or (param $0 i32) (param $1 i32) (result i32) i32.const 0 @@ -2238,6 +2235,27 @@ i32.store offset=12 local.get $1 ) + (func $~lib/staticarray/StaticArray#constructor (param $0 i32) (result i32) + (local $1 i32) + local.get $0 + i32.const 1073741820 + i32.gt_u + if + i32.const 1520 + i32.const 1616 + i32.const 88 + i32.const 60 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 9 + call $~lib/rt/stub/__new + local.tee $1 + local.get $0 + call $~lib/memory/memory.fill + local.get $1 + ) (func $~lib/arraybuffer/ArrayBufferView#constructor (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $0 @@ -2262,7 +2280,7 @@ i32.gt_u if i32.const 1520 - i32.const 1616 + i32.const 1680 i32.const 18 i32.const 57 call $~lib/builtins/abort @@ -2414,14 +2432,12 @@ i32.load offset=8 i32.const 15 i32.and - i32.eqz else - i32.const 0 + i32.const 1 end - i32.eqz if i32.const 0 - i32.const 1680 + i32.const 1744 i32.const 132 i32.const 5 call $~lib/builtins/abort @@ -2445,14 +2461,12 @@ i32.load offset=8 i32.const 15 i32.and - i32.eqz else - i32.const 0 + i32.const 1 end - i32.eqz if i32.const 0 - i32.const 1680 + i32.const 1744 i32.const 143 i32.const 5 call $~lib/builtins/abort @@ -2517,16 +2531,16 @@ ) (func $assembly/integer/u128/u128.isEmpty (param $0 i32) (result i32) local.get $0 - if (result i32) + if (result i64) local.get $0 i64.load local.get $0 i64.load offset=8 i64.or - i64.eqz else - i32.const 1 + i64.const 0 end + i64.eqz ) (func $assembly/integer/u128/u128.or (param $0 i32) (param $1 i32) (result i32) i32.const 0 @@ -3453,8 +3467,8 @@ i32.const 128 i32.eq if - i32.const 1760 i32.const 1824 + i32.const 1888 i32.const 190 i32.const 5 call $~lib/builtins/abort @@ -6872,13 +6886,13 @@ (func $~lib/string/String#charAt (param $0 i32) (result i32) (local $1 i32) local.get $0 - i32.const 2060 + i32.const 2124 i32.load i32.const 1 i32.shr_u i32.ge_u if - i32.const 2032 + i32.const 2096 return end i32.const 2 @@ -6888,7 +6902,7 @@ local.get $0 i32.const 1 i32.shl - i32.const 2064 + i32.const 2128 i32.add i32.load16_u i32.store16 @@ -7867,7 +7881,7 @@ local.tee $2 i32.eqz if - i32.const 2032 + i32.const 2096 return end local.get $2 @@ -7891,8 +7905,8 @@ i32.load offset=8 i32.ge_u if - i32.const 2128 i32.const 2192 + i32.const 2256 i32.const 24 i32.const 45 call $~lib/builtins/abort @@ -7910,8 +7924,8 @@ i32.load offset=8 i32.ge_u if - i32.const 2128 i32.const 2192 + i32.const 2256 i32.const 35 i32.const 45 call $~lib/builtins/abort @@ -7961,10 +7975,7 @@ i32.const 3 i32.mul i32.add - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set local.get $2 i32.const 1 @@ -7985,10 +7996,9 @@ local.get $0 local.get $2 call $~lib/typedarray/Int8Array#__get - i32.const 25 + i32.const 1 i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set local.get $2 local.get $3 @@ -8008,10 +8018,7 @@ i32.const 15 i32.gt_s i32.or - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set end local.get $0 @@ -8043,10 +8050,7 @@ i64.const 0 i64.ne i32.add - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set local.get $4 i32.const 1 @@ -8174,14 +8178,12 @@ i32.load offset=12 i32.const 31 i32.and - i32.eqz else - i32.const 0 + i32.const 1 end - i32.eqz if i32.const 0 - i32.const 2256 + i32.const 2320 i32.const 81 i32.const 5 call $~lib/builtins/abort @@ -8209,14 +8211,12 @@ i32.load offset=12 i32.const 31 i32.and - i32.eqz else - i32.const 0 + i32.const 1 end - i32.eqz if i32.const 0 - i32.const 2256 + i32.const 2320 i32.const 94 i32.const 5 call $~lib/builtins/abort @@ -8339,14 +8339,12 @@ i32.load offset=8 i32.const 31 i32.and - i32.eqz else - i32.const 0 + i32.const 1 end - i32.eqz if i32.const 0 - i32.const 2256 + i32.const 2320 i32.const 106 i32.const 5 call $~lib/builtins/abort @@ -8374,14 +8372,12 @@ i32.load offset=8 i32.const 31 i32.and - i32.eqz else - i32.const 0 + i32.const 1 end - i32.eqz if i32.const 0 - i32.const 2256 + i32.const 2320 i32.const 118 i32.const 5 call $~lib/builtins/abort @@ -8527,7 +8523,7 @@ ) (func $assembly/integer/u256/u256.isEmpty (param $0 i32) (result i32) local.get $0 - if (result i32) + if (result i64) local.get $0 i64.load offset=24 local.get $0 @@ -8539,10 +8535,10 @@ i64.or i64.or i64.or - i64.eqz else - i32.const 1 + i64.const 0 end + i64.eqz ) (func $assembly/integer/u256/u256.add (param $0 i32) (param $1 i32) (result i32) (local $2 i64) @@ -9225,90 +9221,84 @@ i64.load offset=24 i64.const 0 i64.ne - if (result i32) + if (result i64) local.get $0 i64.load offset=24 i64.clz - i32.wrap_i64 else local.get $0 i64.load offset=16 i64.const 0 i64.ne - if (result i32) + if (result i64) local.get $0 i64.load offset=16 i64.clz i64.const -64 i64.sub - i32.wrap_i64 else local.get $0 i64.load offset=8 i64.const 0 i64.ne - if (result i32) + if (result i64) local.get $0 i64.load offset=8 i64.clz i64.const 128 i64.add - i32.wrap_i64 else local.get $0 i64.load i64.clz i64.const 192 i64.add - i32.wrap_i64 end end end + i32.wrap_i64 ) (func $assembly/integer/u256/u256.ctz (param $0 i32) (result i32) local.get $0 i64.load i64.const 0 i64.ne - if (result i32) + if (result i64) local.get $0 i64.load i64.ctz - i32.wrap_i64 else local.get $0 i64.load offset=8 i64.const 0 i64.ne - if (result i32) + if (result i64) local.get $0 i64.load offset=8 i64.ctz i64.const -64 i64.sub - i32.wrap_i64 else local.get $0 i64.load offset=16 i64.const 0 i64.ne - if (result i32) + if (result i64) local.get $0 i64.load offset=16 i64.ctz i64.const 128 i64.add - i32.wrap_i64 else local.get $0 i64.load offset=24 i64.ctz i64.const 192 i64.add - i32.wrap_i64 end end end + i32.wrap_i64 ) (func $assembly/integer/u256/u256#get:hi1 (param $0 i32) (result i64) local.get $0 @@ -9838,7 +9828,7 @@ ) (func $assembly/integer/safe/u128/u128.get:Zero (result i32) i32.const 16 - i32.const 12 + i32.const 13 call $~lib/rt/stub/__new i64.const 0 i64.const 0 @@ -9846,7 +9836,7 @@ ) (func $assembly/integer/safe/u128/u128.get:One (result i32) i32.const 16 - i32.const 12 + i32.const 13 call $~lib/rt/stub/__new i64.const 1 i64.const 0 @@ -9854,7 +9844,7 @@ ) (func $assembly/integer/safe/u128/u128.get:Max (result i32) i32.const 16 - i32.const 12 + i32.const 13 call $~lib/rt/stub/__new i64.const -1 i64.const -1 @@ -10024,15 +10014,15 @@ local.get $4 i64.lt_u if - i32.const 2336 - i32.const 2416 + i32.const 2400 + i32.const 2480 i32.const 232 i32.const 7 call $~lib/builtins/abort unreachable end i32.const 16 - i32.const 12 + i32.const 13 call $~lib/rt/stub/__new local.get $3 local.get $2 @@ -10060,8 +10050,8 @@ i64.lt_u end if - i32.const 2496 - i32.const 2416 + i32.const 2560 + i32.const 2480 i32.const 239 i32.const 16 call $~lib/builtins/abort @@ -10102,19 +10092,19 @@ i64.load offset=8 i64.or i64.eqz - if (result i32) - i32.const 1 + if (result i64) + i64.const 0 else local.get $1 i64.load local.get $1 i64.load offset=8 i64.or - i64.eqz end + i64.eqz if i32.const 16 - i32.const 12 + i32.const 13 call $~lib/rt/stub/__new i64.const 0 i64.const 0 @@ -10178,8 +10168,8 @@ i32.const 127 i32.lt_u if - i32.const 2576 - i32.const 2416 + i32.const 2640 + i32.const 2480 i32.const 252 i32.const 7 call $~lib/builtins/abort @@ -10279,8 +10269,8 @@ i64.shr_u i32.wrap_i64 if - i32.const 2576 - i32.const 2416 + i32.const 2640 + i32.const 2480 i32.const 260 i32.const 9 call $~lib/builtins/abort @@ -10346,8 +10336,8 @@ i64.gt_u end if - i32.const 2576 - i32.const 2416 + i32.const 2640 + i32.const 2480 i32.const 269 i32.const 11 call $~lib/builtins/abort @@ -10538,11 +10528,11 @@ end end local.get $1 - i32.const 3004 + i32.const 3068 i32.load i32.ge_u if - i32.const 2128 + i32.const 2192 i32.const 1568 i32.const 99 i32.const 42 @@ -10550,7 +10540,7 @@ unreachable end local.get $3 - i32.const 2996 + i32.const 3060 i32.load local.get $1 i32.const 3 @@ -10560,8 +10550,8 @@ i64.gt_u end if - i32.const 3040 - i32.const 2416 + i32.const 3104 + i32.const 2480 i32.const 287 i32.const 7 call $~lib/builtins/abort @@ -10592,8 +10582,8 @@ i64.const -1 i64.eq if - i32.const 3120 - i32.const 2416 + i32.const 3184 + i32.const 2480 i32.const 198 i32.const 7 call $~lib/builtins/abort @@ -10628,8 +10618,8 @@ i64.or i64.eqz if - i32.const 3216 - i32.const 2416 + i32.const 3280 + i32.const 2480 i32.const 207 i32.const 7 call $~lib/builtins/abort @@ -10664,7 +10654,7 @@ i64.load offset=8 local.set $2 i32.const 16 - i32.const 12 + i32.const 13 call $~lib/rt/stub/__new local.get $1 local.get $2 @@ -10681,7 +10671,7 @@ i64.load offset=8 local.set $2 i32.const 16 - i32.const 12 + i32.const 13 call $~lib/rt/stub/__new local.get $1 local.get $2 @@ -10698,7 +10688,7 @@ i64.load offset=8 local.set $2 i32.const 16 - i32.const 12 + i32.const 13 call $~lib/rt/stub/__new local.get $1 local.get $2 @@ -10813,9 +10803,228 @@ i64.load offset=8 i64.store offset=8 end - local.get $4 + local.get $4 + ) + (func $assembly/integer/i128/i128#toStaticBytes@varargs (param $0 i32) (param $1 i32) (result i32) + (local $2 i64) + (local $3 i32) + block $1of1 + block $0of1 + block $outOfRange + global.get $~argumentsLength + br_table $0of1 $1of1 $outOfRange + end + unreachable + end + i32.const 0 + local.set $1 + end + i32.const 16 + call $~lib/staticarray/StaticArray#constructor + local.set $3 + local.get $1 + if + local.get $3 + local.get $0 + i64.load offset=8 + local.tee $2 + i64.const 8 + i64.shr_u + i64.const 71777214294589695 + i64.and + local.get $2 + i64.const 71777214294589695 + i64.and + i64.const 8 + i64.shl + i64.or + local.tee $2 + i64.const 16 + i64.shr_u + i64.const 281470681808895 + i64.and + local.get $2 + i64.const 281470681808895 + i64.and + i64.const 16 + i64.shl + i64.or + i64.const 32 + i64.rotr + i64.store + local.get $3 + local.get $0 + i64.load + local.tee $2 + i64.const 8 + i64.shr_u + i64.const 71777214294589695 + i64.and + local.get $2 + i64.const 71777214294589695 + i64.and + i64.const 8 + i64.shl + i64.or + local.tee $2 + i64.const 16 + i64.shr_u + i64.const 281470681808895 + i64.and + local.get $2 + i64.const 281470681808895 + i64.and + i64.const 16 + i64.shl + i64.or + i64.const 32 + i64.rotr + i64.store offset=8 + else + local.get $3 + local.get $0 + i64.load + i64.store + local.get $3 + local.get $0 + i64.load offset=8 + i64.store offset=8 + end + local.get $3 + ) + (func $assembly/integer/i128/i128#toUint8Array@varargs (param $0 i32) (param $1 i32) (result i32) + (local $2 i64) + (local $3 i32) + (local $4 i32) + block $1of1 + block $0of1 + block $outOfRange + global.get $~argumentsLength + br_table $0of1 $1of1 $outOfRange + end + unreachable + end + i32.const 0 + local.set $1 + end + i32.const 12 + i32.const 8 + call $~lib/rt/stub/__new + i32.const 16 + call $~lib/arraybuffer/ArrayBufferView#constructor + local.tee $4 + i32.load offset=4 + local.set $3 + local.get $1 + if + local.get $3 + local.get $0 + i64.load offset=8 + local.tee $2 + i64.const 8 + i64.shr_u + i64.const 71777214294589695 + i64.and + local.get $2 + i64.const 71777214294589695 + i64.and + i64.const 8 + i64.shl + i64.or + local.tee $2 + i64.const 16 + i64.shr_u + i64.const 281470681808895 + i64.and + local.get $2 + i64.const 281470681808895 + i64.and + i64.const 16 + i64.shl + i64.or + i64.const 32 + i64.rotr + i64.store + local.get $3 + local.get $0 + i64.load + local.tee $2 + i64.const 8 + i64.shr_u + i64.const 71777214294589695 + i64.and + local.get $2 + i64.const 71777214294589695 + i64.and + i64.const 8 + i64.shl + i64.or + local.tee $2 + i64.const 16 + i64.shr_u + i64.const 281470681808895 + i64.and + local.get $2 + i64.const 281470681808895 + i64.and + i64.const 16 + i64.shl + i64.or + i64.const 32 + i64.rotr + i64.store offset=8 + else + local.get $3 + local.get $0 + i64.load + i64.store + local.get $3 + local.get $0 + i64.load offset=8 + i64.store offset=8 + end + local.get $4 + ) + (func $assembly/integer/i128/i128.fromString@varargs (param $0 i32) (param $1 i32) (result i32) + block $1of1 + block $0of1 + block $outOfRange + global.get $~argumentsLength + i32.const 1 + i32.sub + br_table $0of1 $1of1 $outOfRange + end + unreachable + end + i32.const 10 + local.set $1 + end + local.get $0 + local.get $1 + call $assembly/utils/atou128 ) - (func $assembly/integer/i128/i128#toUint8Array@varargs (param $0 i32) (param $1 i32) (result i32) + (func $assembly/integer/u128/u128#constructor@varargs (param $0 i32) (param $1 i64) (param $2 i64) (result i32) + block $2of2 + block $1of2 + block $0of2 + block $outOfRange + global.get $~argumentsLength + br_table $0of2 $1of2 $2of2 $outOfRange + end + unreachable + end + i64.const 0 + local.set $1 + end + i64.const 0 + local.set $2 + end + local.get $0 + local.get $1 + local.get $2 + call $assembly/integer/u128/u128#constructor + ) + (func $assembly/integer/u128/u128#toBytes@varargs (param $0 i32) (param $1 i32) (result i32) (local $2 i64) (local $3 i32) (local $4 i32) @@ -10830,11 +11039,8 @@ i32.const 0 local.set $1 end - i32.const 12 - i32.const 8 - call $~lib/rt/stub/__new i32.const 16 - call $~lib/arraybuffer/ArrayBufferView#constructor + call $~lib/array/Array#constructor local.tee $4 i32.load offset=4 local.set $3 @@ -10908,49 +11114,9 @@ end local.get $4 ) - (func $assembly/integer/i128/i128.fromString@varargs (param $0 i32) (param $1 i32) (result i32) - block $1of1 - block $0of1 - block $outOfRange - global.get $~argumentsLength - i32.const 1 - i32.sub - br_table $0of1 $1of1 $outOfRange - end - unreachable - end - i32.const 10 - local.set $1 - end - local.get $0 - local.get $1 - call $assembly/utils/atou128 - ) - (func $assembly/integer/u128/u128#constructor@varargs (param $0 i32) (param $1 i64) (param $2 i64) (result i32) - block $2of2 - block $1of2 - block $0of2 - block $outOfRange - global.get $~argumentsLength - br_table $0of2 $1of2 $2of2 $outOfRange - end - unreachable - end - i64.const 0 - local.set $1 - end - i64.const 0 - local.set $2 - end - local.get $0 - local.get $1 - local.get $2 - call $assembly/integer/u128/u128#constructor - ) - (func $assembly/integer/u128/u128#toBytes@varargs (param $0 i32) (param $1 i32) (result i32) + (func $assembly/integer/u128/u128#toStaticBytes@varargs (param $0 i32) (param $1 i32) (result i32) (local $2 i64) (local $3 i32) - (local $4 i32) block $1of1 block $0of1 block $outOfRange @@ -10963,9 +11129,7 @@ local.set $1 end i32.const 16 - call $~lib/array/Array#constructor - local.tee $4 - i32.load offset=4 + call $~lib/staticarray/StaticArray#constructor local.set $3 local.get $1 if @@ -11035,7 +11199,7 @@ i64.load offset=8 i64.store offset=8 end - local.get $4 + local.get $3 ) (func $assembly/integer/u128/u128#toUint8Array@varargs (param $0 i32) (param $1 i32) (result i32) (local $2 i64) @@ -11160,9 +11324,9 @@ select i32.eqz if - i32.const 1888 - i32.const 1680 - i32.const 916 + i32.const 1952 + i32.const 1744 + i32.const 929 i32.const 5 call $~lib/builtins/abort unreachable @@ -11175,11 +11339,11 @@ i64.or i64.eqz if - i32.const 2000 + i32.const 2064 local.set $0 br $__inlined_func$assembly/integer/u128/u128#toString end - i32.const 2032 + i32.const 2096 local.set $1 local.get $0 call $assembly/integer/u128/u128#clone@virtual @@ -11300,7 +11464,7 @@ i32.const 0 local.set $1 i32.const 12 - i32.const 9 + i32.const 10 call $~lib/rt/stub/__new i32.const 40 call $~lib/arraybuffer/ArrayBufferView#constructor @@ -11312,7 +11476,7 @@ local.get $0 i64.load call $assembly/utils/processU64 - i32.const 2032 + i32.const 2096 local.set $0 i32.const 39 local.set $3 @@ -11539,6 +11703,159 @@ end local.get $4 ) + (func $assembly/integer/u256/u256#toStaticBytes@varargs (param $0 i32) (param $1 i32) (result i32) + (local $2 i64) + (local $3 i32) + (local $4 i32) + block $1of1 + block $0of1 + block $outOfRange + global.get $~argumentsLength + br_table $0of1 $1of1 $outOfRange + end + unreachable + end + i32.const 0 + local.set $1 + end + i32.const 32 + call $~lib/staticarray/StaticArray#constructor + local.tee $4 + local.set $3 + local.get $1 + if + local.get $3 + local.get $0 + i64.load offset=24 + local.tee $2 + i64.const 8 + i64.shr_u + i64.const 71777214294589695 + i64.and + local.get $2 + i64.const 71777214294589695 + i64.and + i64.const 8 + i64.shl + i64.or + local.tee $2 + i64.const 16 + i64.shr_u + i64.const 281470681808895 + i64.and + local.get $2 + i64.const 281470681808895 + i64.and + i64.const 16 + i64.shl + i64.or + i64.const 32 + i64.rotr + i64.store + local.get $3 + local.get $0 + i64.load offset=16 + local.tee $2 + i64.const 8 + i64.shr_u + i64.const 71777214294589695 + i64.and + local.get $2 + i64.const 71777214294589695 + i64.and + i64.const 8 + i64.shl + i64.or + local.tee $2 + i64.const 16 + i64.shr_u + i64.const 281470681808895 + i64.and + local.get $2 + i64.const 281470681808895 + i64.and + i64.const 16 + i64.shl + i64.or + i64.const 32 + i64.rotr + i64.store offset=8 + local.get $3 + local.get $0 + i64.load offset=8 + local.tee $2 + i64.const 8 + i64.shr_u + i64.const 71777214294589695 + i64.and + local.get $2 + i64.const 71777214294589695 + i64.and + i64.const 8 + i64.shl + i64.or + local.tee $2 + i64.const 16 + i64.shr_u + i64.const 281470681808895 + i64.and + local.get $2 + i64.const 281470681808895 + i64.and + i64.const 16 + i64.shl + i64.or + i64.const 32 + i64.rotr + i64.store offset=16 + local.get $3 + local.get $0 + i64.load + local.tee $2 + i64.const 8 + i64.shr_u + i64.const 71777214294589695 + i64.and + local.get $2 + i64.const 71777214294589695 + i64.and + i64.const 8 + i64.shl + i64.or + local.tee $2 + i64.const 16 + i64.shr_u + i64.const 281470681808895 + i64.and + local.get $2 + i64.const 281470681808895 + i64.and + i64.const 16 + i64.shl + i64.or + i64.const 32 + i64.rotr + i64.store offset=24 + else + local.get $3 + local.get $0 + i64.load + i64.store + local.get $3 + local.get $0 + i64.load offset=8 + i64.store offset=8 + local.get $3 + local.get $0 + i64.load offset=16 + i64.store offset=16 + local.get $3 + local.get $0 + i64.load offset=24 + i64.store offset=24 + end + local.get $4 + ) (func $assembly/integer/u256/u256#toUint8Array@varargs (param $0 i32) (param $1 i32) (result i32) (local $2 i64) (local $3 i32) @@ -11721,9 +12038,9 @@ select i32.eqz if - i32.const 1888 - i32.const 2256 - i32.const 620 + i32.const 1952 + i32.const 2320 + i32.const 633 i32.const 5 call $~lib/builtins/abort unreachable @@ -11742,11 +12059,11 @@ i64.or i64.eqz if - i32.const 2000 + i32.const 2064 local.set $0 br $__inlined_func$assembly/integer/u256/u256#toString end - i32.const 2032 + i32.const 2096 local.set $1 i32.const 0 local.get $0 @@ -11768,45 +12085,42 @@ i64.load offset=24 i64.const 0 i64.ne - if (result i32) + if (result i64) local.get $3 i64.load offset=24 i64.clz - i32.wrap_i64 else local.get $3 i64.load offset=16 i64.const 0 i64.ne - if (result i32) + if (result i64) local.get $3 i64.load offset=16 i64.clz i64.const -64 i64.sub - i32.wrap_i64 else local.get $3 i64.load offset=8 i64.const 0 i64.ne - if (result i32) + if (result i64) local.get $3 i64.load offset=8 i64.clz i64.const 128 i64.add - i32.wrap_i64 else local.get $3 i64.load i64.clz i64.const 192 i64.add - i32.wrap_i64 end end end + i32.wrap_i64 i32.const -4 i32.and i32.sub @@ -11842,7 +12156,7 @@ i32.const 0 local.set $2 i32.const 12 - i32.const 9 + i32.const 10 call $~lib/rt/stub/__new i32.const 78 call $~lib/arraybuffer/ArrayBufferView#constructor @@ -11862,7 +12176,7 @@ local.get $0 i64.load call $assembly/utils/processU64 - i32.const 2032 + i32.const 2096 local.set $0 i32.const 77 local.set $1 @@ -11925,7 +12239,7 @@ local.get $0 else i32.const 16 - i32.const 10 + i32.const 11 call $~lib/rt/stub/__new end local.get $1 @@ -11961,7 +12275,7 @@ local.get $0 else i32.const 32 - i32.const 11 + i32.const 12 call $~lib/rt/stub/__new end local.get $1 @@ -11991,7 +12305,7 @@ local.get $0 else i32.const 16 - i32.const 12 + i32.const 13 call $~lib/rt/stub/__new end local.get $1 @@ -12027,7 +12341,7 @@ local.get $0 else i32.const 32 - i32.const 13 + i32.const 14 call $~lib/rt/stub/__new end local.get $1 @@ -12041,7 +12355,7 @@ i32.const 8 i32.sub i32.load - i32.const 12 + i32.const 13 i32.eq if local.get $0 @@ -12062,7 +12376,7 @@ i32.const 8 i32.sub i32.load - i32.const 12 + i32.const 13 i32.eq if local.get $0 @@ -12095,7 +12409,7 @@ i32.const 8 i32.sub i32.load - i32.const 12 + i32.const 13 i32.eq if local.get $0 @@ -12126,7 +12440,7 @@ global.set $~argumentsLength ) (func $~start - i32.const 3292 + i32.const 3356 global.set $~lib/rt/stub/offset ) ) diff --git a/package.json b/package.json index 13c3191..3051922 100644 --- a/package.json +++ b/package.json @@ -32,11 +32,9 @@ "test:ci": "asp 2> /dev/null" }, "devDependencies": { - "@as-pect/cli": "^6.1.1", - "@types/node": "^15.0.1", - "assemblyscript": "^0.18.31", - "ts-node": "^9.1.1", - "typescript": "^4.2.4" + "@as-pect/cli": "^6.2.0", + "assemblyscript": "^0.19.3", + "typescript": "^4.3.4" }, "files": [ "assembly/", diff --git a/yarn.lock b/yarn.lock index 0eeea3f..e3eb399 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,90 +2,131 @@ # yarn lockfile v1 -"@as-pect/assembly@^6.1.0": - version "6.1.0" - resolved "https://registry.yarnpkg.com/@as-pect/assembly/-/assembly-6.1.0.tgz#17a9a872a8cc3a003e449d2bc29566b7d4d1bc82" - integrity sha512-N8bxUjIOfT6rK1HEA6tpe8Mb9pR2lG4QzgkD8PwS9gzsnE9XoQyGN8MDI5VH9tmgQZlmNUZRXkbn7JnExWSzqQ== - -"@as-pect/cli@^6.1.1": - version "6.1.1" - resolved "https://registry.yarnpkg.com/@as-pect/cli/-/cli-6.1.1.tgz#35c57b3afde3e961d6891f0b9bb223206243c148" - integrity sha512-DXn+0Iktrfu11h4Z8sVuagEmCrO2uMhC0ovND3L2G+mF0ruC/Nh2tKzFBzkMqPai5HB6GfLQ0leKY9KwDn9pSA== +"@as-covers/assembly@^0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@as-covers/assembly/-/assembly-0.1.0.tgz#e1d9961492f946f3ac6419e1563f94252a89aa25" + integrity sha512-/HC8MMKkqnSw2Vwj2Fh5Z/sdD+5k2095hYTh83cT7rhhi1uWEg4VJlqA+gHIQ0Bwi4TWcQ120Ht0Y7SiVhLbzQ== + +"@as-covers/core@0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@as-covers/core/-/core-0.1.1.tgz#5a5ca5a318667fba96818da3f86bb2cf31d28db3" + integrity sha512-vik1U5pzzy7SpLUbU6bzhEYSZzIPGxlzmHpDUU+C3bIDolzceObXhrEQFRf1VxkbAtdeqDEFA8usM0T2xrRVCA== dependencies: - "@as-pect/assembly" "^6.1.0" - "@as-pect/core" "^6.1.1" - chalk "^4.1.0" - glob "^7.1.6" + "@as-covers/assembly" "^0.1.0" + "@as-covers/glue" "^0.1.0" + "@as-covers/transform" "^0.1.1" + +"@as-covers/glue@^0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@as-covers/glue/-/glue-0.1.0.tgz#13047680c86f318063a25932b20e79a6ab9c6535" + integrity sha512-BU4IMaYGRYTyiZ75hbar2SdcphInJpTlbJJA3GTAotS6So4N0lJ/kIZtn/9Hwn3dlUBlOCR3+HEghgoP9NMp5g== + dependencies: + csv-stringify "^5.6.2" + table "^6.7.1" + +"@as-covers/transform@^0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@as-covers/transform/-/transform-0.1.1.tgz#55aff0787db216a8991dcb7128a7c9bbafe7d72d" + integrity sha512-6r59rFwMZuK180Ixgzz24rA5afKT1I5piB4udcNVmYyM+Ki0KypSuK2UFO8wEXeVq8214N1SEmrtCt2fjppIww== + dependencies: + line-column "^1.0.2" + visitor-as "^0.6.0" + +"@as-pect/assembly@^6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@as-pect/assembly/-/assembly-6.2.0.tgz#29a0efa173df321354b76d92228e46944159ba95" + integrity sha512-jYr1jdlr0xNndIhOpTMBaPHmlhD/c3PcVCzow8wIkzLxgcSOzhBkqjip+LWPWGsiFK1vsZ8ZUaMTeK3fcnXQhw== + +"@as-pect/cli@^6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@as-pect/cli/-/cli-6.2.0.tgz#df28e813dfef8e0565dd9b7e32bd481a59f7a02d" + integrity sha512-3dR2rKAm9a9o/h4pqbNMnm/gK9o6VK4Jt+ls884znSxTxIUDdUHzwquxseluutpdgqHgKc28jN7DiWu1RYwXSA== + dependencies: + "@as-covers/core" "0.1.1" + "@as-pect/assembly" "^6.2.0" + "@as-pect/core" "^6.2.0" + chalk "^4.1.1" + glob "^7.1.7" optionalDependencies: - "@as-pect/csv-reporter" "^6.1.1" - "@as-pect/json-reporter" "^6.1.1" + "@as-pect/csv-reporter" "^6.2.0" + "@as-pect/json-reporter" "^6.2.0" -"@as-pect/core@^6.1.1": - version "6.1.1" - resolved "https://registry.yarnpkg.com/@as-pect/core/-/core-6.1.1.tgz#4b52b78df8084829d5f6ef08291b5855beec4fb2" - integrity sha512-hjP2JLIK87sS3zz6RaIeFG12lq6itA/RgYTMoG2KqhoVWiE+WOm6vXy9LUJRoeDUiS8pq+MHpr4ERUkNFxMNqg== +"@as-pect/core@^6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@as-pect/core/-/core-6.2.0.tgz#aee39afbc59c843d85066b0ba497e2f9ffb3341e" + integrity sha512-UGudVCUvMHAxsTVuXyNlKuGm9MFfcx6JJo3Pz53p29t44alfiX5T5K6zovERPSMp/x43g32Rc+5fRA6SKkUMRQ== dependencies: - "@as-pect/assembly" "^6.1.0" - "@as-pect/snapshots" "^6.1.0" - chalk "^4.1.0" + "@as-pect/assembly" "^6.2.0" + "@as-pect/snapshots" "^6.2.0" + chalk "^4.1.1" long "^4.0.0" -"@as-pect/csv-reporter@^6.1.1": - version "6.1.1" - resolved "https://registry.yarnpkg.com/@as-pect/csv-reporter/-/csv-reporter-6.1.1.tgz#d90be23be425d915dc3ee3cb7d466d1c5e8d13f1" - integrity sha512-pVfUbSw6BJ98P9OL8hynE7rtcBKtBvLKd3o8h8244S005babw2ZsD+84TrQVC58NWY7FLC/9faXtEJLn0bDClg== +"@as-pect/csv-reporter@^6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@as-pect/csv-reporter/-/csv-reporter-6.2.0.tgz#fee4140a0ea6dec3ff1af993f6096093615fd8ea" + integrity sha512-8l/n7bO/QLLkJkxpJYN270QFEtFVIa9hsd9cWSQLFdmDJygwfWmBTsuJW8jYloE0x0saTvD5NGIEX8xlNu4NrQ== dependencies: - "@as-pect/core" "^6.1.1" + "@as-pect/core" "^6.2.0" -"@as-pect/json-reporter@^6.1.1": - version "6.1.1" - resolved "https://registry.yarnpkg.com/@as-pect/json-reporter/-/json-reporter-6.1.1.tgz#63dcf4eb8cedea4ce0e0d2be3296fbbe1667bfa2" - integrity sha512-9eTQPA8uu7dliMKli076x5Jq+azVu6ymVq+J+ZPdfnan3djNDJ4uPUdmIFVBFoYOjg03eLwwPkjYKGbQGotk/g== +"@as-pect/json-reporter@^6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@as-pect/json-reporter/-/json-reporter-6.2.0.tgz#7f5a6253ce1415cd927044b112f65039bfe417c0" + integrity sha512-QjZfaf/d+Pk9rxt0Mq/inBsOLW0fSpmmru7JTFKX/rvHkBKv9jQxQiMdIMkdXjo47gchHlWotH9Eu1odfpZmzw== dependencies: - "@as-pect/core" "^6.1.1" + "@as-pect/core" "^6.2.0" -"@as-pect/snapshots@^6.1.0": - version "6.1.0" - resolved "https://registry.yarnpkg.com/@as-pect/snapshots/-/snapshots-6.1.0.tgz#bd5f7ba4ff0ae3df4ff5991de9410f0302875a28" - integrity sha512-8N5T5lDHl11SrwX3O0C+wayYmfzdVbPEt7vdLyig3FT4/suBLP6jBf3FGbYMhNwxio1iNraSrY/PsfGJc3M8pQ== +"@as-pect/snapshots@^6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@as-pect/snapshots/-/snapshots-6.2.0.tgz#7c4d23d3e13a7f0bcfe7ee3cbc74b5bdf04de871" + integrity sha512-fAFKjGlVh4y41MOZ1Sm3ns0PdYBPA75F9aVA4ynp/IwIPiPtgzc+2TXigNuGk8M0VbAoVYCW2FlpnVznZcAyUQ== dependencies: diff "^5.0.0" nearley "^2.20.1" -"@types/node@^15.0.1": - version "15.0.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-15.0.1.tgz#ef34dea0881028d11398be5bf4e856743e3dc35a" - integrity sha512-TMkXt0Ck1y0KKsGr9gJtWGjttxlZnnvDtphxUOSd0bfaR6Q1jle+sPvrzNR1urqYTWMinoKvjKfXUGsumaO1PA== +ajv@^8.0.1: + version "8.6.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.6.0.tgz#60cc45d9c46a477d80d92c48076d972c342e5720" + integrity sha512-cnUG4NSBiM4YFBxgZIj/In3/6KX+rQ2l2YPRVcvAMQGWEPKuXoPIhxzwqh31jA3IPbI4qEOp/5ILI4ynioXsGQ== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" -ansi-styles@^4.1.0: +ansi-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" + integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== + +ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.3.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== dependencies: color-convert "^2.0.1" -arg@^4.1.0: - version "4.1.3" - resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" - integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== - -assemblyscript@^0.18.31: - version "0.18.31" - resolved "https://registry.yarnpkg.com/assemblyscript/-/assemblyscript-0.18.31.tgz#ceee70fb75c78bc009831c25680967f3c089c9cc" - integrity sha512-4MtKf1nnmY0eh+v4PKVnIjT8HPTRBqJqACW3kXQoDztyFBLHN1WxGSgZ9iPsLbm/6xKNYD0l6j9y03PoMv+Qog== +assemblyscript@^0.19.3: + version "0.19.3" + resolved "https://registry.yarnpkg.com/assemblyscript/-/assemblyscript-0.19.3.tgz#4600db7a7f46bb0f6bb8a1342791264033605282" + integrity sha512-IfRqQ7nYDY/UzbGnRrFwKnClR1ITha6nhHGqr/3Jzwof9BdgfqANhpqTmRcKJ5o02WAmghkjQwfJqzDfnDd1VA== dependencies: - binaryen "100.0.0-nightly.20210413" + binaryen "101.0.0-nightly.20210604" long "^4.0.0" +astral-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" + integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== + balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -binaryen@100.0.0-nightly.20210413: - version "100.0.0-nightly.20210413" - resolved "https://registry.yarnpkg.com/binaryen/-/binaryen-100.0.0-nightly.20210413.tgz#b7f2a5bb1f76b2d6f9c67486ca218714b3766790" - integrity sha512-EeGLIxQmJS0xnYl+SH34mNBqVMoixKd9nsE7S7z+CtS9A4eoWn3Qjav+XElgunUgXIHAI5yLnYT2TUGnLX2f1w== +binaryen@101.0.0-nightly.20210604: + version "101.0.0-nightly.20210604" + resolved "https://registry.yarnpkg.com/binaryen/-/binaryen-101.0.0-nightly.20210604.tgz#3498a0a0c1108f3386b15ca79f1608425057db9e" + integrity sha512-aTgX1JDN8m3tTFK8g9hazJcEOdQl7mK4yVfElkKAh7q+TRUCaea4a2SMLr1z2xZL7s9N4lkrvrBblxRuEPvxWQ== brace-expansion@^1.1.7: version "1.1.11" @@ -95,12 +136,7 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" -buffer-from@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" - integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== - -chalk@^4.1.0: +chalk@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.1.tgz#c80b3fab28bf6371e6863325eee67e618b77e6ad" integrity sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg== @@ -130,15 +166,10 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -create-require@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" - integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== - -diff@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" - integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== +csv-stringify@^5.6.2: + version "5.6.2" + resolved "https://registry.yarnpkg.com/csv-stringify/-/csv-stringify-5.6.2.tgz#e653783e2189c4c797fbb12abf7f4943c787caa9" + integrity sha512-n3rIVbX6ylm1YsX2NEug9IaPV8xRnT+9/NNZbrA/bcHgOSSeqtWla6XnI/xmyu57wIw+ASCAoX1oM6EZtqJV0A== diff@^5.0.0: version "5.0.0" @@ -150,15 +181,25 @@ discontinuous-range@1.0.0: resolved "https://registry.yarnpkg.com/discontinuous-range/-/discontinuous-range-1.0.0.tgz#e38331f0844bba49b9a9cb71c771585aab1bc65a" integrity sha1-44Mx8IRLukm5qctxx3FYWqsbxlo= +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +fast-deep-equal@^3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -glob@^7.1.6: - version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" - integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== +glob@^7.1.7: + version "7.1.7" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" + integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -185,16 +226,51 @@ inherits@2: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +isarray@1.0.0, isarray@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= + dependencies: + isarray "1.0.0" + +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + +line-column@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/line-column/-/line-column-1.0.2.tgz#d25af2936b6f4849172b312e4792d1d987bc34a2" + integrity sha1-0lryk2tvSEkXKzEuR5LR2Ye8NKI= + dependencies: + isarray "^1.0.0" + isobject "^2.0.0" + +lodash.clonedeep@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" + integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= + +lodash.truncate@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" + integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= + long@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== -make-error@^1.1.1: - version "1.3.6" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" - integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== - minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" @@ -229,6 +305,11 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= +punycode@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + railroad-diagrams@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz#eb7e6267548ddedfb899c1b90e57374559cddb7e" @@ -242,23 +323,40 @@ randexp@0.4.6: discontinuous-range "1.0.0" ret "~0.1.10" +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== -source-map-support@^0.5.17: - version "0.5.19" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" - integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== +slice-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" + integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map@^0.6.0: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" + +string-width@^4.2.0: + version "4.2.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.2.tgz#dafd4f9559a7585cfba529c6a0a4f73488ebd4c5" + integrity sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.0" + +strip-ansi@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + dependencies: + ansi-regex "^5.0.0" supports-color@^7.1.0: version "7.2.0" @@ -267,29 +365,44 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -ts-node@^9.1.1: - version "9.1.1" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-9.1.1.tgz#51a9a450a3e959401bda5f004a72d54b936d376d" - integrity sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg== +table@^6.7.1: + version "6.7.1" + resolved "https://registry.yarnpkg.com/table/-/table-6.7.1.tgz#ee05592b7143831a8c94f3cee6aae4c1ccef33e2" + integrity sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg== dependencies: - arg "^4.1.0" - create-require "^1.1.0" - diff "^4.0.1" - make-error "^1.1.1" - source-map-support "^0.5.17" - yn "3.1.1" - -typescript@^4.2.4: - version "4.2.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.4.tgz#8610b59747de028fda898a8aef0e103f156d0961" - integrity sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg== + ajv "^8.0.1" + lodash.clonedeep "^4.5.0" + lodash.truncate "^4.4.2" + slice-ansi "^4.0.0" + string-width "^4.2.0" + strip-ansi "^6.0.0" + +ts-mixer@^5.4.1: + version "5.4.1" + resolved "https://registry.yarnpkg.com/ts-mixer/-/ts-mixer-5.4.1.tgz#b90db9ced48531aa17ce9184a2890d1e3c99b1e5" + integrity sha512-Zo9HgPCtNouDgJ+LGtrzVOjSg8+7WGQktIKLwAfaNrlOK1mWGlz1ejsAF/YqUEqAGjUTeB5fEg8gH9Aui6w9xA== + +typescript@^4.3.4: + version "4.3.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.4.tgz#3f85b986945bcf31071decdd96cf8bfa65f9dcbc" + integrity sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew== + +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + +visitor-as@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/visitor-as/-/visitor-as-0.6.0.tgz#b0cca3c918bd9d396545faf08529d2b9ba968a40" + integrity sha512-4WcnwCLXWjhNkwJj9gSqh46sdIv9CyIvnSuwr61OOfrGCtN2mKcW5KE828OeEr1rYjEy0Z/CIdPBJKJRLsUgDA== + dependencies: + lodash.clonedeep "^4.5.0" + ts-mixer "^5.4.1" wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= - -yn@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" - integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==