libzahl

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

commit fa8d9c7e2be2b8953d1d3f2732c34741debd133a
parent 5e77b994435be4bef66ff596bf931e1fff97a77c
Author: Mattias Andrée <maandree@kth.se>
Date:   Sat, 12 Mar 2016 20:41:10 +0100

64 bits (severely) outshines 16 bits and 8 bits in performance: do some cleanup

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

Diffstat:
Msrc/internals.h | 1-
Msrc/zsets.c | 19-------------------
2 files changed, 0 insertions(+), 20 deletions(-)

diff --git a/src/internals.h b/src/internals.h @@ -40,7 +40,6 @@ #define LIST_CONSTS\ X(libzahl_const_1e19, zsetu, 10000000000000000000ULL) /* The largest power of 10 < 2⁶⁴. */\ - X(libzahl_const_1e9, zsetu, 1000000000ULL) /* The largest power of 10 < 2³². */\ X(libzahl_const_1, zsetu, 1)\ X(libzahl_const_2, zsetu, 2)\ X(libzahl_const_4, zsetu, 4) diff --git a/src/zsets.c b/src/zsets.c @@ -26,7 +26,6 @@ zsets(z_t a, const char *str) SET_SIGNUM(a, 0); -#if 1 zset(libzahl_tmp_str_num, libzahl_const_1e19); switch ((str_end - str) % 19) { while (*str) { @@ -44,24 +43,6 @@ zsets(z_t a, const char *str) zadd(a, a, libzahl_tmp_str_num); } } -#else - zset(libzahl_tmp_str_num, libzahl_const_1); - switch ((str_end - str) % 9) { - while (*str) { - zmul(a, a, libzahl_const_1e9); - temp = 0; -#define X(n)\ - case n:\ - temp *= 10, temp += *str++ & 15; - X(0) X(8) X(7) X(6) X(5) X(4) X(3) X(2) X(1) -#undef X - if (!temp) - continue; - libzahl_tmp_str_num->chars[0] = temp; - zadd(a, a, libzahl_tmp_str_num); - } - } -#endif if (neg) SET_SIGNUM(a, -zsignum(a));