From a7746f9cd2f89fc760b54c831088c507ce24f9f5 Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 25 Oct 2018 23:31:25 +0000 Subject: [PATCH] Make tabledivide64 actually return an int64_t... git-svn-id: https://svn.eduke32.com/eduke32@7108 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/pragmas.h | 10 +++++----- source/build/src/pragmas.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/build/include/pragmas.h b/source/build/include/pragmas.h index 37843a2ca..955abf209 100644 --- a/source/build/include/pragmas.h +++ b/source/build/include/pragmas.h @@ -57,11 +57,11 @@ skip: return libdivide_u32_do(n, &udiv); } -static inline int32_t tabledivide64(int64_t n, int32_t d) +static inline int64_t tabledivide64(int64_t n, int32_t d) { static libdivide_s64_t sdiv; static int32_t lastd; - libdivide_s64_t const * const dptr = ((unsigned)d < DIVTABLESIZE) ? (libdivide_s64_t *)&divtable64[d] : &sdiv; + auto const dptr = ((unsigned)d < DIVTABLESIZE) ? (libdivide_s64_t *)&divtable64[d] : &sdiv; if (d == lastd || dptr != &sdiv) goto skip; @@ -75,7 +75,7 @@ static inline int32_t tabledivide32(int32_t n, int32_t d) { static libdivide_s32_t sdiv; static int32_t lastd; - libdivide_s32_t const * const dptr = ((unsigned)d < DIVTABLESIZE) ? (libdivide_s32_t *)&divtable32[d] : &sdiv; + auto const dptr = ((unsigned)d < DIVTABLESIZE) ? (libdivide_s32_t *)&divtable32[d] : &sdiv; if (d == lastd || dptr != &sdiv) goto skip; @@ -87,7 +87,7 @@ skip: #else static FORCE_INLINE uint32_t divideu32(uint32_t n, uint32_t d) { return n / d; } -static inline int32_t tabledivide64(int64_t n, int32_t d) +static inline int64_t tabledivide64(int64_t n, int32_t d) { return ((unsigned)d < DIVTABLESIZE) ? libdivide_s64_do(n, (libdivide_s64_t *)&divtable64[d]) : n / d; } @@ -100,7 +100,7 @@ static inline int32_t tabledivide32(int32_t n, int32_t d) extern uint32_t divideu32_noinline(uint32_t n, uint32_t d); extern int32_t tabledivide32_noinline(int32_t n, int32_t d); -extern int32_t tabledivide64_noinline(int64_t n, int32_t d); +extern int64_t tabledivide64_noinline(int64_t n, int32_t d); #ifdef GEKKO static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx) { return tabledivide64(ldexp(eax, ecx), ebx); } diff --git a/source/build/src/pragmas.cpp b/source/build/src/pragmas.cpp index 4c7164ffa..65d17093a 100644 --- a/source/build/src/pragmas.cpp +++ b/source/build/src/pragmas.cpp @@ -29,7 +29,7 @@ void initdivtables(void) uint32_t divideu32_noinline(uint32_t n, uint32_t d) { return divideu32(n, d); } int32_t tabledivide32_noinline(int32_t n, int32_t d) { return tabledivide32(n, d); } -int32_t tabledivide64_noinline(int64_t n, int32_t d) { return tabledivide64(n, d); } +int64_t tabledivide64_noinline(int64_t n, int32_t d) { return tabledivide64(n, d); } int32_t dmval;