aboutsummaryrefslogtreecommitdiff
path: root/shell/math.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'busybox' into mergeRon Yorston2023-07-131-23/+4
|\
| * shell/math: change ?: nesting code to not have 63 level nesting limitationDenys Vlasenko2023-06-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
| * shell/math.h: update comments, rearrange struct members for smaller codeDenys Vlasenko2023-06-171-22/+4
| | | | | | | | | | | | | | | | | | | | function old new delta arith_apply 1000 998 -2 evaluate_string 1414 1406 -8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-10) Total: -10 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell/math: fix ?: to not evaluate not-taken branchesDenys Vlasenko2023-06-161-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This fixes ash-arith-arith-ternary1/2.tests function old new delta evaluate_string 1271 1432 +161 arith_apply 968 1000 +32 arith 22 36 +14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 207/0) Total: 207 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2019-05-271-3/+1
|\|
| * shell: move all definitions of strto_arith_t() togetherDenys Vlasenko2019-05-261-8/+0
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell: implement optional "BASE#nnnn" numeric literalsDenys Vlasenko2019-05-191-6/+10
| | | | | | | | | | | | | | function old new delta evaluate_string 729 851 +122 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell: add TODO comment about BASE#nnn literalsDenys Vlasenko2019-05-161-0/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Use %I64* formats with MinGW instead of %ll* formatsJohannes Schindelin2017-07-181-1/+1
|/ | | | | | | | | | | | | | The MSVC runtime uses the format specified %I64 for 64-bit data types; It does not understand e.g. %llu for unsigned long longs. However, mingw-w64 provides a compatibility mode in its runtime wrapper which can be activated by defining the constant __USE_MINGW_ANSI_STDIO=1 in which case we must refrain from overriding the %ll* formats. This fixes quite a couple of compile warnings when building with the mingw-w64 compiler. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* Make it possible to select "sh" and "bash" aliases without selecting ash or hushDenys Vlasenko2016-12-231-1/+1
| | | | | | | The same can be done for msh, but we are probably better off just deleting it in a next versio or two. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* move endofname() to libbbDenys Vlasenko2013-02-261-5/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell/math: deconvolute and explain ?: handling. Give better error messageDenys Vlasenko2010-09-161-16/+4
| | | | | | | function old new delta arith_apply 1271 1283 +12 Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* shell/math: return string error indicator, not integerDenys Vlasenko2010-09-151-1/+1
| | | | | | | | | | | | | | | | function old new delta expand_and_evaluate_arith 87 106 +19 expand_one_var 1563 1570 +7 arith 12 18 +6 evaluate_string 678 680 +2 arith_apply 1269 1271 +2 builtin_umask 133 132 -1 ash_arith 118 75 -43 expand_vars_to_list 1094 1038 -56 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/3 up/down: 36/-100) Total: -64 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* shell/math.c: stop using bss variableDenys Vlasenko2010-09-131-2/+3
| | | | | | | | | | | | | | | | function old new delta evaluate_string - 678 +678 expand_one_var 1543 1563 +20 builtin_type 114 116 +2 expand_and_evaluate_arith 89 87 -2 prev_chk_var_recursive 4 - -4 ash_arith 122 118 -4 arith_lookup_val 142 132 -10 arith 674 12 -662 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 2/4 up/down: 700/-682) Total: 18 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* shell/math.c: rename arith_eval_hooks to arith_state, put error code into itDenys Vlasenko2010-09-131-46/+45
| | | | | | | | | | | | | function old new delta expand_and_evaluate_arith 79 89 +10 arith 675 674 -1 arith_lookup_val 151 142 -9 ash_arith 135 122 -13 arith_apply 1304 1269 -35 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/4 up/down: 10/-58) Total: -48 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* shell: unify endofname() in hush and ashDenys Vlasenko2010-09-071-2/+7
| | | | | | | | | | | | | function old new delta builtin_umask 132 133 +1 changepath 195 194 -1 expand_and_evaluate_arith 77 69 -8 ash_arith 143 135 -8 expand_one_var 1551 1515 -36 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/4 up/down: 1/-53) Total: -52 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* hush: use ash's read builtinDenys Vlasenko2010-01-121-5/+6
| | | | | | | | | | | | | | | | | function old new delta shell_builtin_read - 1000 +1000 set_local_var_from_halves - 24 +24 setvar2 - 7 +7 ... popstring 140 134 -6 ash_main 1375 1368 -7 setvar 184 174 -10 arith_set_local_var 36 - -36 builtin_read 1096 185 -911 ------------------------------------------------------------------------------ (add/remove: 3/1 grow/shrink: 5/23 up/down: 1038/-1007) Total: 31 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* printf: accept negative numbers for %x; sh: overflowed numbers are 0Denys Vlasenko2009-06-051-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: make "pragma GCC visibility push(hidden)" less uglyDenis Vlasenko2009-04-091-2/+6
|
* shell/math: randomconfig fixDenis Vlasenko2009-04-031-3/+1
|
* split math code out of ash and into a standalone library so we can use it in ↵Mike Frysinger2009-04-021-0/+101
any shell (like hush!)