mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Update libdivide from git
git-svn-id: https://svn.eduke32.com/eduke32@7715 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
4a09e2a183
commit
db7a2bd0db
4 changed files with 1135 additions and 1141 deletions
File diff suppressed because it is too large
Load diff
|
@ -41,49 +41,49 @@ extern int32_t reciptable[2048], fpuasm;
|
|||
|
||||
#define DIVTABLESIZE 16384
|
||||
|
||||
extern libdivide_s64_t divtable64[DIVTABLESIZE];
|
||||
extern libdivide_s32_t divtable32[DIVTABLESIZE];
|
||||
extern libdivide::libdivide_s64_t divtable64[DIVTABLESIZE];
|
||||
extern libdivide::libdivide_s32_t divtable32[DIVTABLESIZE];
|
||||
extern void initdivtables(void);
|
||||
|
||||
static inline uint32_t divideu32(uint32_t const n, uint32_t const d)
|
||||
{
|
||||
static libdivide_u32_t udiv;
|
||||
static libdivide::libdivide_u32_t udiv;
|
||||
static uint32_t lastd;
|
||||
|
||||
if (d == lastd)
|
||||
goto skip;
|
||||
|
||||
udiv = libdivide_u32_gen((lastd = d));
|
||||
udiv = libdivide::libdivide_u32_gen((lastd = d));
|
||||
skip:
|
||||
return libdivide_u32_do(n, &udiv);
|
||||
return libdivide::libdivide_u32_do(n, &udiv);
|
||||
}
|
||||
|
||||
static inline int64_t tabledivide64(int64_t const n, int32_t const d)
|
||||
{
|
||||
static libdivide_s64_t sdiv;
|
||||
static libdivide::libdivide_s64_t sdiv;
|
||||
static int32_t lastd;
|
||||
auto const dptr = ((unsigned)d < DIVTABLESIZE) ? &divtable64[d] : &sdiv;
|
||||
|
||||
if (d == lastd || dptr != &sdiv)
|
||||
goto skip;
|
||||
|
||||
sdiv = libdivide_s64_gen((lastd = d));
|
||||
sdiv = libdivide::libdivide_s64_gen((lastd = d));
|
||||
skip:
|
||||
return libdivide_s64_do(n, dptr);
|
||||
return libdivide::libdivide_s64_do(n, dptr);
|
||||
}
|
||||
|
||||
static inline int32_t tabledivide32(int32_t const n, int32_t const d)
|
||||
{
|
||||
static libdivide_s32_t sdiv;
|
||||
static libdivide::libdivide_s32_t sdiv;
|
||||
static int32_t lastd;
|
||||
auto const dptr = ((unsigned)d < DIVTABLESIZE) ? &divtable32[d] : &sdiv;
|
||||
|
||||
if (d == lastd || dptr != &sdiv)
|
||||
goto skip;
|
||||
|
||||
sdiv = libdivide_s32_gen((lastd = d));
|
||||
sdiv = libdivide::libdivide_s32_gen((lastd = d));
|
||||
skip:
|
||||
return libdivide_s32_do(n, dptr);
|
||||
return libdivide::libdivide_s32_do(n, dptr);
|
||||
}
|
||||
|
||||
extern uint32_t divideu32_noinline(uint32_t n, uint32_t d);
|
||||
|
|
|
@ -10,15 +10,15 @@
|
|||
#include "compat.h"
|
||||
#include "pragmas.h"
|
||||
|
||||
libdivide_s64_t divtable64[DIVTABLESIZE];
|
||||
libdivide_s32_t divtable32[DIVTABLESIZE];
|
||||
libdivide::libdivide_s64_t divtable64[DIVTABLESIZE];
|
||||
libdivide::libdivide_s32_t divtable32[DIVTABLESIZE];
|
||||
|
||||
void initdivtables(void)
|
||||
{
|
||||
for (int i = 1; i < DIVTABLESIZE; ++i)
|
||||
{
|
||||
divtable64[i] = libdivide_s64_gen(i);
|
||||
divtable32[i] = libdivide_s32_gen(i);
|
||||
divtable64[i] = libdivide::libdivide_s64_gen(i);
|
||||
divtable32[i] = libdivide::libdivide_s32_gen(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -242,15 +242,15 @@ static FORCE_INLINE void __fastcall Gv_DivVar(int const id, int32_t const operan
|
|||
return;
|
||||
|
||||
bool const foundInTable = (unsigned) operand < DIVTABLESIZE;
|
||||
static libdivide_s32_t sdiv;
|
||||
static libdivide::libdivide_s32_t sdiv;
|
||||
intptr_t *iptr = &var.global;
|
||||
static int32_t lastValue;
|
||||
auto dptr = foundInTable ? (libdivide_s32_t *) &divtable32[operand] : &sdiv;
|
||||
auto dptr = foundInTable ? (libdivide::libdivide_s32_t *) &divtable32[operand] : &sdiv;
|
||||
|
||||
if (operand == lastValue || foundInTable)
|
||||
goto skip;
|
||||
|
||||
sdiv = libdivide_s32_gen((lastValue = operand));
|
||||
sdiv = libdivide::libdivide_s32_gen((lastValue = operand));
|
||||
|
||||
skip:
|
||||
switch (var.flags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK))
|
||||
|
@ -262,13 +262,13 @@ skip:
|
|||
case GAMEVAR_INT32PTR:
|
||||
{
|
||||
int32_t &value = *(int32_t *)var.pValues;
|
||||
value = (int32_t)libdivide_s32_do(value, dptr);
|
||||
value = (int32_t)libdivide::libdivide_s32_do(value, dptr);
|
||||
return;
|
||||
}
|
||||
case GAMEVAR_INT16PTR:
|
||||
{
|
||||
int16_t &value = *(int16_t *)var.pValues;
|
||||
value = (int16_t)libdivide_s32_do(value, dptr);
|
||||
value = (int16_t)libdivide::libdivide_s32_do(value, dptr);
|
||||
return;
|
||||
}
|
||||
case GAMEVAR_Q16PTR:
|
||||
|
|
Loading…
Reference in a new issue