shell/math: change ?: nesting code to not have 63 level nesting limitation

function                                             old     new   delta
evaluate_string                                     1406    1432     +26
arith                                                 36      29      -7
arith_apply                                          998     990      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 26/-15)             Total: 11 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2023-06-17 11:03:02 +02:00
parent 6221832bc1
commit 19a74a54de
2 changed files with 21 additions and 14 deletions

View file

@ -57,7 +57,7 @@ typedef const char* FAST_FUNC (*arith_var_lookup_t)(const char *name);
typedef void FAST_FUNC (*arith_var_set_t)(const char *name, const char *val);
typedef struct arith_state_t {
uint64_t evaluation_disabled;
unsigned evaluation_disabled;
const char *errmsg;
void *list_of_recursed_names;
arith_var_lookup_t lookupvar;