← Commit list

f359e004b

Denys Vlasenko
Denys Vlasenko
2018-12-05
SUCCESS Duration: 154s

Subject

bc: make 2^1000000 interruptible faster

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

miscutils/bc.c+10 -0
@@ -2039,6 +2039,11 @@ static BcStatus bc_num_p(BcNum *a, BcNum *b, BcNum *restrict c, size_t scale)
powrdx <<= 1;
s = bc_num_mul(&copy, &copy, &copy, powrdx);
if (s) goto err;
+ // It is too slow to handle ^C only after entire "2^1000000" completes
+ if (G_interrupt) {
+ s = BC_STATUS_FAILURE;
+ goto err;
+ }
}
bc_num_copy(c, &copy);
@@ -2054,6 +2059,11 @@ static BcStatus bc_num_p(BcNum *a, BcNum *b, BcNum *restrict c, size_t scale)
s = bc_num_mul(c, &copy, c, resrdx);
if (s) goto err;
}
+ // It is too slow to handle ^C only after entire "2^1000000" completes
+ if (G_interrupt) {
+ s = BC_STATUS_FAILURE;
+ goto err;
+ }
}
if (neg) {