From 79f72d84b8fc9d246c1580968f2c0cfa269200d9 Mon Sep 17 00:00:00 2001 From: dzaima Date: Fri, 28 Jul 2023 01:47:57 +0300 Subject: [PATCH] extract unsigned & f32 copying functions in ffi.c --- src/ffi.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/src/ffi.c b/src/ffi.c index e9506fe3..7fa4b12c 100644 --- a/src/ffi.c +++ b/src/ffi.c @@ -524,6 +524,33 @@ static B makeRe(u8 reT, u8 reW/*log*/, u8* src, u32 elW/*bytes*/) { FORCE_INLINE u64 i64abs(i64 x) { return x<0?-x:x; } +#define CPY_UNSIGNED(REL, UEL, DIRECT, WIDEN, WEL) \ + if (TI(x,elType)<=el_##REL) return taga(DIRECT(x)); \ + usz ia = IA(x); \ + B t = WIDEN(x); WEL* tp = WEL##any_ptr(t); \ + REL* rp; B r = m_##REL##arrv(&rp, ia); \ + for (usz i=0; i