bc: rewrite "BOOL * EXPR" idiom as if() statement
function old new delta bc_program_index 66 64 -2 bc_program_num 1147 1130 -17 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-19) Total: -19 bytes text data bss dec hex filename 987619 485 7296 995400 f3048 busybox_old 987600 485 7296 995381 f3035 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
17c5472c5a
commit
d5f7703abb
@ -2031,8 +2031,9 @@ static void bc_num_parseDecimal(BcNum *n, const char *val)
|
|||||||
|
|
||||||
ptr = strchr(val, '.');
|
ptr = strchr(val, '.');
|
||||||
|
|
||||||
// Explicitly test for NULL here to produce either a 0 or 1.
|
n->rdx = 0;
|
||||||
n->rdx = (size_t)((ptr != NULL) * ((val + len) - (ptr + 1)));
|
if (ptr != NULL)
|
||||||
|
n->rdx = (size_t)((val + len) - (ptr + 1));
|
||||||
|
|
||||||
if (!zero) {
|
if (!zero) {
|
||||||
for (i = len - 1; i < len; ++n->len, i -= 1 + (i && val[i - 1] == '.'))
|
for (i = len - 1; i < len; ++n->len, i -= 1 + (i && val[i - 1] == '.'))
|
||||||
@ -2802,7 +2803,7 @@ static BcStatus bc_lex_number(BcLex *l, char start)
|
|||||||
c = buf[++i];
|
c = buf[++i];
|
||||||
}
|
}
|
||||||
|
|
||||||
len = i + 1 * !last_pt - bslashes * 2;
|
len = i + !last_pt - bslashes * 2;
|
||||||
if (len > BC_MAX_NUM)
|
if (len > BC_MAX_NUM)
|
||||||
return bc_error("number too long: must be [1, BC_NUM_MAX]");
|
return bc_error("number too long: must be [1, BC_NUM_MAX]");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user