- use WORDS_BIGENDIAN directly in place of B_BIG_ENDIAN

This commit is contained in:
Christoph Oelckers 2021-12-14 12:08:48 +01:00
parent 7c4233bcf7
commit 4daad25e5c
7 changed files with 10 additions and 18 deletions

View file

@ -15,12 +15,6 @@
////////// Language and compiler feature polyfills //////////
#ifdef WORDS_BIGENDIAN
# define B_BIG_ENDIAN 1
#else
# define B_BIG_ENDIAN 0
#endif
#include <inttypes.h>
#include <stdint.h>

View file

@ -565,7 +565,7 @@ static md2model_t *md2load(FileReader & fil, const char *filnam)
m->mdnum = 2; m->scale = .01f;
fil.Read((char *)&head,sizeof(md2head_t));
#if B_BIG_ENDIAN != 0
#if WORDS_BIGENDIAN
head.id = LittleLong(head.id); head.vers = LittleLong(head.vers);
head.skinxsiz = LittleLong(head.skinxsiz); head.skinysiz = LittleLong(head.skinysiz);
head.framebytes = LittleLong(head.framebytes); head.numskins = LittleLong(head.numskins);
@ -612,7 +612,7 @@ static md2model_t *md2load(FileReader & fil, const char *filnam)
if (fil.Read((char *)m->uv,head.numuv*sizeof(md2uv_t)) != (int32_t)(head.numuv*sizeof(md2uv_t)))
{ M_Free(m->uv); M_Free(m->tris); M_Free(m->glcmds); M_Free(m->frames); M_Free(m); return 0; }
#if B_BIG_ENDIAN != 0
#if WORDS_BIGENDIAN
{
char *f = (char *)m->frames;
int32_t *l,j;
@ -847,7 +847,7 @@ static md3model_t *md3load(FileReader & fil)
fil.Read(&m->head,SIZEOF_MD3HEAD_T);
#if B_BIG_ENDIAN != 0
#if WORDS_BIGENDIAN
m->head.id = LittleLong(m->head.id); m->head.vers = LittleLong(m->head.vers);
m->head.flags = LittleLong(m->head.flags); m->head.numframes = LittleLong(m->head.numframes);
m->head.numtags = LittleLong(m->head.numtags); m->head.numsurfs = LittleLong(m->head.numsurfs);
@ -882,7 +882,7 @@ static md3model_t *md3load(FileReader & fil)
// surfs[i].geometry is for FREE_SURFS_GEOMETRY.
assert(m->head.surfs[0].geometry == NULL);
#if B_BIG_ENDIAN != 0
#if WORDS_BIGENDIAN
{
int32_t j, *l;
@ -907,7 +907,7 @@ static md3model_t *md3load(FileReader & fil)
s = &m->head.surfs[surfi];
fil.Seek(ofsurf,FileReader::SeekSet); fil.Read(s,SIZEOF_MD3SURF_T);
#if B_BIG_ENDIAN != 0
#if WORDS_BIGENDIAN
{
int32_t j, *l;
s->id = LittleLong(s->id);
@ -940,7 +940,7 @@ static md3model_t *md3load(FileReader & fil)
fil.Seek(offs[2],FileReader::SeekSet); fil.Read(s->uv ,leng[2]);
fil.Seek(offs[3],FileReader::SeekSet); fil.Read(s->xyzn ,leng[3]);
#if B_BIG_ENDIAN != 0
#if WORDS_BIGENDIAN
{
int32_t j, *l;

View file

@ -545,7 +545,6 @@ void seqKill(DBloodActor* actor)
static void ByteSwapSEQ(Seq* pSeq)
{
#if 1//B_BIG_ENDIAN == 1
pSeq->version = LittleShort(pSeq->version);
pSeq->nFrames = LittleShort(pSeq->nFrames);
pSeq->ticksPerFrame = LittleShort(pSeq->ticksPerFrame);
@ -579,7 +578,6 @@ static void ByteSwapSEQ(Seq* pSeq)
swapFrame.reserved = bitReader.readUnsigned(2);
*pFrame = swapFrame;
}
#endif
}
FMemArena seqcache;

View file

@ -49,7 +49,7 @@ int soundRates[13] = {
void ByteSwapSFX(SFX* pSFX)
{
#if B_BIG_ENDIAN == 1
#if WORDS_BIGENDIAN
pSFX->relVol = LittleLong(pSFX->relVol);
pSFX->pitch = LittleLong(pSFX->pitch);
pSFX->pitchRange = LittleLong(pSFX->pitchRange);

View file

@ -53,7 +53,7 @@ void GameInterface::LoadGameTextures()
if (hFile.isOpen())
{
hFile.Read(voxelIndex, sizeof(voxelIndex));
#if B_BIG_ENDIAN == 1
#if WORDS_BIGENDIAN
for (int i = 0; i < kMaxTiles; i++)
voxelIndex[i] = LittleShort(voxelIndex[i]);
#endif

View file

@ -143,7 +143,7 @@ void viewInit(void)
assert(lensdata.Size() == kLensSize * kLensSize * sizeof(int));
lensTable = (int*)lensdata.Data();
#if B_BIG_ENDIAN == 1
#if WORDS_BIGENDIAN
for (int i = 0; i < kLensSize*kLensSize; i++)
{
lensTable[i] = LittleLong(lensTable[i]);

View file

@ -187,7 +187,7 @@ inline int32_t FIXED(int32_t msw, int32_t lsw)
}
// Ouch...
#if B_BIG_ENDIAN == 0
#ifndef WORDS_BIGENDIAN
# define MSB_VAR(fixed) (*(((uint8_t*)&(fixed)) + 1))
# define LSB_VAR(fixed) (*((uint8_t*)&(fixed)))
#else