From 4daad25e5c1fbbb5cc459f24f3a75f596dfde51e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 14 Dec 2021 12:08:48 +0100 Subject: [PATCH] - use WORDS_BIGENDIAN directly in place of B_BIG_ENDIAN --- source/build/include/compat.h | 6 ------ source/build/src/mdsprite.cpp | 12 ++++++------ source/games/blood/src/seq.cpp | 2 -- source/games/blood/src/sound.cpp | 2 +- source/games/blood/src/tile.cpp | 2 +- source/games/blood/src/view.cpp | 2 +- source/games/sw/src/game.h | 2 +- 7 files changed, 10 insertions(+), 18 deletions(-) diff --git a/source/build/include/compat.h b/source/build/include/compat.h index aa9dc23c1..6c26c999f 100644 --- a/source/build/include/compat.h +++ b/source/build/include/compat.h @@ -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 #include diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index 499c57010..206e65c02 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -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; diff --git a/source/games/blood/src/seq.cpp b/source/games/blood/src/seq.cpp index 13361f13b..8a12e9899 100644 --- a/source/games/blood/src/seq.cpp +++ b/source/games/blood/src/seq.cpp @@ -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; diff --git a/source/games/blood/src/sound.cpp b/source/games/blood/src/sound.cpp index 52fd5e91e..c95c574b8 100644 --- a/source/games/blood/src/sound.cpp +++ b/source/games/blood/src/sound.cpp @@ -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); diff --git a/source/games/blood/src/tile.cpp b/source/games/blood/src/tile.cpp index bb215833c..0f2b8b2b4 100644 --- a/source/games/blood/src/tile.cpp +++ b/source/games/blood/src/tile.cpp @@ -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 diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index aca96fb7a..4636f4ccc 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -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]); diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 8383d7313..73536dfb4 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -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