[BusyBox] Long long arithmetics

Paweł Sakowski pawel at sakowski.eu.org
Fri Apr 2 17:59:11 UTC 2004


A useful feature of busybox'es ash would be to perform its $(( ))
arithmetics using long long numbers, not long. I actually needed that
feature myself (and hacked ash.c myself to support it), I believe it
might be useful for others too.

By the way, in busybox-1.00-pre7's ash.c, the dash_arith function is
declared to return int, while it performs its calculations on longs and
its return value is used as a long. It's probably unintended and might
cause unwanted truncation on architectures where
sizeof(long)!=sizeof(int) (not the case Linux at IA32). So, dash_arith
should have its return value declared as long (or long long if you
implement the arithmetics on this type).

-- 
+----------------------------------------------------------------------+
| Paweł Sakowski <pawel at sakowski.eu.org>            Never trust a man  |
|                            who can count up to 1023 on his fingers.  |
+----------------------------------------------------------------------+




More information about the busybox mailing list