mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- removed libdivide for good and the unused C++ wrapper for fix16 along with it.
This commit is contained in:
parent
3cd475570c
commit
05abc262ba
11 changed files with 9 additions and 2323 deletions
|
@ -776,7 +776,6 @@ set (PCH_SOURCES
|
|||
build/src/mdsprite.cpp
|
||||
build/src/mhk.cpp
|
||||
build/src/polymost.cpp
|
||||
build/src/pragmas.cpp
|
||||
build/src/scriptfile.cpp
|
||||
build/src/timer.cpp
|
||||
build/src/voxmodel.cpp
|
||||
|
|
|
@ -5023,7 +5023,7 @@ void MoveDude(spritetype *pSprite)
|
|||
{
|
||||
xvel[pFX2->index] = Random2(0x6aaaa);
|
||||
yvel[pFX2->index] = Random2(0x6aaaa);
|
||||
zvel[pFX2->index] = -Random(0xd5555);
|
||||
zvel[pFX2->index] = -(int)Random(0xd5555);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -288,7 +288,7 @@ void fxSpawnBlood(spritetype *pSprite, int a2)
|
|||
pBlood->ang = 1024;
|
||||
xvel[pBlood->index] = Random2(0x6aaaa);
|
||||
yvel[pBlood->index] = Random2(0x6aaaa);
|
||||
zvel[pBlood->index] = -Random(0x10aaaa)-100;
|
||||
zvel[pBlood->index] = -(int)Random(0x10aaaa)-100;
|
||||
evPost(pBlood->index, 3, 8, kCallbackFXBloodSpurt);
|
||||
}
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ void sub_746D4(spritetype *pSprite, int a2)
|
|||
pSpawn->ang = 1024;
|
||||
xvel[pSpawn->index] = Random2(0x6aaaa);
|
||||
yvel[pSpawn->index] = Random2(0x6aaaa);
|
||||
zvel[pSpawn->index] = -Random(0x10aaaa)-100;
|
||||
zvel[pSpawn->index] = -(int)Random(0x10aaaa)-100;
|
||||
evPost(pSpawn->index, 3, 8, kCallbackFXPodBloodSpray);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -345,12 +345,12 @@ void GibFX(spritetype *pSprite, GIBFX *pGFX, CGibPosition *pPos, CGibVelocity *p
|
|||
}
|
||||
else if (dz2 > dz1 && dz1 < 0x4000)
|
||||
{
|
||||
zvel[pFX->index] = -Random((klabs(pGFX->at11)<<18)/120);
|
||||
zvel[pFX->index] = -(int)Random((klabs(pGFX->at11)<<18)/120);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((pGFX->at11<<18)/120 < 0)
|
||||
zvel[pFX->index] = -Random((klabs(pGFX->at11)<<18)/120);
|
||||
zvel[pFX->index] = -(int)Random((klabs(pGFX->at11)<<18)/120);
|
||||
else
|
||||
zvel[pFX->index] = Random2((pGFX->at11<<18)/120);
|
||||
}
|
||||
|
@ -419,7 +419,7 @@ void GibThing(spritetype *pSprite, GIBTHING *pGThing, CGibPosition *pPos, CGibVe
|
|||
}
|
||||
else if (dz2 > dz1 && dz1 < 0x4000)
|
||||
{
|
||||
zvel[pGib->index] = -Random((pGThing->at10<<18)/120);
|
||||
zvel[pGib->index] = -(int)Random((pGThing->at10<<18)/120);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -472,13 +472,13 @@ void GibFX(int nWall, GIBFX * pGFX, int a3, int a4, int a5, int a6, CGibVelocity
|
|||
{
|
||||
xvel[pGib->index] = Random2((pGFX->atd<<18)/120);
|
||||
yvel[pGib->index] = Random2((pGFX->atd<<18)/120);
|
||||
zvel[pGib->index] = -Random((pGFX->at11<<18)/120);
|
||||
zvel[pGib->index] = -(int)Random((pGFX->at11<<18)/120);
|
||||
}
|
||||
else
|
||||
{
|
||||
xvel[pGib->index] = Random2((pVel->vx<<18)/120);
|
||||
yvel[pGib->index] = Random2((pVel->vy<<18)/120);
|
||||
zvel[pGib->index] = -Random((pVel->vz<<18)/120);
|
||||
zvel[pGib->index] = -(int)Random((pVel->vz<<18)/120);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1017,7 +1017,6 @@ void *handle_memerr(void *);
|
|||
#define LIBDIVIDE_NONAMESPACE
|
||||
#define LIBDIVIDE_NOINLINE
|
||||
#include "fix16.h"
|
||||
#include "libdivide.h"
|
||||
#include "vectors.h"
|
||||
using ClockTicks = int;
|
||||
|
||||
|
|
|
@ -33,24 +33,6 @@ extern int32_t reciptable[2048];
|
|||
|
||||
#define DIVTABLESIZE 16384
|
||||
|
||||
extern libdivide::libdivide_s64_t divtable64[DIVTABLESIZE];
|
||||
extern libdivide::libdivide_s32_t divtable32[DIVTABLESIZE];
|
||||
extern void initdivtables(void);
|
||||
|
||||
static inline int64_t tabledivide64(int64_t const n, int64_t const d)
|
||||
{
|
||||
static libdivide::libdivide_s64_t sdiv;
|
||||
static int64_t lastd;
|
||||
auto const dptr = ((uint64_t)d < DIVTABLESIZE) ? &divtable64[d] : &sdiv;
|
||||
|
||||
if (d == lastd || dptr != &sdiv)
|
||||
goto skip;
|
||||
|
||||
sdiv = libdivide::libdivide_s64_gen((lastd = d));
|
||||
skip:
|
||||
return libdivide::libdivide_s64_do(n, dptr);
|
||||
}
|
||||
|
||||
static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx) { return (int64_t(eax) << ecx) / ebx; }
|
||||
|
||||
static inline int64_t divscale64(int64_t eax, int64_t ebx, int64_t ecx) { return (eax << ecx) / ebx; }
|
||||
|
|
|
@ -568,7 +568,7 @@ static inline void initksqrt(void)
|
|||
temp = root*root-num;
|
||||
while (klabs(int32_t(temp-2*root+1)) < klabs(temp))
|
||||
{
|
||||
temp += -(2*root)+1;
|
||||
temp += 1-int(2*root);
|
||||
root--;
|
||||
}
|
||||
while (klabs(int32_t(temp+2*root+1)) < klabs(temp))
|
||||
|
@ -1066,7 +1066,6 @@ static tspritetype tsprite_s[MAXSPRITESONSCREEN];
|
|||
int32_t enginePreInit(void)
|
||||
{
|
||||
polymost_initosdfuncs();
|
||||
initdivtables();
|
||||
|
||||
#if !defined DEBUG_MAIN_ARRAYS
|
||||
sector = sector_s;
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
// Function-wrapped Watcom pragmas
|
||||
// by Jonathon Fowler (jf@jonof.id.au)
|
||||
//
|
||||
// These functions represent some of the more longer-winded pragmas
|
||||
// from the original pragmas.h wrapped into functions for easier
|
||||
// use since many jumps and whatnot make it harder to write macro-
|
||||
// inline versions. I'll eventually convert these to macro-inline
|
||||
// equivalents. --Jonathon
|
||||
|
||||
#include "compat.h"
|
||||
#include "pragmas.h"
|
||||
|
||||
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::libdivide_s64_gen(i);
|
||||
divtable32[i] = libdivide::libdivide_s32_gen(i);
|
||||
}
|
||||
}
|
||||
|
2
source/thirdparty/include/fix16.h
vendored
2
source/thirdparty/include/fix16.h
vendored
|
@ -297,6 +297,4 @@ extern fix16_t fix16_from_str(const char *buf);
|
|||
) \
|
||||
)
|
||||
|
||||
#include "fix16.hpp"
|
||||
|
||||
#endif
|
||||
|
|
180
source/thirdparty/include/fix16.hpp
vendored
180
source/thirdparty/include/fix16.hpp
vendored
|
@ -1,180 +0,0 @@
|
|||
#ifndef __libfixmath_fix16_hpp__
|
||||
#define __libfixmath_fix16_hpp__
|
||||
|
||||
#include "fix16.h"
|
||||
|
||||
class Fix16 {
|
||||
public:
|
||||
fix16_t value;
|
||||
|
||||
Fix16() { value = 0; }
|
||||
Fix16(const Fix16 &inValue) { value = inValue.value; }
|
||||
Fix16(const fix16_t inValue) { value = inValue; }
|
||||
Fix16(const float inValue) { value = fix16_from_float(inValue); }
|
||||
Fix16(const double inValue) { value = fix16_from_dbl(inValue); }
|
||||
Fix16(const int16_t inValue) { value = fix16_from_int(inValue); }
|
||||
|
||||
operator fix16_t() const { return value; }
|
||||
operator double() const { return fix16_to_dbl(value); }
|
||||
operator float() const { return fix16_to_float(value); }
|
||||
operator int16_t() const { return fix16_to_int(value); }
|
||||
|
||||
Fix16 & operator=(const Fix16 &rhs) { value = rhs.value; return *this; }
|
||||
Fix16 & operator=(const fix16_t rhs) { value = rhs; return *this; }
|
||||
Fix16 & operator=(const double rhs) { value = fix16_from_dbl(rhs); return *this; }
|
||||
Fix16 & operator=(const float rhs) { value = fix16_from_float(rhs); return *this; }
|
||||
Fix16 & operator=(const int16_t rhs) { value = fix16_from_int(rhs); return *this; }
|
||||
|
||||
Fix16 & operator+=(const Fix16 &rhs) { value += rhs.value; return *this; }
|
||||
Fix16 & operator+=(const fix16_t rhs) { value += rhs; return *this; }
|
||||
Fix16 & operator+=(const double rhs) { value += fix16_from_dbl(rhs); return *this; }
|
||||
Fix16 & operator+=(const float rhs) { value += fix16_from_float(rhs); return *this; }
|
||||
Fix16 & operator+=(const int16_t rhs) { value += fix16_from_int(rhs); return *this; }
|
||||
|
||||
Fix16 & operator-=(const Fix16 &rhs) { value -= rhs.value; return *this; }
|
||||
Fix16 & operator-=(const fix16_t rhs) { value -= rhs; return *this; }
|
||||
Fix16 & operator-=(const double rhs) { value -= fix16_from_dbl(rhs); return *this; }
|
||||
Fix16 & operator-=(const float rhs) { value -= fix16_from_float(rhs); return *this; }
|
||||
Fix16 & operator-=(const int16_t rhs) { value -= fix16_from_int(rhs); return *this; }
|
||||
|
||||
Fix16 & operator*=(const Fix16 &rhs) { value = fix16_mul(value, rhs.value); return *this; }
|
||||
Fix16 & operator*=(const fix16_t rhs) { value = fix16_mul(value, rhs); return *this; }
|
||||
Fix16 & operator*=(const double rhs) { value = fix16_mul(value, fix16_from_dbl(rhs)); return *this; }
|
||||
Fix16 & operator*=(const float rhs) { value = fix16_mul(value, fix16_from_float(rhs)); return *this; }
|
||||
Fix16 & operator*=(const int16_t rhs) { value *= rhs; return *this; }
|
||||
|
||||
Fix16 & operator/=(const Fix16 &rhs) { value = fix16_div(value, rhs.value); return *this; }
|
||||
Fix16 & operator/=(const fix16_t rhs) { value = fix16_div(value, rhs); return *this; }
|
||||
Fix16 & operator/=(const double rhs) { value = fix16_div(value, fix16_from_dbl(rhs)); return *this; }
|
||||
Fix16 & operator/=(const float rhs) { value = fix16_div(value, fix16_from_float(rhs)); return *this; }
|
||||
Fix16 & operator/=(const int16_t rhs) { value /= rhs; return *this; }
|
||||
|
||||
Fix16 & operator%=(const Fix16 &rhs) { value = fix16_mod(value, rhs.value); return *this; }
|
||||
Fix16 & operator%=(const fix16_t rhs) { value = fix16_mod(value, rhs); return *this; }
|
||||
Fix16 & operator%=(const double rhs) { value = fix16_mod(value, fix16_from_dbl(rhs)); return *this; }
|
||||
Fix16 & operator%=(const float rhs) { value = fix16_mod(value, fix16_from_float(rhs)); return *this; }
|
||||
Fix16 & operator%=(const int16_t rhs) { value %= rhs; return *this; }
|
||||
|
||||
Fix16 & operator&=(const Fix16 &rhs) { value = fix16_from_int(fix16_to_int(value) & fix16_to_int(rhs.value)); return *this; }
|
||||
Fix16 & operator&=(const fix16_t rhs) { value = fix16_from_int(fix16_to_int(value) & fix16_to_int(rhs)); return *this; }
|
||||
Fix16 & operator&=(const int16_t rhs) { value = fix16_from_int(fix16_to_int(value) & rhs); return *this; }
|
||||
|
||||
Fix16 & operator^=(const Fix16 &rhs) { value = fix16_from_int(fix16_to_int(value) ^ fix16_to_int(rhs.value)); return *this; }
|
||||
Fix16 & operator^=(const fix16_t rhs) { value = fix16_from_int(fix16_to_int(value) ^ fix16_to_int(rhs)); return *this; }
|
||||
Fix16 & operator^=(const int16_t rhs) { value = fix16_from_int(fix16_to_int(value) ^ rhs); return *this; }
|
||||
|
||||
Fix16 & operator|=(const Fix16 &rhs) { value = fix16_from_int(fix16_to_int(value) | fix16_to_int(rhs.value)); return *this; }
|
||||
Fix16 & operator|=(const fix16_t rhs) { value = fix16_from_int(fix16_to_int(value) | fix16_to_int(rhs)); return *this; }
|
||||
Fix16 & operator|=(const int16_t rhs) { value = fix16_from_int(fix16_to_int(value) | rhs); return *this; }
|
||||
|
||||
Fix16 & operator<<=(const Fix16 &rhs) { value <<= rhs.value; return *this; }
|
||||
Fix16 & operator<<=(const fix16_t rhs) { value <<= rhs; return *this; }
|
||||
Fix16 & operator<<=(const int16_t rhs) { value <<= fix16_from_int(rhs); return *this; }
|
||||
|
||||
Fix16 & operator>>=(const Fix16 &rhs) { value >>= rhs.value; return *this; }
|
||||
Fix16 & operator>>=(const fix16_t rhs) { value >>= rhs; return *this; }
|
||||
Fix16 & operator>>=(const int16_t rhs) { value >>= fix16_from_int(rhs); return *this; }
|
||||
|
||||
const Fix16 operator+(const Fix16 &other) const { Fix16 ret = *this; ret += other; return ret; }
|
||||
const Fix16 operator+(const fix16_t other) const { Fix16 ret = *this; ret += other; return ret; }
|
||||
const Fix16 operator+(const double other) const { Fix16 ret = *this; ret += other; return ret; }
|
||||
const Fix16 operator+(const float other) const { Fix16 ret = *this; ret += other; return ret; }
|
||||
const Fix16 operator+(const int16_t other) const { Fix16 ret = *this; ret += other; return ret; }
|
||||
|
||||
#ifndef FIXMATH_NO_OVERFLOW
|
||||
const Fix16 sadd(const Fix16 &other) const { Fix16 ret = fix16_sadd(value, other.value); return ret; }
|
||||
const Fix16 sadd(const fix16_t other) const { Fix16 ret = fix16_sadd(value, other); return ret; }
|
||||
const Fix16 sadd(const double other) const { Fix16 ret = fix16_sadd(value, fix16_from_dbl(other)); return ret; }
|
||||
const Fix16 sadd(const float other) const { Fix16 ret = fix16_sadd(value, fix16_from_float(other)); return ret; }
|
||||
const Fix16 sadd(const int16_t other) const { Fix16 ret = fix16_sadd(value, fix16_from_int(other)); return ret; }
|
||||
#endif
|
||||
|
||||
const Fix16 operator-(const Fix16 &other) const { Fix16 ret = *this; ret -= other; return ret; }
|
||||
const Fix16 operator-(const fix16_t other) const { Fix16 ret = *this; ret -= other; return ret; }
|
||||
const Fix16 operator-(const double other) const { Fix16 ret = *this; ret -= other; return ret; }
|
||||
const Fix16 operator-(const float other) const { Fix16 ret = *this; ret -= other; return ret; }
|
||||
const Fix16 operator-(const int16_t other) const { Fix16 ret = *this; ret -= other; return ret; }
|
||||
|
||||
#ifndef FIXMATH_NO_OVERFLOW
|
||||
const Fix16 ssub(const Fix16 &other) const { Fix16 ret = fix16_sadd(value, -other.value); return ret; }
|
||||
const Fix16 ssub(const fix16_t other) const { Fix16 ret = fix16_sadd(value, -other); return ret; }
|
||||
const Fix16 ssub(const double other) const { Fix16 ret = fix16_sadd(value, -fix16_from_dbl(other)); return ret; }
|
||||
const Fix16 ssub(const float other) const { Fix16 ret = fix16_sadd(value, -fix16_from_float(other)); return ret; }
|
||||
const Fix16 ssub(const int16_t other) const { Fix16 ret = fix16_sadd(value, -fix16_from_int(other)); return ret; }
|
||||
#endif
|
||||
|
||||
const Fix16 operator*(const Fix16 &other) const { Fix16 ret = *this; ret *= other; return ret; }
|
||||
const Fix16 operator*(const fix16_t other) const { Fix16 ret = *this; ret *= other; return ret; }
|
||||
const Fix16 operator*(const double other) const { Fix16 ret = *this; ret *= other; return ret; }
|
||||
const Fix16 operator*(const float other) const { Fix16 ret = *this; ret *= other; return ret; }
|
||||
const Fix16 operator*(const int16_t other) const { Fix16 ret = *this; ret *= other; return ret; }
|
||||
|
||||
#ifndef FIXMATH_NO_OVERFLOW
|
||||
const Fix16 smul(const Fix16 &other) const { Fix16 ret = fix16_smul(value, other.value); return ret; }
|
||||
const Fix16 smul(const fix16_t other) const { Fix16 ret = fix16_smul(value, other); return ret; }
|
||||
const Fix16 smul(const double other) const { Fix16 ret = fix16_smul(value, fix16_from_dbl(other)); return ret; }
|
||||
const Fix16 smul(const float other) const { Fix16 ret = fix16_smul(value, fix16_from_float(other)); return ret; }
|
||||
const Fix16 smul(const int16_t other) const { Fix16 ret = fix16_smul(value, fix16_from_int(other)); return ret; }
|
||||
#endif
|
||||
|
||||
const Fix16 operator/(const Fix16 &other) const { Fix16 ret = *this; ret /= other; return ret; }
|
||||
const Fix16 operator/(const fix16_t other) const { Fix16 ret = *this; ret /= other; return ret; }
|
||||
const Fix16 operator/(const double other) const { Fix16 ret = *this; ret /= other; return ret; }
|
||||
const Fix16 operator/(const float other) const { Fix16 ret = *this; ret /= other; return ret; }
|
||||
const Fix16 operator/(const int16_t other) const { Fix16 ret = *this; ret /= other; return ret; }
|
||||
|
||||
#ifndef FIXMATH_NO_OVERFLOW
|
||||
const Fix16 sdiv(const Fix16 &other) const { Fix16 ret = fix16_sdiv(value, other.value); return ret; }
|
||||
const Fix16 sdiv(const fix16_t other) const { Fix16 ret = fix16_sdiv(value, other); return ret; }
|
||||
const Fix16 sdiv(const double other) const { Fix16 ret = fix16_sdiv(value, fix16_from_dbl(other)); return ret; }
|
||||
const Fix16 sdiv(const float other) const { Fix16 ret = fix16_sdiv(value, fix16_from_float(other)); return ret; }
|
||||
const Fix16 sdiv(const int16_t other) const { Fix16 ret = fix16_sdiv(value, fix16_from_int(other)); return ret; }
|
||||
#endif
|
||||
|
||||
int operator==(const Fix16 &other) const { return (value == other.value); }
|
||||
int operator==(const fix16_t other) const { return (value == other); }
|
||||
int operator==(const double other) const { return (value == fix16_from_dbl(other)); }
|
||||
int operator==(const float other) const { return (value == fix16_from_float(other)); }
|
||||
int operator==(const int16_t other) const { return (value == fix16_from_int(other)); }
|
||||
|
||||
int operator!=(const Fix16 &other) const { return (value != other.value); }
|
||||
int operator!=(const fix16_t other) const { return (value != other); }
|
||||
int operator!=(const double other) const { return (value != fix16_from_dbl(other)); }
|
||||
int operator!=(const float other) const { return (value != fix16_from_float(other)); }
|
||||
int operator!=(const int16_t other) const { return (value != fix16_from_int(other)); }
|
||||
|
||||
int operator<=(const Fix16 &other) const { return (value <= other.value); }
|
||||
int operator<=(const fix16_t other) const { return (value <= other); }
|
||||
int operator<=(const double other) const { return (value <= fix16_from_dbl(other)); }
|
||||
int operator<=(const float other) const { return (value <= fix16_from_float(other)); }
|
||||
int operator<=(const int16_t other) const { return (value <= fix16_from_int(other)); }
|
||||
|
||||
int operator>=(const Fix16 &other) const { return (value >= other.value); }
|
||||
int operator>=(const fix16_t other) const { return (value >= other); }
|
||||
int operator>=(const double other) const { return (value >= fix16_from_dbl(other)); }
|
||||
int operator>=(const float other) const { return (value >= fix16_from_float(other)); }
|
||||
int operator>=(const int16_t other) const { return (value >= fix16_from_int(other)); }
|
||||
|
||||
int operator< (const Fix16 &other) const { return (value < other.value); }
|
||||
int operator< (const fix16_t other) const { return (value < other); }
|
||||
int operator< (const double other) const { return (value < fix16_from_dbl(other)); }
|
||||
int operator< (const float other) const { return (value < fix16_from_float(other)); }
|
||||
int operator< (const int16_t other) const { return (value < fix16_from_int(other)); }
|
||||
|
||||
int operator> (const Fix16 &other) const { return (value > other.value); }
|
||||
int operator> (const fix16_t other) const { return (value > other); }
|
||||
int operator> (const double other) const { return (value > fix16_from_dbl(other)); }
|
||||
int operator> (const float other) const { return (value > fix16_from_float(other)); }
|
||||
int operator> (const int16_t other) const { return (value > fix16_from_int(other)); }
|
||||
|
||||
Fix16 sin() const { return Fix16(fix16_sin(value)); }
|
||||
Fix16 cos() const { return Fix16(fix16_cos(value)); }
|
||||
Fix16 tan() const { return Fix16(fix16_tan(value)); }
|
||||
Fix16 asin() const { return Fix16(fix16_asin(value)); }
|
||||
Fix16 acos() const { return Fix16(fix16_acos(value)); }
|
||||
Fix16 atan() const { return Fix16(fix16_atan(value)); }
|
||||
Fix16 atan2(const Fix16 &inY) const { return Fix16(fix16_atan2(value, inY.value)); }
|
||||
Fix16 sqrt() const { return Fix16(fix16_sqrt(value)); }
|
||||
};
|
||||
|
||||
#endif
|
2087
source/thirdparty/include/libdivide.h
vendored
2087
source/thirdparty/include/libdivide.h
vendored
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue