Make tabledivide64 actually return an int64_t...

git-svn-id: https://svn.eduke32.com/eduke32@7108 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-10-25 23:31:25 +00:00
parent cee9a65970
commit a7746f9cd2
2 changed files with 6 additions and 6 deletions

View file

@ -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); }

View file

@ -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;