diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-04-27 00:39:31 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-04-27 00:39:31 +0200 |
| commit | eb13267f82e848d9a9b38a2791e5c7008bf8d157 (patch) | |
| tree | 78291e85edd590b0d429a0dab611b85c621d97d7 /bench/libhebimath.h | |
| parent | zstr_length.3: add missing blank space (diff) | |
| download | libzahl-eb13267f82e848d9a9b38a2791e5c7008bf8d157.tar.gz libzahl-eb13267f82e848d9a9b38a2791e5c7008bf8d157.tar.bz2 libzahl-eb13267f82e848d9a9b38a2791e5c7008bf8d157.tar.xz | |
zstr: add new parameter, n: the known limit out the length of the output
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'bench/libhebimath.h')
| -rw-r--r-- | bench/libhebimath.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bench/libhebimath.h b/bench/libhebimath.h index e2ef936..7ddd6d6 100644 --- a/bench/libhebimath.h +++ b/bench/libhebimath.h @@ -79,11 +79,11 @@ zunsetup(void) #define zpow(r, a, b) zpowu(r, a, hebi_get_u(b)) #define zmodpow(r, a, b, m) zmodpowu(r, a, hebi_get_u(b), m) #define zsets(a, s) hebi_set_str(a, s, 0, 10) -#define zstr(a, s) hebi_get_str(s, sizeof(s), a, 10) /* Assumes s is [], not * */ +#define zstr(a, s, n) hebi_get_str(s, n ? n : zstr_length(a, 10) + 1, a, 10) #define zdiv(q, a, b) hebi_div(q, 0, a, b) #define zmod(r, a, b) hebi_div(_a, r, a, b) #define zdivmod(q, r, a, b) hebi_div(q, r, a, b) -#define zsave(a, s) zstr(a, s) +#define zsave(a, s) zstr(a, s, sizeof(s) - 1) #define zload(a, s) zsets(a, s) static size_t |
