Use bitmap manipulation functions for "bitptr"

git-svn-id: https://svn.eduke32.com/eduke32@7477 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-04-06 06:37:38 +00:00 committed by Christoph Oelckers
parent 83999ee6e4
commit f50ad3d424
3 changed files with 7 additions and 10 deletions

View File

@ -988,11 +988,11 @@ const char *EventNames[MAXEVENTS] =
#endif
};
char *bitptr; // pointer to bitmap of which bytecode positions contain pointers
uint8_t *bitptr; // pointer to bitmap of which bytecode positions contain pointers
#define BITPTR_SET(x) (bitptr[(x)>>3] |= (1<<((x)&7)))
#define BITPTR_CLEAR(x) (bitptr[(x)>>3] &= ~(1<<((x)&7)))
#define BITPTR_IS_POINTER(x) (bitptr[(x)>>3] & (1<<((x) &7)))
#define BITPTR_SET(x) bitmap_set(bitptr, x)
#define BITPTR_CLEAR(x) bitmap_clear(bitptr, x)
#define BITPTR_IS_POINTER(x) bitmap_test(bitptr, x)
#if !defined LUNATIC
hashtable_t h_arrays = { MAXGAMEARRAYS >> 1, NULL };
@ -1023,7 +1023,7 @@ static void C_SetScriptSize(int32_t newsize)
G_Util_PtrToIdx2(&g_tile[0].loadPtr, MAXTILES, sizeof(tiledata_t), apScript, P2I_FWD_NON0);
auto newscript = (intptr_t *)Xrealloc(apScript, newsize * sizeof(intptr_t));
bitptr = (char *)Xrealloc(bitptr, (((newsize + 7) >> 3) + 1) * sizeof(uint8_t));
bitptr = (uint8_t *)Xrealloc(bitptr, (((newsize + 7) >> 3) + 1) * sizeof(uint8_t));
if (newsize > g_scriptSize)
Bmemset(&newscript[g_scriptSize], 0, (newsize - g_scriptSize) * sizeof(intptr_t));
@ -6233,7 +6233,7 @@ void C_Compile(const char *fileName)
Bfree(apScript);
apScript = (intptr_t *)Xcalloc(1, g_scriptSize * sizeof(intptr_t));
bitptr = (char *)Xcalloc(1, (((g_scriptSize + 7) >> 3) + 1) * sizeof(uint8_t));
bitptr = (uint8_t *)Xcalloc(1, (((g_scriptSize + 7) >> 3) + 1) * sizeof(uint8_t));
g_errorCnt = 0;
g_labelCnt = 0;

View File

@ -139,6 +139,7 @@ extern int32_t g_totalLines;
extern int32_t g_warningCnt;
extern uint32_t g_scriptcrc;
extern int32_t otherp;
extern uint8_t *bitptr;
extern const char *EventNames[MAXEVENTS];

View File

@ -139,10 +139,6 @@ int32_t G_LoadPlayerMaybeMulti(savebrief_t & sv);
extern void sv_postyaxload(void);
#endif
// XXX: The 'bitptr' decl really belongs into gamedef.h, but we don't want to
// pull all of it in savegame.c?
extern char *bitptr;
enum
{
P2I_BACK_BIT = 1,