From df28860bad28b50577c9221cfa3de0725fbdbe90 Mon Sep 17 00:00:00 2001 From: terminx Date: Wed, 24 Jul 2019 01:37:50 +0000 Subject: [PATCH] Add divscale64() git-svn-id: https://svn.eduke32.com/eduke32@7826 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/pragmas.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/build/include/pragmas.h b/source/build/include/pragmas.h index 5cb1bfb1c..18e4770d4 100644 --- a/source/build/include/pragmas.h +++ b/source/build/include/pragmas.h @@ -91,11 +91,13 @@ extern int32_t tabledivide32_noinline(int32_t n, int32_t d); extern int64_t tabledivide64_noinline(int64_t n, int64_t d); #ifdef GEKKO -static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx) { return tabledivide64(ldexp(eax, ecx), ebx); } +static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx) { return dw(tabledivide64(ldexp(eax, ecx), ebx)); } #else static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx) { return dw(tabledivide64(qw(eax) << by(ecx), ebx)); } #endif +static inline int64_t divscale64(int64_t eax, int64_t ebx, int64_t ecx) { return tabledivide64(eax << ecx, ebx); } + #define EDUKE32_SCALER_PRAGMA(a) \ static FORCE_INLINE int32_t divscale##a(int32_t eax, int32_t ebx) { return divscale(eax, ebx, a); } EDUKE32_GENERATE_PRAGMAS EDUKE32_SCALER_PRAGMA(32)