- removed some 'pragma' cruft.

This commit is contained in:
Christoph Oelckers 2020-04-05 23:58:58 +02:00
parent f0f17fa34f
commit 8d3199514d
9 changed files with 16 additions and 115 deletions

View file

@ -671,7 +671,6 @@ set (PCH_SOURCES
build/src/animvpx.cpp build/src/animvpx.cpp
build/src/clip.cpp build/src/clip.cpp
build/src/common.cpp build/src/common.cpp
build/src/compat.cpp
build/src/defs.cpp build/src/defs.cpp
build/src/engine.cpp build/src/engine.cpp
build/src/hash.cpp build/src/hash.cpp

View file

@ -79,7 +79,6 @@ skip:
extern uint32_t divideu32_noinline(uint32_t n, uint32_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 tabledivide32_noinline(int32_t n, int32_t d);
extern int64_t tabledivide64_noinline(int64_t n, int64_t d);
static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx) { return dw(tabledivide64(qw(eax) << by(ecx), ebx)); } static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx) { return dw(tabledivide64(qw(eax) << by(ecx), ebx)); }
@ -169,18 +168,6 @@ static FORCE_INLINE CONSTEXPR int32_t dmulscale(int32_t eax, int32_t edx, int32_
} }
#endif #endif
#ifndef pragmas_have_qinterpolatedown16
void qinterpolatedown16(intptr_t bufptr, int32_t num, int32_t val, int32_t add);
void qinterpolatedown16short(intptr_t bufptr, int32_t num, int32_t val, int32_t add);
#endif
#ifndef pragmas_have_clearbufbyte
void clearbufbyte(void *D, int32_t c, int32_t a);
#endif
#ifndef pragmas_have_copybufbyte
void copybufbyte(const void *S, void *D, int32_t c);
#endif
#ifndef pragmas_have_krecipasm #ifndef pragmas_have_krecipasm
static inline int32_t krecipasm(int32_t i) static inline int32_t krecipasm(int32_t i)
{ {

View file

@ -1,4 +1,5 @@
#define LIBDIVIDE_BODY
#include "compat.h" #include "compat.h"
#include "build.h" #include "build.h"
#include "scriptfile.h" #include "scriptfile.h"

View file

@ -1,12 +0,0 @@
/*
* Playing-field leveler for Build
*/
#define LIBDIVIDE_BODY
#include "compat.h"
#include "debugbreak.h"
#include "baselayer.h"

View file

@ -1433,21 +1433,6 @@ int32_t animateoffs(int const tilenum, int fakevar)
} }
static inline void wallmosts_finish(int16_t *mostbuf, int32_t z1, int32_t z2,
int32_t ix1, int32_t iy1, int32_t ix2, int32_t iy2)
{
const int32_t y = scale(z1, xdimenscale, iy1)<<4;
// PK 20110423: a bit consistency checking is a good thing:
int32_t const tmp = (ix2 - ix1 >= 0) ? (ix2 - ix1 + 1) : 1;
int32_t const yinc = tabledivide32((scale(z2, xdimenscale, iy2) << 4) - y, tmp);
qinterpolatedown16short((intptr_t)&mostbuf[ix1], tmp, y + (globalhoriz << 16), yinc);
mostbuf[ix1] = clamp(mostbuf[ix1], 0, ydimen);
mostbuf[ix2] = clamp(mostbuf[ix2], 0, ydimen);
}
// globalpicnum --> globalxshift, globalyshift // globalpicnum --> globalxshift, globalyshift
static void calc_globalshifts(void) static void calc_globalshifts(void)
{ {
@ -1986,12 +1971,12 @@ int32_t rintersect(int32_t x1, int32_t y1, int32_t z1,
else if (bot < 0 && (topt > 0 || topu > 0 || topu <= bot)) else if (bot < 0 && (topt > 0 || topu > 0 || topu <= bot))
return -1; return -1;
int64_t t = tabledivide64_noinline(topt<<16, bot); int64_t t = (topt<<16) / bot;
*intx = x1 + ((vx*t)>>16); *intx = x1 + ((vx*t)>>16);
*inty = y1 + ((vy*t)>>16); *inty = y1 + ((vy*t)>>16);
*intz = z1 + ((vz*t)>>16); *intz = z1 + ((vz*t)>>16);
t = tabledivide64_noinline(topu<<16, bot); t = (topu<<16) / bot;
Bassert((unsigned)t < 65536); Bassert((unsigned)t < 65536);

View file

@ -24,60 +24,3 @@ void initdivtables(void)
uint32_t divideu32_noinline(uint32_t n, uint32_t d) { return divideu32(n, d); } 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 tabledivide32_noinline(int32_t n, int32_t d) { return tabledivide32(n, d); }
int64_t tabledivide64_noinline(int64_t n, int64_t d) { return tabledivide64(n, d); }
//
// Generic C version
//
#ifndef pragmas_have_qinterpolatedown16
void qinterpolatedown16(intptr_t bufptr, int32_t num, int32_t val, int32_t add)
{
auto lptr = (int32_t *)bufptr;
for (size_t i = 0, i_end = num; i < i_end; ++i)
{
lptr[i] = val>>16;
val += add;
}
}
void qinterpolatedown16short(intptr_t bufptr, int32_t num, int32_t val, int32_t add)
{
auto sptr = (int16_t *)bufptr;
for (size_t i = 0, i_end = num; i < i_end; ++i)
{
sptr[i] = val>>16;
val += add;
}
}
#endif
#ifndef pragmas_have_clearbufbyte
void clearbufbyte(void *D, int32_t c, int32_t a)
{
// Cringe City
constexpr int32_t m[4] = { 0xffl, 0xff00l, 0xff0000l, (int32_t)0xff000000l };
int z = 0;
auto p = (char *)D;
while ((c--) > 0)
{
*(p++) = (uint8_t)((a & m[z])>>(z<<3));
z=(z+1)&3;
}
}
#endif
#ifndef pragmas_have_copybufbyte
void copybufbyte(const void *s, void *d, int32_t c)
{
auto src = (const char *)s;
auto dst = (char *)d;
while (c--)
*dst++ = *src++;
}
#endif

View file

@ -1798,8 +1798,8 @@ void Net_GetInput(void)
if (g_player[myconnectindex].movefifoend&(g_movesPerPacket-1)) if (g_player[myconnectindex].movefifoend&(g_movesPerPacket-1))
{ {
copybufbyte(&inputfifo[(g_player[myconnectindex].movefifoend-1)&(MOVEFIFOSIZ-1)][myconnectindex], memcpy(&inputfifo[g_player[myconnectindex].movefifoend & (MOVEFIFOSIZ - 1)][myconnectindex],
&inputfifo[g_player[myconnectindex].movefifoend&(MOVEFIFOSIZ-1)][myconnectindex],sizeof(input_t)); &inputfifo[(g_player[myconnectindex].movefifoend - 1) & (MOVEFIFOSIZ - 1)][myconnectindex], sizeof(input_t));
g_player[myconnectindex].movefifoend++; g_player[myconnectindex].movefifoend++;
return; return;
} }
@ -2176,7 +2176,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
continue; continue;
} }
copybufbyte(&osyn[i],&nsyn[i],sizeof(input_t)); memcpy(&nsyn[i],&osyn[i],sizeof(input_t));
if (l&1) nsyn[i].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; if (l&1) nsyn[i].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
if (l&2) nsyn[i].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; if (l&2) nsyn[i].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
if (l&4) if (l&4)
@ -2215,7 +2215,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
if (i != myconnectindex) if (i != myconnectindex)
for (j=g_movesPerPacket-1;j>=1;j--) for (j=g_movesPerPacket-1;j>=1;j--)
{ {
copybufbyte(&nsyn[i],&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i],sizeof(input_t)); memcpy(&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i], &nsyn[i],sizeof(input_t));
g_player[i].movefifoend++; g_player[i].movefifoend++;
} }
@ -2229,7 +2229,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
osyn = (input_t *)&inputfifo[(g_player[other].movefifoend-1)&(MOVEFIFOSIZ-1)][0]; osyn = (input_t *)&inputfifo[(g_player[other].movefifoend-1)&(MOVEFIFOSIZ-1)][0];
nsyn = (input_t *)&inputfifo[(g_player[other].movefifoend)&(MOVEFIFOSIZ-1)][0]; nsyn = (input_t *)&inputfifo[(g_player[other].movefifoend)&(MOVEFIFOSIZ-1)][0];
copybufbyte(&osyn[other],&nsyn[other],sizeof(input_t)); memcpy(&nsyn[other], &osyn[other], sizeof(input_t));
if (k&1) nsyn[other].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; if (k&1) nsyn[other].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
if (k&2) nsyn[other].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; if (k&2) nsyn[other].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
if (k&4) if (k&4)
@ -2268,7 +2268,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
for (i=g_movesPerPacket-1;i>=1;i--) for (i=g_movesPerPacket-1;i>=1;i--)
{ {
copybufbyte(&nsyn[other],&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other],sizeof(input_t)); memcpy(&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other], &nsyn[other], sizeof(input_t));
g_player[other].movefifoend++; g_player[other].movefifoend++;
} }
@ -2292,7 +2292,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
osyn = (input_t *)&inputfifo[(g_player[other].movefifoend-1)&(MOVEFIFOSIZ-1)][0]; osyn = (input_t *)&inputfifo[(g_player[other].movefifoend-1)&(MOVEFIFOSIZ-1)][0];
nsyn = (input_t *)&inputfifo[(g_player[other].movefifoend)&(MOVEFIFOSIZ-1)][0]; nsyn = (input_t *)&inputfifo[(g_player[other].movefifoend)&(MOVEFIFOSIZ-1)][0];
copybufbyte(&osyn[other],&nsyn[other],sizeof(input_t)); memcpy(&nsyn[other], &osyn[other], sizeof(input_t));
k = packbuf[j] + (int)(packbuf[j+1]<<8); k = packbuf[j] + (int)(packbuf[j+1]<<8);
j += 2; j += 2;
@ -2328,7 +2328,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
for (i=g_movesPerPacket-1;i>=1;i--) for (i=g_movesPerPacket-1;i>=1;i--)
{ {
copybufbyte(&nsyn[other],&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other],sizeof(input_t)); memcpy(&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other], &nsyn[other], sizeof(input_t));
g_player[other].movefifoend++; g_player[other].movefifoend++;
} }

View file

@ -2185,8 +2185,8 @@ void G_ClearFIFO(void)
{ {
Net_ClearFIFO(); Net_ClearFIFO();
clearbufbyte(&localInput, sizeof(input_t), 0L); memset(&localInput, 0, sizeof(input_t));
clearbufbyte(&inputfifo, sizeof(input_t) * MOVEFIFOSIZ * MAXPLAYERS, 0L); memset(&inputfifo, 0, sizeof(input_t) * MOVEFIFOSIZ * MAXPLAYERS);
for (bsize_t p = 0; p <= MAXPLAYERS - 1; ++p) for (bsize_t p = 0; p <= MAXPLAYERS - 1; ++p)
{ {
@ -2380,8 +2380,6 @@ int G_EnterLevel(int gameMode)
Bmemset(gotpic, 0, sizeof(gotpic)); Bmemset(gotpic, 0, sizeof(gotpic));
Bmemset(precachehightile, 0, sizeof(precachehightile)); Bmemset(precachehightile, 0, sizeof(precachehightile));
//clearbufbyte(Actor,sizeof(Actor),0l); // JBF 20040531: yes? no?
prelevel(gameMode); prelevel(gameMode);
G_InitRRRASkies(); G_InitRRRASkies();

View file

@ -665,7 +665,7 @@ void computergetinput(int snum, SW_PACKET *syn)
startsect = sprite[p->PlayerSprite].sectnum; startsect = sprite[p->PlayerSprite].sectnum;
endsect = sprite[Player[goalplayer[snum]].PlayerSprite].sectnum; endsect = sprite[Player[goalplayer[snum]].PlayerSprite].sectnum;
clearbufbyte(dashow2dsector,(MAXSECTORS+7)>>3,0L); memset(dashow2dsector, 0, (MAXSECTORS + 7) >> 3);
searchsect[0] = startsect; searchsect[0] = startsect;
searchparent[0] = -1; searchparent[0] = -1;
dashow2dsector[startsect>>3] |= (1<<(startsect&7)); dashow2dsector[startsect>>3] |= (1<<(startsect&7));
@ -691,7 +691,7 @@ void computergetinput(int snum, SW_PACKET *syn)
send++; send++;
if (j == endsect) if (j == endsect)
{ {
clearbufbyte(dashow2dsector,(MAXSECTORS+7)>>3,0L); memset(dashow2dsector, 0, (MAXSECTORS + 7) >> 3);
for (k=send-1; k>=0; k=searchparent[k]) for (k=send-1; k>=0; k=searchparent[k])
dashow2dsector[searchsect[k]>>3] |= (1<<(searchsect[k]&7)); dashow2dsector[searchsect[k]>>3] |= (1<<(searchsect[k]&7));
@ -751,7 +751,7 @@ void computergetinput(int snum, SW_PACKET *syn)
send++; send++;
if (j == endsect) if (j == endsect)
{ {
clearbufbyte(dashow2dsector,(MAXSECTORS+7)>>3,0L); memset(dashow2dsector, 0, (MAXSECTORS + 7) >> 3);
for (k=send-1; k>=0; k=searchparent[k]) for (k=send-1; k>=0; k=searchparent[k])
dashow2dsector[searchsect[k]>>3] |= (1<<(searchsect[k]&7)); dashow2dsector[searchsect[k]>>3] |= (1<<(searchsect[k]&7));