libzahl

big integer library
git clone git://git.suckless.org/libzahl
Log | Files | Refs | README | LICENSE

commit d2998cadfbdf13a427966a44a17767c316d6d410
parent ae625b8dacba17e4a41912b5bb16da8f97089681
Author: Mattias Andrée <maandree@kth.se>
Date:   Thu,  3 Mar 2016 21:17:20 +0100

zsets: minor optimisation

Signed-off-by: Mattias Andrée <maandree@kth.se>

Diffstat:
Msrc/zsets.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/zsets.c b/src/zsets.c @@ -27,13 +27,16 @@ zsets(z_t a, const char *str) SET_SIGNUM(a, 0); switch ((str_end - str) % 19) { + case 0: while (*str) { #define X(n)\ temp *= 10, temp += *str++ & 15;\ case n: X(18) X(17) X(16) X(15) X(14) X(13) X(12) X(11) X(10) - X(9) X(8) X(7) X(6) X(5) X(4) X(3) X(2) X(1) X(0) + X(9) X(8) X(7) X(6) X(5) X(4) X(3) X(2) X(1) #undef X + temp *= 10, temp += *str++ & 15; + zmul(a, a, libzahl_const_1e19); zsetu(libzahl_tmp_str_num, temp); zadd(a, a, libzahl_tmp_str_num);