You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 lines
2.7 KiB

var Uint64BE,Int64BE,Uint64LE,Int64LE;!function(r){function t(t,p,B){function E(r,t,n,f){return this instanceof E?function(r,t,n,f,e){y&&v&&(t instanceof v&&(t=new y(t)),f instanceof v&&(f=new y(f)));if(!(t||n||f||a))return void(r.buffer=u(h,0));if(!o(t,n)){var c=a||Array;e=n,f=t,n=0,t=new c(8)}if(r.buffer=t,r.offset=n|=0,s===typeof f)return;"string"==typeof f?function(r,t,n,f){var e=0,o=n.length,i=0,u=0;"-"===n[0]&&e++;var a=e;for(;e<o;){var s=parseInt(n[e++],f);if(!(s>=0))break;u=u*f+s,i=i*f+Math.floor(u/b),u%=b}a&&(i=~i,u?u=b-u:i++);A(r,t+I,i),A(r,t+L,u)}(t,n,f,e||10):o(f,e)?i(t,n,f,e):"number"==typeof e?(A(t,n+I,f),A(t,n+L,e)):f>0?m(t,n,f):f<0?x(t,n,f):i(t,n,h,0)}(this,r,t,n,f):new E(r,t,n,f)}function g(){var r=this.buffer,t=this.offset,n=U(r,t+I),f=U(r,t+L);return B||(n|=0),n?n*b+f:f}function A(r,t,n){r[t+j]=255&n,n>>=8,r[t+S]=255&n,n>>=8,r[t+d]=255&n,n>>=8,r[t+w]=255&n}function U(r,t){return r[t+w]*l+(r[t+d]<<16)+(r[t+S]<<8)+r[t+j]}var I=p?0:4,L=p?4:0,w=p?0:3,d=p?1:2,S=p?2:1,j=p?3:0,m=p?function(r,t,n){var f=t+8;for(;f>t;)r[--f]=255&n,n/=256}:function(r,t,n){var f=t+8;for(;t<f;)r[t++]=255&n,n/=256},x=p?function(r,t,n){var f=t+8;n++;for(;f>t;)r[--f]=255&-n^255,n/=256}:function(r,t,n){var f=t+8;n++;for(;t<f;)r[t++]=255&-n^255,n/=256},M=E.prototype,N="is"+t,k="_"+N;return M.buffer=void 0,M.offset=0,M[k]=!0,M.toNumber=g,M.toString=function(r){var t=this.buffer,n=this.offset,f=U(t,n+I),e=U(t,n+L),o="",i=!B&&2147483648&f;for(i&&(f=~f,e=b-e),r=r||10;;){var u=f%r*b+e;if(f=Math.floor(f/r),e=Math.floor(u/r),o=(u%r).toString(r)+o,!f&&!e)break}return i&&(o="-"+o),o},M.toJSON=g,M.toArray=n,c&&(M.toBuffer=f),y&&(M.toArrayBuffer=e),E[N]=function(r){return!(!r||!r[k])},r[t]=E,E}function n(r){var t=this.buffer,n=this.offset;return a=null,!1!==r&&0===n&&8===t.length&&p(t)?t:u(t,n)}function f(r){var t=this.buffer,n=this.offset;if(a=c,!1!==r&&0===n&&8===t.length&&Buffer.isBuffer(t))return t;var f=new c(8);return i(f,0,t,n),f}function e(r){var t=this.buffer,n=this.offset,f=t.buffer;if(a=y,!1!==r&&0===n&&f instanceof v&&8===f.byteLength)return f;var e=new y(8);return i(e,0,t,n),e.buffer}function o(r,t){var n=r&&r.length;return t|=0,n&&t+8<=n&&"string"!=typeof r[t]}function i(r,t,n,f){t|=0,f|=0;for(var e=0;e<8;e++)r[t++]=255&n[f++]}function u(r,t){return Array.prototype.slice.call(r,t,t+8)}var a,s="undefined",c=s!==typeof Buffer&&Buffer,y=s!==typeof Uint8Array&&Uint8Array,v=s!==typeof ArrayBuffer&&ArrayBuffer,h=[0,0,0,0,0,0,0,0],p=Array.isArray||function(r){return!!r&&"[object Array]"==Object.prototype.toString.call(r)},b=4294967296,l=16777216;Uint64BE=t("Uint64BE",!0,!0),Int64BE=t("Int64BE",!0,!1),Uint64LE=t("Uint64LE",!1,!0),Int64LE=t("Int64LE",!1,!1)}("object"==typeof exports&&"string"!=typeof exports.nodeName?exports:this||{});