forked from github/cordova-android
CB-13741: Updating checked-in node_modules, otherwise plugin installation fails
This commit is contained in:
+25
-27
@@ -873,7 +873,7 @@ var bigInt = (function (undefined) {
|
||||
};
|
||||
|
||||
var powersOfTwo = [1];
|
||||
while (powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);
|
||||
while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);
|
||||
var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1];
|
||||
|
||||
function shift_isSmall(n) {
|
||||
@@ -920,31 +920,29 @@ var bigInt = (function (undefined) {
|
||||
var xSign = x.isNegative(), ySign = y.isNegative();
|
||||
var xRem = xSign ? x.not() : x,
|
||||
yRem = ySign ? y.not() : y;
|
||||
var xBits = [], yBits = [];
|
||||
var xStop = false, yStop = false;
|
||||
while (!xStop || !yStop) {
|
||||
if (xRem.isZero()) { // virtual sign extension for simulating two's complement
|
||||
xStop = true;
|
||||
xBits.push(xSign ? 1 : 0);
|
||||
}
|
||||
else if (xSign) xBits.push(xRem.isEven() ? 1 : 0); // two's complement for negative numbers
|
||||
else xBits.push(xRem.isEven() ? 0 : 1);
|
||||
|
||||
if (yRem.isZero()) {
|
||||
yStop = true;
|
||||
yBits.push(ySign ? 1 : 0);
|
||||
}
|
||||
else if (ySign) yBits.push(yRem.isEven() ? 1 : 0);
|
||||
else yBits.push(yRem.isEven() ? 0 : 1);
|
||||
|
||||
xRem = xRem.over(2);
|
||||
yRem = yRem.over(2);
|
||||
}
|
||||
var xDigit = 0, yDigit = 0;
|
||||
var xDivMod = null, yDivMod = null;
|
||||
var result = [];
|
||||
for (var i = 0; i < xBits.length; i++) result.push(fn(xBits[i], yBits[i]));
|
||||
var sum = bigInt(result.pop()).negate().times(bigInt(2).pow(result.length));
|
||||
while (result.length) {
|
||||
sum = sum.add(bigInt(result.pop()).times(bigInt(2).pow(result.length)));
|
||||
while (!xRem.isZero() || !yRem.isZero()) {
|
||||
xDivMod = divModAny(xRem, highestPower2);
|
||||
xDigit = xDivMod[1].toJSNumber();
|
||||
if (xSign) {
|
||||
xDigit = highestPower2 - 1 - xDigit; // two's complement for negative numbers
|
||||
}
|
||||
|
||||
yDivMod = divModAny(yRem, highestPower2);
|
||||
yDigit = yDivMod[1].toJSNumber();
|
||||
if (ySign) {
|
||||
yDigit = highestPower2 - 1 - yDigit; // two's complement for negative numbers
|
||||
}
|
||||
|
||||
xRem = xDivMod[0];
|
||||
yRem = yDivMod[0];
|
||||
result.push(fn(xDigit, yDigit));
|
||||
}
|
||||
var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);
|
||||
for (var i = result.length - 1; i >= 0; i -= 1) {
|
||||
sum = sum.multiply(highestPower2).add(bigInt(result[i]));
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
@@ -1023,8 +1021,8 @@ var bigInt = (function (undefined) {
|
||||
a = parseValue(a);
|
||||
b = parseValue(b);
|
||||
var low = min(a, b), high = max(a, b);
|
||||
var range = high.subtract(low);
|
||||
if (range.isSmall) return low.add(Math.round(Math.random() * range));
|
||||
var range = high.subtract(low).add(1);
|
||||
if (range.isSmall) return low.add(Math.floor(Math.random() * range));
|
||||
var length = range.value.length - 1;
|
||||
var result = [], restricted = true;
|
||||
for (var i = length; i >= 0; i--) {
|
||||
|
||||
Reference in New Issue
Block a user