mirror of
https://github.com/pezkuwichain/pezkuwi-mobile-app.git
synced 2026-05-30 08:51:01 +00:00
1 line
4.5 KiB
Plaintext
1 line
4.5 KiB
Plaintext
{"dependencies":[{"name":"@polkadot/x-bigint","data":{"asyncType":null,"isESMImport":true,"locs":[{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":44,"index":44}}],"key":"Xafw1y4jIaVcNbHtayie8UfNWW8=","exportNames":["*"],"imports":1}},{"name":"./consts.js","data":{"asyncType":null,"isESMImport":true,"locs":[{"start":{"line":2,"column":0,"index":45},"end":{"line":2,"column":63,"index":108}}],"key":"EFXF1CrSZjyHGyhwYaAmgbHhDvg=","exportNames":["*"],"imports":1}},{"name":"./toBigInt.js","data":{"asyncType":null,"isESMImport":true,"locs":[{"start":{"line":3,"column":0,"index":109},"end":{"line":3,"column":42,"index":151}}],"key":"FNvzERCwuoCqDVQbKXyeboBuZC0=","exportNames":["*"],"imports":1}}],"output":[{"data":{"code":"__d(function (global, require, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {\n \"use strict\";\n\n Object.defineProperty(exports, '__esModule', {\n value: true\n });\n exports.nSqrt = nSqrt;\n var _polkadotXBigint = require(_dependencyMap[0], \"@polkadot/x-bigint\");\n var _constsJs = require(_dependencyMap[1], \"./consts.js\");\n var _toBigIntJs = require(_dependencyMap[2], \"./toBigInt.js\");\n /**\n * @name nSqrt\n * @summary Calculates the integer square root of a bigint\n */\n function nSqrt(value) {\n const n = (0, _toBigIntJs.nToBigInt)(value);\n if (n < _constsJs._0n) {\n throw new Error('square root of negative numbers is not supported');\n }\n // https://stackoverflow.com/questions/53683995/javascript-big-integer-square-root/\n // shortcut <= 2^53 - 1 to use the JS utils\n if (n <= _constsJs._2pow53n) {\n // ~~ is more performant that Math.floor\n return (0, _polkadotXBigint.BigInt)(~~Math.sqrt(Number(n)));\n }\n // Use sqrt(MAX_SAFE_INTEGER) as starting point. since we already know the\n // output will be larger than this, we expect this to be a safe start\n let x0 = _constsJs._sqrt2pow53n;\n while (true) {\n const x1 = n / x0 + x0 >> _constsJs._1n;\n if (x0 === x1 || x0 === x1 - _constsJs._1n) {\n return x0;\n }\n x0 = x1;\n }\n }\n});","lineCount":37,"map":[[7,2,8,0,"exports"],[7,9,8,0],[7,10,8,0,"nSqrt"],[7,15,8,0],[7,18,8,0,"nSqrt"],[7,23,8,0],[8,2,1,0],[8,6,1,0,"_polkadotXBigint"],[8,22,1,0],[8,25,1,0,"require"],[8,32,1,0],[8,33,1,0,"_dependencyMap"],[8,47,1,0],[9,2,2,0],[9,6,2,0,"_constsJs"],[9,15,2,0],[9,18,2,0,"require"],[9,25,2,0],[9,26,2,0,"_dependencyMap"],[9,40,2,0],[10,2,3,0],[10,6,3,0,"_toBigIntJs"],[10,17,3,0],[10,20,3,0,"require"],[10,27,3,0],[10,28,3,0,"_dependencyMap"],[10,42,3,0],[11,2,4,0],[12,0,5,0],[13,0,6,0],[14,0,7,0],[15,2,8,7],[15,11,8,16,"nSqrt"],[15,16,8,21,"nSqrt"],[15,17,8,22,"value"],[15,22,8,27],[15,24,8,29],[16,4,9,4],[16,10,9,10,"n"],[16,11,9,11],[16,14,9,14],[16,18,9,14,"nToBigInt"],[16,29,9,23],[16,30,9,23,"nToBigInt"],[16,39,9,23],[16,41,9,24,"value"],[16,46,9,29],[16,47,9,30],[17,4,10,4],[17,8,10,8,"n"],[17,9,10,9],[17,12,10,12,"_0n"],[17,21,10,15],[17,22,10,15,"_0n"],[17,25,10,15],[17,27,10,17],[18,6,11,8],[18,12,11,14],[18,16,11,18,"Error"],[18,21,11,23],[18,22,11,24],[18,72,11,74],[18,73,11,75],[19,4,12,4],[20,4,13,4],[21,4,14,4],[22,4,15,4],[22,8,15,8,"n"],[22,9,15,9],[22,13,15,13,"_2pow53n"],[22,22,15,21],[22,23,15,21,"_2pow53n"],[22,31,15,21],[22,33,15,23],[23,6,16,8],[24,6,17,8],[24,13,17,15],[24,17,17,15,"BigInt"],[24,33,17,21],[24,34,17,21,"BigInt"],[24,40,17,21],[24,42,17,22],[24,43,17,23],[24,44,17,24,"Math"],[24,48,17,28],[24,49,17,29,"sqrt"],[24,53,17,33],[24,54,17,34,"Number"],[24,60,17,40],[24,61,17,41,"n"],[24,62,17,42],[24,63,17,43],[24,64,17,44],[24,65,17,45],[25,4,18,4],[26,4,19,4],[27,4,20,4],[28,4,21,4],[28,8,21,8,"x0"],[28,10,21,10],[28,13,21,13,"_sqrt2pow53n"],[28,22,21,25],[28,23,21,25,"_sqrt2pow53n"],[28,35,21,25],[29,4,22,4],[29,11,22,11],[29,15,22,15],[29,17,22,17],[30,6,23,8],[30,12,23,14,"x1"],[30,14,23,16],[30,17,23,21,"n"],[30,18,23,22],[30,21,23,25,"x0"],[30,23,23,27],[30,26,23,31,"x0"],[30,28,23,33],[30,32,23,38,"_1n"],[30,41,23,41],[30,42,23,41,"_1n"],[30,45,23,41],[31,6,24,8],[31,10,24,12,"x0"],[31,12,24,14],[31,17,24,19,"x1"],[31,19,24,21],[31,23,24,26,"x0"],[31,25,24,28],[31,30,24,34,"x1"],[31,32,24,36],[31,35,24,39,"_1n"],[31,44,24,42],[31,45,24,42,"_1n"],[31,48,24,44],[31,50,24,46],[32,8,25,12],[32,15,25,19,"x0"],[32,17,25,21],[33,6,26,8],[34,6,27,8,"x0"],[34,8,27,10],[34,11,27,13,"x1"],[34,13,27,15],[35,4,28,4],[36,2,29,0],[37,0,29,1],[37,3]],"functionMap":{"names":["<global>","nSqrt"],"mappings":"AAA;OCO;CDqB"},"hasCjsExports":false},"type":"js/module"}]} |