From eb13267f82e848d9a9b38a2791e5c7008bf8d157 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 27 Apr 2016 00:39:31 +0200 Subject: zstr: add new parameter, n: the known limit out the length of the output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- bench/libhebimath.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bench/libhebimath.h') 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 -- cgit v1.2.3-70-g09d2