Socket
Socket
Sign inDemoInstall

cuint

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 0.2.2

18

build/uint32.js

@@ -97,3 +97,3 @@ /**

UINT32.prototype.toNumber = function () {
return (this._high << 16) | this._low
return (this._high * 65536) + this._low
}

@@ -108,17 +108,3 @@

UINT32.prototype.toString = function (radix) {
radix = radix || 10
var radixUint = radixCache[radix] || new UINT32(radix)
if ( !this.gt(radixUint) ) return this.toNumber().toString(radix)
var self = this.clone()
var res = new Array(32)
for (var i = 31; i >= 0; i--) {
self.div(radixUint)
res[i] = self.remainder.toNumber().toString(radix)
if ( !self.gt(radixUint) ) break
}
res[i-1] = self.toNumber().toString(radix)
return res.join('')
return this.toNumber().toString(radix || 10)
}

@@ -125,0 +111,0 @@

2

build/uint32.min.js

@@ -1,1 +0,1 @@

!function(t){function h(t,s){return this instanceof h?(this._low=0,this._high=0,this.remainder=null,"undefined"==typeof s?o.call(this,t):"string"==typeof t?r.call(this,t,s):void i.call(this,t,s)):new h(t,s)}function i(t,h){return this._low=0|t,this._high=0|h,this}function o(t){return this._low=65535&t,this._high=t>>>16,this}function r(t,h){var i=parseInt(t,h||10);return this._low=65535&i,this._high=i>>>16,this}var s=({36:h(Math.pow(36,5)),16:h(Math.pow(16,7)),10:h(Math.pow(10,9)),2:h(Math.pow(2,30))},{36:h(36),16:h(16),10:h(10),2:h(2)});h.prototype.fromBits=i,h.prototype.fromNumber=o,h.prototype.fromString=r,h.prototype.toNumber=function(){return this._high<<16|this._low},h.prototype.toString=function(t){t=t||10;var i=s[t]||new h(t);if(!this.gt(i))return this.toNumber().toString(t);for(var o=this.clone(),r=new Array(32),e=31;e>=0&&(o.div(i),r[e]=o.remainder.toNumber().toString(t),o.gt(i));e--);return r[e-1]=o.toNumber().toString(t),r.join("")},h.prototype.add=function(t){var h=this._low+t._low,i=h>>>16;return i+=this._high+t._high,this._low=65535&h,this._high=65535&i,this},h.prototype.subtract=function(t){return this.add(t.clone().negate())},h.prototype.multiply=function(t){var h,i,o=this._high,r=this._low,s=t._high,e=t._low;return i=r*e,h=i>>>16,h+=o*e,h&=65535,h+=r*s,this._low=65535&i,this._high=65535&h,this},h.prototype.div=function(t){if(0==t._low&&0==t._high)throw Error("division by zero");if(0==t._high&&1==t._low)return this.remainder=new h(0),this;if(t.gt(this))return this.remainder=this.clone(),this._low=0,this._high=0,this;if(this.eq(t))return this.remainder=new h(0),this._low=1,this._high=0,this;for(var i=t.clone(),o=-1;!this.lt(i);)i.shiftLeft(1,!0),o++;for(this.remainder=this.clone(),this._low=0,this._high=0;o>=0;o--)i.shiftRight(1),this.remainder.lt(i)||(this.remainder.subtract(i),o>=16?this._high|=1<<o-16:this._low|=1<<o);return this},h.prototype.negate=function(){var t=(65535&~this._low)+1;return this._low=65535&t,this._high=~this._high+(t>>>16)&65535,this},h.prototype.equals=h.prototype.eq=function(t){return this._low==t._low&&this._high==t._high},h.prototype.greaterThan=h.prototype.gt=function(t){return this._high>t._high?!0:this._high<t._high?!1:this._low>t._low},h.prototype.lessThan=h.prototype.lt=function(t){return this._high<t._high?!0:this._high>t._high?!1:this._low<t._low},h.prototype.or=function(t){return this._low|=t._low,this._high|=t._high,this},h.prototype.and=function(t){return this._low&=t._low,this._high&=t._high,this},h.prototype.not=function(){return this._low=65535&~this._low,this._high=65535&~this._high,this},h.prototype.xor=function(t){return this._low^=t._low,this._high^=t._high,this},h.prototype.shiftRight=h.prototype.shiftr=function(t){return t>16?(this._low=this._high>>t-16,this._high=0):16==t?(this._low=this._high,this._high=0):(this._low=this._low>>t|this._high<<16-t&65535,this._high>>=t),this},h.prototype.shiftLeft=h.prototype.shiftl=function(t,h){return t>16?(this._high=this._low<<t-16,this._low=0,h||(this._high&=65535)):16==t?(this._high=this._low,this._low=0):(this._high=this._high<<t|this._low>>16-t,this._low=this._low<<t&65535,h||(this._high&=65535)),this},h.prototype.rotateLeft=h.prototype.rotl=function(t){var h=this._high<<16|this._low;return h=h<<t|h>>>32-t,this._low=65535&h,this._high=h>>>16,this},h.prototype.rotateRight=h.prototype.rotr=function(t){var h=this._high<<16|this._low;return h=h>>>t|h<<32-t,this._low=65535&h,this._high=h>>>16,this},h.prototype.clone=function(){return new h(this._low,this._high)},"undefined"!=typeof define&&define.amd?define([],function(){return h}):"undefined"!=typeof module&&module.exports?module.exports=h:t.UINT32=h}(this);
!function(t){function h(t,s){return this instanceof h?(this._low=0,this._high=0,this.remainder=null,"undefined"==typeof s?o.call(this,t):"string"==typeof t?r.call(this,t,s):void i.call(this,t,s)):new h(t,s)}function i(t,h){return this._low=0|t,this._high=0|h,this}function o(t){return this._low=65535&t,this._high=t>>>16,this}function r(t,h){var i=parseInt(t,h||10);return this._low=65535&i,this._high=i>>>16,this}({36:h(Math.pow(36,5)),16:h(Math.pow(16,7)),10:h(Math.pow(10,9)),2:h(Math.pow(2,30))}),{36:h(36),16:h(16),10:h(10),2:h(2)};h.prototype.fromBits=i,h.prototype.fromNumber=o,h.prototype.fromString=r,h.prototype.toNumber=function(){return 65536*this._high+this._low},h.prototype.toString=function(t){return this.toNumber().toString(t||10)},h.prototype.add=function(t){var h=this._low+t._low,i=h>>>16;return i+=this._high+t._high,this._low=65535&h,this._high=65535&i,this},h.prototype.subtract=function(t){return this.add(t.clone().negate())},h.prototype.multiply=function(t){var h,i,o=this._high,r=this._low,s=t._high,e=t._low;return i=r*e,h=i>>>16,h+=o*e,h&=65535,h+=r*s,this._low=65535&i,this._high=65535&h,this},h.prototype.div=function(t){if(0==t._low&&0==t._high)throw Error("division by zero");if(0==t._high&&1==t._low)return this.remainder=new h(0),this;if(t.gt(this))return this.remainder=this.clone(),this._low=0,this._high=0,this;if(this.eq(t))return this.remainder=new h(0),this._low=1,this._high=0,this;for(var i=t.clone(),o=-1;!this.lt(i);)i.shiftLeft(1,!0),o++;for(this.remainder=this.clone(),this._low=0,this._high=0;o>=0;o--)i.shiftRight(1),this.remainder.lt(i)||(this.remainder.subtract(i),o>=16?this._high|=1<<o-16:this._low|=1<<o);return this},h.prototype.negate=function(){var t=(65535&~this._low)+1;return this._low=65535&t,this._high=~this._high+(t>>>16)&65535,this},h.prototype.equals=h.prototype.eq=function(t){return this._low==t._low&&this._high==t._high},h.prototype.greaterThan=h.prototype.gt=function(t){return this._high>t._high?!0:this._high<t._high?!1:this._low>t._low},h.prototype.lessThan=h.prototype.lt=function(t){return this._high<t._high?!0:this._high>t._high?!1:this._low<t._low},h.prototype.or=function(t){return this._low|=t._low,this._high|=t._high,this},h.prototype.and=function(t){return this._low&=t._low,this._high&=t._high,this},h.prototype.not=function(){return this._low=65535&~this._low,this._high=65535&~this._high,this},h.prototype.xor=function(t){return this._low^=t._low,this._high^=t._high,this},h.prototype.shiftRight=h.prototype.shiftr=function(t){return t>16?(this._low=this._high>>t-16,this._high=0):16==t?(this._low=this._high,this._high=0):(this._low=this._low>>t|this._high<<16-t&65535,this._high>>=t),this},h.prototype.shiftLeft=h.prototype.shiftl=function(t,h){return t>16?(this._high=this._low<<t-16,this._low=0,h||(this._high&=65535)):16==t?(this._high=this._low,this._low=0):(this._high=this._high<<t|this._low>>16-t,this._low=this._low<<t&65535,h||(this._high&=65535)),this},h.prototype.rotateLeft=h.prototype.rotl=function(t){var h=this._high<<16|this._low;return h=h<<t|h>>>32-t,this._low=65535&h,this._high=h>>>16,this},h.prototype.rotateRight=h.prototype.rotr=function(t){var h=this._high<<16|this._low;return h=h>>>t|h<<32-t,this._low=65535&h,this._high=h>>>16,this},h.prototype.clone=function(){return new h(this._low,this._high)},"undefined"!=typeof define&&define.amd?define([],function(){return h}):"undefined"!=typeof module&&module.exports?module.exports=h:t.UINT32=h}(this);

@@ -148,3 +148,3 @@ /**

UINT64.prototype.toNumber = function () {
return (this._a16 << 16) | this._a00
return (this._a16 * 65536) + this._a00
}

@@ -151,0 +151,0 @@

@@ -1,1 +0,1 @@

!function(t){function i(t,_,r,e){return this instanceof i?(this.remainder=null,"string"==typeof t?h.call(this,t,_):"undefined"==typeof _?s.call(this,t):void a.apply(this,arguments)):new i(t,_,r,e)}function a(t,i,a,s){return"undefined"==typeof a?(this._a00=65535&t,this._a16=t>>>16,this._a32=65535&i,this._a48=i>>>16,this):(this._a00=0|t,this._a16=0|i,this._a32=0|a,this._a48=0|s,this)}function s(t){return this._a00=65535&t,this._a16=t>>>16,this._a32=0,this._a48=0,this}function h(t,a){a=a||10,this._a00=0,this._a16=0,this._a32=0,this._a48=0;for(var s=_[a]||new i(Math.pow(a,5)),h=0,r=t.length;r>h;h+=5){var e=Math.min(5,r-h),n=parseInt(t.slice(h,h+e),a);this.multiply(5>e?new i(Math.pow(a,e)):s).add(new i(n))}return this}var _={16:i(Math.pow(16,5)),10:i(Math.pow(10,5)),2:i(Math.pow(2,5))},r={16:i(16),10:i(10),2:i(2)};i.prototype.fromBits=a,i.prototype.fromNumber=s,i.prototype.fromString=h,i.prototype.toNumber=function(){return this._a16<<16|this._a00},i.prototype.toString=function(t){t=t||10;var a=r[t]||new i(t);if(!this.gt(a))return this.toNumber().toString(t);for(var s=this.clone(),h=new Array(64),_=63;_>=0&&(s.div(a),h[_]=s.remainder.toNumber().toString(t),s.gt(a));_--);return h[_-1]=s.toNumber().toString(t),h.join("")},i.prototype.add=function(t){var i=this._a00+t._a00,a=i>>>16;a+=this._a16+t._a16;var s=a>>>16;s+=this._a32+t._a32;var h=s>>>16;return h+=this._a48+t._a48,this._a00=65535&i,this._a16=65535&a,this._a32=65535&s,this._a48=65535&h,this},i.prototype.subtract=function(t){return this.add(t.clone().negate())},i.prototype.multiply=function(t){var i=this._a00,a=this._a16,s=this._a32,h=this._a48,_=t._a00,r=t._a16,e=t._a32,n=t._a48,o=i*_,u=o>>>16;u+=i*r;var p=u>>>16;u&=65535,u+=a*_,p+=u>>>16,p+=i*e;var f=p>>>16;return p&=65535,p+=a*r,f+=p>>>16,p&=65535,p+=s*_,f+=p>>>16,f+=i*n,f&=65535,f+=a*e,f&=65535,f+=s*r,f&=65535,f+=h*_,this._a00=65535&o,this._a16=65535&u,this._a32=65535&p,this._a48=65535&f,this},i.prototype.div=function(t){if(0==t._a16&&0==t._a32&&0==t._a48){if(0==t._a00)throw Error("division by zero");if(1==t._a00)return this.remainder=new i(0),this}if(t.gt(this))return this.remainder=this.clone(),this._a00=0,this._a16=0,this._a32=0,this._a48=0,this;if(this.eq(t))return this.remainder=new i(0),this._a00=1,this._a16=0,this._a32=0,this._a48=0,this;for(var a=t.clone(),s=-1;!this.lt(a);)a.shiftLeft(1,!0),s++;for(this.remainder=this.clone(),this._a00=0,this._a16=0,this._a32=0,this._a48=0;s>=0;s--)a.shiftRight(1),this.remainder.lt(a)||(this.remainder.subtract(a),s>=48?this._a48|=1<<s-48:s>=32?this._a32|=1<<s-32:s>=16?this._a16|=1<<s-16:this._a00|=1<<s);return this},i.prototype.negate=function(){var t=(65535&~this._a00)+1;return this._a00=65535&t,t=(65535&~this._a16)+(t>>>16),this._a16=65535&t,t=(65535&~this._a32)+(t>>>16),this._a32=65535&t,this._a48=~this._a48+(t>>>16)&65535,this},i.prototype.equals=i.prototype.eq=function(t){return this._a48==t._a48&&this._a00==t._a00&&this._a32==t._a32&&this._a16==t._a16},i.prototype.greaterThan=i.prototype.gt=function(t){return this._a48>t._a48?!0:this._a48<t._a48?!1:this._a32>t._a32?!0:this._a32<t._a32?!1:this._a16>t._a16?!0:this._a16<t._a16?!1:this._a00>t._a00},i.prototype.lessThan=i.prototype.lt=function(t){return this._a48<t._a48?!0:this._a48>t._a48?!1:this._a32<t._a32?!0:this._a32>t._a32?!1:this._a16<t._a16?!0:this._a16>t._a16?!1:this._a00<t._a00},i.prototype.or=function(t){return this._a00|=t._a00,this._a16|=t._a16,this._a32|=t._a32,this._a48|=t._a48,this},i.prototype.and=function(t){return this._a00&=t._a00,this._a16&=t._a16,this._a32&=t._a32,this._a48&=t._a48,this},i.prototype.xor=function(t){return this._a00^=t._a00,this._a16^=t._a16,this._a32^=t._a32,this._a48^=t._a48,this},i.prototype.not=function(){return this._a00=65535&~this._a00,this._a16=65535&~this._a16,this._a32=65535&~this._a32,this._a48=65535&~this._a48,this},i.prototype.shiftRight=i.prototype.shiftr=function(t){return t%=64,t>=48?(this._a00=this._a48>>t-48,this._a16=0,this._a32=0,this._a48=0):t>=32?(t-=32,this._a00=65535&(this._a32>>t|this._a48<<16-t),this._a16=this._a48>>t&65535,this._a32=0,this._a48=0):t>=16?(t-=16,this._a00=65535&(this._a16>>t|this._a32<<16-t),this._a16=65535&(this._a32>>t|this._a48<<16-t),this._a32=this._a48>>t&65535,this._a48=0):(this._a00=65535&(this._a00>>t|this._a16<<16-t),this._a16=65535&(this._a16>>t|this._a32<<16-t),this._a32=65535&(this._a32>>t|this._a48<<16-t),this._a48=this._a48>>t&65535),this},i.prototype.shiftLeft=i.prototype.shiftl=function(t,i){return t%=64,t>=48?(this._a48=this._a00<<t-48,this._a32=0,this._a16=0,this._a00=0):t>=32?(t-=32,this._a48=this._a16<<t|this._a00>>16-t,this._a32=this._a00<<t&65535,this._a16=0,this._a00=0):t>=16?(t-=16,this._a48=this._a32<<t|this._a16>>16-t,this._a32=65535&(this._a16<<t|this._a00>>16-t),this._a16=this._a00<<t&65535,this._a00=0):(this._a48=this._a48<<t|this._a32>>16-t,this._a32=65535&(this._a32<<t|this._a16>>16-t),this._a16=65535&(this._a16<<t|this._a00>>16-t),this._a00=this._a00<<t&65535),i||(this._a48&=65535),this},i.prototype.rotateLeft=i.prototype.rotl=function(t){if(t%=64,0==t)return this;if(t>=32){var i=this._a00;if(this._a00=this._a32,this._a32=i,i=this._a48,this._a48=this._a16,this._a16=i,32==t)return this;t-=32}var a=this._a48<<16|this._a32,s=this._a16<<16|this._a00,h=a<<t|s>>>32-t,_=s<<t|a>>>32-t;return this._a00=65535&_,this._a16=_>>>16,this._a32=65535&h,this._a48=h>>>16,this},i.prototype.rotateRight=i.prototype.rotr=function(t){if(t%=64,0==t)return this;if(t>=32){var i=this._a00;if(this._a00=this._a32,this._a32=i,i=this._a48,this._a48=this._a16,this._a16=i,32==t)return this;t-=32}var a=this._a48<<16|this._a32,s=this._a16<<16|this._a00,h=a>>>t|s<<32-t,_=s>>>t|a<<32-t;return this._a00=65535&_,this._a16=_>>>16,this._a32=65535&h,this._a48=h>>>16,this},i.prototype.clone=function(){return new i(this._a00,this._a16,this._a32,this._a48)},"undefined"!=typeof define&&define.amd?define([],function(){return i}):"undefined"!=typeof module&&module.exports?module.exports=i:t.UINT64=i}(this);
!function(t){function i(t,_,r,e){return this instanceof i?(this.remainder=null,"string"==typeof t?h.call(this,t,_):"undefined"==typeof _?s.call(this,t):void a.apply(this,arguments)):new i(t,_,r,e)}function a(t,i,a,s){return"undefined"==typeof a?(this._a00=65535&t,this._a16=t>>>16,this._a32=65535&i,this._a48=i>>>16,this):(this._a00=0|t,this._a16=0|i,this._a32=0|a,this._a48=0|s,this)}function s(t){return this._a00=65535&t,this._a16=t>>>16,this._a32=0,this._a48=0,this}function h(t,a){a=a||10,this._a00=0,this._a16=0,this._a32=0,this._a48=0;for(var s=_[a]||new i(Math.pow(a,5)),h=0,r=t.length;r>h;h+=5){var e=Math.min(5,r-h),n=parseInt(t.slice(h,h+e),a);this.multiply(5>e?new i(Math.pow(a,e)):s).add(new i(n))}return this}var _={16:i(Math.pow(16,5)),10:i(Math.pow(10,5)),2:i(Math.pow(2,5))},r={16:i(16),10:i(10),2:i(2)};i.prototype.fromBits=a,i.prototype.fromNumber=s,i.prototype.fromString=h,i.prototype.toNumber=function(){return 65536*this._a16+this._a00},i.prototype.toString=function(t){t=t||10;var a=r[t]||new i(t);if(!this.gt(a))return this.toNumber().toString(t);for(var s=this.clone(),h=new Array(64),_=63;_>=0&&(s.div(a),h[_]=s.remainder.toNumber().toString(t),s.gt(a));_--);return h[_-1]=s.toNumber().toString(t),h.join("")},i.prototype.add=function(t){var i=this._a00+t._a00,a=i>>>16;a+=this._a16+t._a16;var s=a>>>16;s+=this._a32+t._a32;var h=s>>>16;return h+=this._a48+t._a48,this._a00=65535&i,this._a16=65535&a,this._a32=65535&s,this._a48=65535&h,this},i.prototype.subtract=function(t){return this.add(t.clone().negate())},i.prototype.multiply=function(t){var i=this._a00,a=this._a16,s=this._a32,h=this._a48,_=t._a00,r=t._a16,e=t._a32,n=t._a48,o=i*_,u=o>>>16;u+=i*r;var p=u>>>16;u&=65535,u+=a*_,p+=u>>>16,p+=i*e;var f=p>>>16;return p&=65535,p+=a*r,f+=p>>>16,p&=65535,p+=s*_,f+=p>>>16,f+=i*n,f&=65535,f+=a*e,f&=65535,f+=s*r,f&=65535,f+=h*_,this._a00=65535&o,this._a16=65535&u,this._a32=65535&p,this._a48=65535&f,this},i.prototype.div=function(t){if(0==t._a16&&0==t._a32&&0==t._a48){if(0==t._a00)throw Error("division by zero");if(1==t._a00)return this.remainder=new i(0),this}if(t.gt(this))return this.remainder=this.clone(),this._a00=0,this._a16=0,this._a32=0,this._a48=0,this;if(this.eq(t))return this.remainder=new i(0),this._a00=1,this._a16=0,this._a32=0,this._a48=0,this;for(var a=t.clone(),s=-1;!this.lt(a);)a.shiftLeft(1,!0),s++;for(this.remainder=this.clone(),this._a00=0,this._a16=0,this._a32=0,this._a48=0;s>=0;s--)a.shiftRight(1),this.remainder.lt(a)||(this.remainder.subtract(a),s>=48?this._a48|=1<<s-48:s>=32?this._a32|=1<<s-32:s>=16?this._a16|=1<<s-16:this._a00|=1<<s);return this},i.prototype.negate=function(){var t=(65535&~this._a00)+1;return this._a00=65535&t,t=(65535&~this._a16)+(t>>>16),this._a16=65535&t,t=(65535&~this._a32)+(t>>>16),this._a32=65535&t,this._a48=~this._a48+(t>>>16)&65535,this},i.prototype.equals=i.prototype.eq=function(t){return this._a48==t._a48&&this._a00==t._a00&&this._a32==t._a32&&this._a16==t._a16},i.prototype.greaterThan=i.prototype.gt=function(t){return this._a48>t._a48?!0:this._a48<t._a48?!1:this._a32>t._a32?!0:this._a32<t._a32?!1:this._a16>t._a16?!0:this._a16<t._a16?!1:this._a00>t._a00},i.prototype.lessThan=i.prototype.lt=function(t){return this._a48<t._a48?!0:this._a48>t._a48?!1:this._a32<t._a32?!0:this._a32>t._a32?!1:this._a16<t._a16?!0:this._a16>t._a16?!1:this._a00<t._a00},i.prototype.or=function(t){return this._a00|=t._a00,this._a16|=t._a16,this._a32|=t._a32,this._a48|=t._a48,this},i.prototype.and=function(t){return this._a00&=t._a00,this._a16&=t._a16,this._a32&=t._a32,this._a48&=t._a48,this},i.prototype.xor=function(t){return this._a00^=t._a00,this._a16^=t._a16,this._a32^=t._a32,this._a48^=t._a48,this},i.prototype.not=function(){return this._a00=65535&~this._a00,this._a16=65535&~this._a16,this._a32=65535&~this._a32,this._a48=65535&~this._a48,this},i.prototype.shiftRight=i.prototype.shiftr=function(t){return t%=64,t>=48?(this._a00=this._a48>>t-48,this._a16=0,this._a32=0,this._a48=0):t>=32?(t-=32,this._a00=65535&(this._a32>>t|this._a48<<16-t),this._a16=this._a48>>t&65535,this._a32=0,this._a48=0):t>=16?(t-=16,this._a00=65535&(this._a16>>t|this._a32<<16-t),this._a16=65535&(this._a32>>t|this._a48<<16-t),this._a32=this._a48>>t&65535,this._a48=0):(this._a00=65535&(this._a00>>t|this._a16<<16-t),this._a16=65535&(this._a16>>t|this._a32<<16-t),this._a32=65535&(this._a32>>t|this._a48<<16-t),this._a48=this._a48>>t&65535),this},i.prototype.shiftLeft=i.prototype.shiftl=function(t,i){return t%=64,t>=48?(this._a48=this._a00<<t-48,this._a32=0,this._a16=0,this._a00=0):t>=32?(t-=32,this._a48=this._a16<<t|this._a00>>16-t,this._a32=this._a00<<t&65535,this._a16=0,this._a00=0):t>=16?(t-=16,this._a48=this._a32<<t|this._a16>>16-t,this._a32=65535&(this._a16<<t|this._a00>>16-t),this._a16=this._a00<<t&65535,this._a00=0):(this._a48=this._a48<<t|this._a32>>16-t,this._a32=65535&(this._a32<<t|this._a16>>16-t),this._a16=65535&(this._a16<<t|this._a00>>16-t),this._a00=this._a00<<t&65535),i||(this._a48&=65535),this},i.prototype.rotateLeft=i.prototype.rotl=function(t){if(t%=64,0==t)return this;if(t>=32){var i=this._a00;if(this._a00=this._a32,this._a32=i,i=this._a48,this._a48=this._a16,this._a16=i,32==t)return this;t-=32}var a=this._a48<<16|this._a32,s=this._a16<<16|this._a00,h=a<<t|s>>>32-t,_=s<<t|a>>>32-t;return this._a00=65535&_,this._a16=_>>>16,this._a32=65535&h,this._a48=h>>>16,this},i.prototype.rotateRight=i.prototype.rotr=function(t){if(t%=64,0==t)return this;if(t>=32){var i=this._a00;if(this._a00=this._a32,this._a32=i,i=this._a48,this._a48=this._a16,this._a16=i,32==t)return this;t-=32}var a=this._a48<<16|this._a32,s=this._a16<<16|this._a00,h=a>>>t|s<<32-t,_=s>>>t|a<<32-t;return this._a00=65535&_,this._a16=_>>>16,this._a32=65535&h,this._a48=h>>>16,this},i.prototype.clone=function(){return new i(this._a00,this._a16,this._a32,this._a48)},"undefined"!=typeof define&&define.amd?define([],function(){return i}):"undefined"!=typeof module&&module.exports?module.exports=i:t.UINT64=i}(this);

@@ -0,1 +1,6 @@

0.2.2 / 2016-08-23
==================
* merged pull request c5f32fa from vote539
0.2.1 / 2015-12-18

@@ -2,0 +7,0 @@ ==================

@@ -97,3 +97,3 @@ /**

UINT32.prototype.toNumber = function () {
return (this._high << 16) | this._low
return (this._high * 65536) + this._low
}

@@ -108,17 +108,3 @@

UINT32.prototype.toString = function (radix) {
radix = radix || 10
var radixUint = radixCache[radix] || new UINT32(radix)
if ( !this.gt(radixUint) ) return this.toNumber().toString(radix)
var self = this.clone()
var res = new Array(32)
for (var i = 31; i >= 0; i--) {
self.div(radixUint)
res[i] = self.remainder.toNumber().toString(radix)
if ( !self.gt(radixUint) ) break
}
res[i-1] = self.toNumber().toString(radix)
return res.join('')
return this.toNumber().toString(radix || 10)
}

@@ -125,0 +111,0 @@

@@ -148,3 +148,3 @@ /**

UINT64.prototype.toNumber = function () {
return (this._a16 << 16) | this._a00
return (this._a16 * 65536) + this._a00
}

@@ -151,0 +151,0 @@

{
"name": "cuint",
"version": "0.2.1",
"version": "0.2.2",
"description": "Unsigned integers for Javascript",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -52,2 +52,13 @@ var assert = require('assert')

describe('toNumber and toString', function () {
it('should return the same result for 100 random numbers', function () {
for (var i=0; i<100; i++) {
var u = UINT32(Math.floor(Math.random() * 0xffffffff));
assert.equal(u.toNumber(), parseInt(u.toString()));
}
})
})
})

@@ -52,2 +52,13 @@ var assert = require('assert')

describe('toNumber and toString', function () {
it('should return the same result for 100 random numbers', function () {
for (var i=0; i<100; i++) {
var u = UINT64(Math.floor(Math.random() * 0xffffffff), 0);
assert.equal(u.toNumber(), parseInt(u.toString()));
}
})
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc