diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-29 16:54:37 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-29 17:02:06 +0100 |
| commit | 40f9fe21600a834fdcf1f26e9374fd21cd3be5fb (patch) | |
| tree | 05991f397bb57332d2add17f0de0109bd12f3ce9 | |
| parent | 77a51a2709de1b646ab493f0bf771d896de6efc2 (diff) | |
| download | busybox-w32-40f9fe21600a834fdcf1f26e9374fd21cd3be5fb.tar.gz busybox-w32-40f9fe21600a834fdcf1f26e9374fd21cd3be5fb.tar.bz2 busybox-w32-40f9fe21600a834fdcf1f26e9374fd21cd3be5fb.zip | |
bc: placate gcc (it thinks 's' can be uninitialized here)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | miscutils/bc.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 1227e2d13..59e18a8c1 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
| @@ -2201,8 +2201,8 @@ static BC_STATUS zbc_num_sqrt(BcNum *a, BcNum *restrict b, size_t scale) | |||
| 2201 | BcStatus s; | 2201 | BcStatus s; |
| 2202 | BcNum num1, num2, half, f, fprime, *x0, *x1, *temp; | 2202 | BcNum num1, num2, half, f, fprime, *x0, *x1, *temp; |
| 2203 | BcDig half_digs[1]; | 2203 | BcDig half_digs[1]; |
| 2204 | size_t pow, len, digs, digs1, resrdx, req, times = 0; | 2204 | size_t pow, len, digs, digs1, resrdx, req, times; |
| 2205 | ssize_t cmp = 1, cmp1 = SSIZE_MAX, cmp2 = SSIZE_MAX; | 2205 | ssize_t cmp, cmp1, cmp2; |
| 2206 | 2206 | ||
| 2207 | req = BC_MAX(scale, a->rdx) + ((BC_NUM_INT(a) + 1) >> 1) + 1; | 2207 | req = BC_MAX(scale, a->rdx) + ((BC_NUM_INT(a) + 1) >> 1) + 1; |
| 2208 | bc_num_expand(b, req); | 2208 | bc_num_expand(b, req); |
| @@ -2255,11 +2255,12 @@ static BC_STATUS zbc_num_sqrt(BcNum *a, BcNum *restrict b, size_t scale) | |||
| 2255 | x0->rdx -= pow; | 2255 | x0->rdx -= pow; |
| 2256 | } | 2256 | } |
| 2257 | 2257 | ||
| 2258 | x0->rdx = digs = digs1 = 0; | 2258 | x0->rdx = digs = digs1 = times = 0; |
| 2259 | resrdx = scale + 2; | 2259 | resrdx = scale + 2; |
| 2260 | len = BC_NUM_INT(x0) + resrdx - 1; | 2260 | len = x0->len + resrdx - 1; |
| 2261 | 2261 | cmp = 1; | |
| 2262 | while (cmp != 0 || digs < len) { | 2262 | cmp1 = cmp2 = SSIZE_MAX; |
| 2263 | do { | ||
| 2263 | s = zbc_num_div(a, x0, &f, resrdx); | 2264 | s = zbc_num_div(a, x0, &f, resrdx); |
| 2264 | if (s) goto err; | 2265 | if (s) goto err; |
| 2265 | s = zbc_num_add(x0, &f, &fprime, resrdx); | 2266 | s = zbc_num_add(x0, &f, &fprime, resrdx); |
| @@ -2284,11 +2285,12 @@ static BC_STATUS zbc_num_sqrt(BcNum *a, BcNum *restrict b, size_t scale) | |||
| 2284 | temp = x0; | 2285 | temp = x0; |
| 2285 | x0 = x1; | 2286 | x0 = x1; |
| 2286 | x1 = temp; | 2287 | x1 = temp; |
| 2287 | } | 2288 | } while (cmp != 0 || digs < len); |
| 2288 | 2289 | ||
| 2289 | bc_num_copy(b, x0); | 2290 | bc_num_copy(b, x0); |
| 2290 | scale -= 1; | 2291 | scale -= 1; |
| 2291 | if (b->rdx > scale) bc_num_truncate(b, b->rdx - scale); | 2292 | if (b->rdx > scale) |
| 2293 | bc_num_truncate(b, b->rdx - scale); | ||
| 2292 | err: | 2294 | err: |
| 2293 | bc_num_free(&fprime); | 2295 | bc_num_free(&fprime); |
| 2294 | bc_num_free(&f); | 2296 | bc_num_free(&f); |
