bc: simplify bc_program_len()
function old new delta bc_program_len 42 34 -8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
44d79d866d
commit
a7f1a36540
@ -6254,12 +6254,14 @@ static unsigned long bc_program_scale(BcNum *n)
|
||||
|
||||
static unsigned long bc_program_len(BcNum *n)
|
||||
{
|
||||
unsigned long len = n->len;
|
||||
size_t i;
|
||||
|
||||
if (n->rdx != n->len) return len;
|
||||
for (i = n->len - 1; i < n->len && n->num[i] == 0; --len, --i);
|
||||
size_t len = n->len;
|
||||
|
||||
if (n->rdx != len) return len;
|
||||
for (;;) {
|
||||
if (len == 0) break;
|
||||
len--;
|
||||
if (n->num[len] != 0) break;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user