PS3_Toolset/files/biginteger.pmin.js

1 line
50 KiB
JavaScript
Raw Normal View History

2021-05-23 20:48:48 +00:00
function assignToObject(t,e){return"function"!=typeof Object.assign&&Object.defineProperties(Object,{assign:{value:function(t){"use strict";if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),r=1;r<arguments.length;r++){var n=arguments[r];if(null!=n)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},writable:!0,configurable:!0}}),Object.assign(t,e)}function cloneObject(t){var e={};for(var r in t)null!=t[r]&&"object"==typeof t[r]?e[r]=cloneObject(t[r]):e[r]=t[r];return e}"function"!=typeof Object.create&&(Object.create=function(t,e){function r(t){t&&Object.defineProperties(this,t)}return r.prototype=t,new r(e)}),Object.keys||(Object.keys=function(t){if(t!==Object(t))throw new TypeError("Object.keys called on a non-object");var e,r=[];for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&r.push(e);return r}),String.prototype.startsWith||(String.prototype.startsWith=function(t,e){return e=!e||e<0?0:+e,this.substring(e,e+t.length)===t}),String.prototype.endsWith||(String.prototype.endsWith=function(t,e){return(void 0===e||e>this.length)&&(e=this.length),this.substring(e-t.length,e)===t}),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),Array.prototype.forEach||(Array.prototype.forEach=function(t,e){e=e||window;for(var r=0;r<this.length;r++)t.call(e,this[r],r,this)}),window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=function(t,e){e=e||window;for(var r=0;r<this.length;r++)t.call(e,this[r],r,this)}),Number.prototype.toString64=function(){return("0000000000000000"+this.toString(16)).substr(-16)},Number.prototype.toString32=function(){return("00000000"+this.toString(16)).substr(-8)},Number.prototype.toString16=function(){return("0000"+this.toString(16)).substr(-4)},Number.prototype.toString8=function(){return("00"+this.toString(16)).substr(-2)},Number.prototype.noExponents=function(){var t=String(this).split(/[eE]/);if(1===t.length)return t[0];var e="",r=this<0?"-":"",n=t[0].replace(".",""),i=Number(t[1])+1;if(i<0){for(e=r+"0.";i++;)e+="0";return e+n.replace(/^\-/,"")}for(i-=n.length;i--;)e+="0";return n+e},String.prototype.repeat=function(t){return new Array(t+1).join(this)},String.prototype.fromAscii=function(){for(var t="",e=0;e<this.length/2;)t+=String.fromCharCode(parseInt(this.substr(2*e,2),16)),e++;return t},String.prototype.toAscii=function(){for(var t="",e=0;e<this.length;e++)t+=this.charCodeAt(e).toString16();return t},String.prototype.toAscii8=function(){for(var t="",e=0;e<this.length;e++)t+=this.charCodeAt(e).toString8();for(var r=0;r<t.length%8;r++)t+="00";return t+"00000000"};var bigInt=function(s){var y=1e7,h=7,e=9007199254740992,r=m(e),f=Math.log(e);function p(t,e){return void 0===t?p[0]:void 0===e||10==+e?W(t):G(t,e)}function g(t,e){this.value=t,this.sign=e,this.isSmall=!1}function d(t){this.value=t,this.sign=t<0,this.isSmall=!0}function v(t){return-e<t&&t<e}function m(t){return t<1e7?[t]:t<1e14?[t%1e7,Math.floor(t/1e7)]:[t%1e7,Math.floor(t/1e7)%1e7,Math.floor(t/1e14)]}function b(t){w(t);var e=t.length;if(e<4&&M(t,r)<0)switch(e){case 0:return 0;case 1:return t[0];case 2:return t[0]+t[1]*y;default:return t[0]+(t[1]+t[2]*y)*y}return t}function w(t){for(var e=t.length;0===t[--e];);t.length=e+1}function j(t){for(var e=new Array(t),r=-1;++r<t;)e[r]=0;return e}function S(t){return 0<t?Math.floor(t):Math.ceil(t)}function n(t,e){for(var r,n=t.length,i=e.length,o=new Array(n),s=0,a=y,c=0;c<i;c++)s=a<=(r=t[c]+e[c]+s)?1:0,o[c]=r-s*a;for(;c<n;)s=(r=t[c]+s)===a?1:0,o[c++]=r-s*a;return 0<s&&o.push(s),o}function A(t,e){return t.length>=e.length?n(t,e):n(e,t)}function i(t,e){for(var r,n=t.length,i=new Array(n),o=y,s=0;s<n;s++)r=t[s]-o+e,e=Math.floor(r/o),i[s]=r-e*o,e+=1;for(;0<e;)i[s++]=e%o,e=Math.floor(e/o);return i}function x(t,e){for(var r,n=t.length,i=e.length,o=new Array(n),s=0,a=y,c=0;c<i;c++)s=(r=t[c]-s-e[c])<0?(r+=a,1):0,o[c]=r;for(c=i;c<n;c++){if(!((r=t[c]-s)<0)){o[c++]=r;break}r+=a,o[c]=r}for(;c<n;c++)o[c]=t[c];return w(o),o}function c(t,e,r){for(var n,i=t.length,o=new