mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Fixed a misleading indent reported by Thomas Walter
This commit is contained in:
175
zfunc.c
175
zfunc.c
@@ -1029,93 +1029,98 @@ zgcd(ZVALUE z1, ZVALUE z2, ZVALUE *res)
|
|||||||
needw = FALSE;
|
needw = FALSE;
|
||||||
}
|
}
|
||||||
g = *a0 * w;
|
g = *a0 * w;
|
||||||
if (h < BASEB) g &= (1 << h) - 1;
|
if (h < BASEB) {
|
||||||
else g &= BASE1;
|
g &= (1 << h) - 1;
|
||||||
|
} else {
|
||||||
|
g &= BASE1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
g = 1;
|
||||||
}
|
}
|
||||||
else g = 1;
|
} else {
|
||||||
} else
|
|
||||||
g = (HALF) *a0 * w;
|
g = (HALF) *a0 * w;
|
||||||
a = a0;
|
}
|
||||||
b = b0;
|
a = a0;
|
||||||
i = n;
|
b = b0;
|
||||||
if (g > 1) { /* a - g * b case */
|
i = n;
|
||||||
f = 0;
|
if (g > 1) { /* a - g * b case */
|
||||||
while (i--) {
|
f = 0;
|
||||||
f = (FULL) *a - g * *b++ - f;
|
while (i--) {
|
||||||
*a++ = (HALF) f;
|
f = (FULL) *a - g * *b++ - f;
|
||||||
f >>= BASEB;
|
*a++ = (HALF) f;
|
||||||
f = -f & BASE1;
|
f >>= BASEB;
|
||||||
}
|
f = -f & BASE1;
|
||||||
if (f) {
|
}
|
||||||
i = m - n;
|
if (f) {
|
||||||
while (i-- && f) {
|
i = m - n;
|
||||||
f = *a - f;
|
while (i-- && f) {
|
||||||
*a++ = (HALF) f;
|
f = *a - f;
|
||||||
f >>= BASEB;
|
*a++ = (HALF) f;
|
||||||
f = -f & BASE1;
|
f >>= BASEB;
|
||||||
}
|
f = -f & BASE1;
|
||||||
}
|
}
|
||||||
while (m && !*a0) { /* Removing trailing zeros */
|
}
|
||||||
m--;
|
while (m && !*a0) { /* Removing trailing zeros */
|
||||||
a0++;
|
m--;
|
||||||
}
|
a0++;
|
||||||
if (f) { /* a - g * b < 0 */
|
}
|
||||||
while (m > 1 && a0[m-1] == BASE1) m--;
|
if (f) { /* a - g * b < 0 */
|
||||||
*a0 = - *a0;
|
while (m > 1 && a0[m-1] == BASE1) m--;
|
||||||
a = a0;
|
*a0 = - *a0;
|
||||||
i = m;
|
a = a0;
|
||||||
while (--i) {
|
i = m;
|
||||||
a++;
|
while (--i) {
|
||||||
*a = ~*a;
|
a++;
|
||||||
}
|
*a = ~*a;
|
||||||
}
|
}
|
||||||
} else { /* abs(a - b) case */
|
}
|
||||||
while (i && *a++ == *b++) i--;
|
} else { /* abs(a - b) case */
|
||||||
q = n - i;
|
while (i && *a++ == *b++) i--;
|
||||||
if (m == n) { /* a and b same length */
|
q = n - i;
|
||||||
if (i) { /* a not equal to b */
|
if (m == n) { /* a and b same length */
|
||||||
while (m && a0[m-1] == b0[m-1]) m--;
|
if (i) { /* a not equal to b */
|
||||||
if (a0[m-1] < b0[m-1]) {
|
while (m && a0[m-1] == b0[m-1]) m--;
|
||||||
/* Swapping since a < b */
|
if (a0[m-1] < b0[m-1]) {
|
||||||
a = a0;
|
/* Swapping since a < b */
|
||||||
a0 = b0;
|
a = a0;
|
||||||
b0 = a;
|
a0 = b0;
|
||||||
k = j;
|
b0 = a;
|
||||||
}
|
k = j;
|
||||||
a = a0 + q;
|
}
|
||||||
b = b0 + q;
|
a = a0 + q;
|
||||||
i = m - q;
|
b = b0 + q;
|
||||||
f = 0;
|
i = m - q;
|
||||||
while (i--) {
|
f = 0;
|
||||||
f = (FULL) *a - *b++ - f;
|
while (i--) {
|
||||||
*a++ = (HALF) f;
|
f = (FULL) *a - *b++ - f;
|
||||||
f >>= BASEB;
|
*a++ = (HALF) f;
|
||||||
f = -f & BASE1;
|
f >>= BASEB;
|
||||||
}
|
f = -f & BASE1;
|
||||||
}
|
}
|
||||||
} else { /* a has more digits than b */
|
}
|
||||||
a = a0 + q;
|
} else { /* a has more digits than b */
|
||||||
b = b0 + q;
|
a = a0 + q;
|
||||||
i = n - q;
|
b = b0 + q;
|
||||||
f = 0;
|
i = n - q;
|
||||||
while (i--) {
|
f = 0;
|
||||||
f = (FULL) *a - *b++ - f;
|
while (i--) {
|
||||||
*a++ = (HALF) f;
|
f = (FULL) *a - *b++ - f;
|
||||||
f >>= BASEB;
|
*a++ = (HALF) f;
|
||||||
f = -f & BASE1;
|
f >>= BASEB;
|
||||||
}
|
f = -f & BASE1;
|
||||||
if (f) { while (!*a) *a++ = BASE1;
|
}
|
||||||
(*a)--;
|
if (f) { while (!*a) *a++ = BASE1;
|
||||||
}
|
(*a)--;
|
||||||
}
|
}
|
||||||
a0 += q;
|
}
|
||||||
m -= q;
|
a0 += q;
|
||||||
while (m && !*a0) { /* Removing trailing zeros */
|
m -= q;
|
||||||
m--;
|
while (m && !*a0) { /* Removing trailing zeros */
|
||||||
a0++;
|
m--;
|
||||||
}
|
a0++;
|
||||||
}
|
}
|
||||||
while (m && !a0[m-1]) m--; /* Removing leading zeros */
|
}
|
||||||
|
while (m && !a0[m-1]) m--; /* Removing leading zeros */
|
||||||
}
|
}
|
||||||
if (m == 1) { /* a has one digit */
|
if (m == 1) { /* a has one digit */
|
||||||
v = *a0;
|
v = *a0;
|
||||||
|
Reference in New Issue
Block a user