From 4eb6e555708b6dc091174d2e9d1be78d54de37d5 Mon Sep 17 00:00:00 2001 From: Lorenzo Cogotti Date: Mon, 18 Oct 2021 11:58:25 +0200 Subject: [PATCH] [lonetix/numlib] Make use of smallbytecopy.h for integer conversion result copy --- lonetix/numlib_itoa.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lonetix/numlib_itoa.c b/lonetix/numlib_itoa.c index 2fa3abc..d62df54 100644 --- a/lonetix/numlib_itoa.c +++ b/lonetix/numlib_itoa.c @@ -11,11 +11,7 @@ #include "numlib.h" -#include - -// XXX(micia): benchmark memcpy()-less version, something with rep stos -// amount of data copied over is very small, so it would probably pay off -// leaving memcpy() out +#include "smallbytecopy.h" char *Utoa(unsigned long long x, char *dest) { @@ -31,7 +27,7 @@ char *Utoa(unsigned long long x, char *dest) } while (x != 0); n = (buf + sizeof(buf)) - p; - memcpy(dest, p, n); + _smallbytecopy32(dest, p, n); return dest + n - 1; } @@ -57,7 +53,7 @@ char *Itoa(long long x, char *dest) *--p = '-'; n = (buf + sizeof(buf)) - p; - memcpy(dest, p, n); + _smallbytecopy32(dest, p, n); return dest + n - 1; } @@ -75,6 +71,6 @@ char *Xtoa(unsigned long long x, char *dest) } while (x != 0); n = (buf + sizeof(buf)) - p; - memcpy(dest, p, n); + _smallbytecopy32(dest, p, n); return dest + n - 1; }