From 17a4ddd51e8b44ef9c99ca9b79d05cf9efb7e553 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 13 Oct 2019 08:55:52 +0200 Subject: [PATCH] - adjusted bit array helpers for the change of type for gotpic from (undefined) char to (defined) uint8_t. --- source/blood/src/common_game.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/source/blood/src/common_game.h b/source/blood/src/common_game.h index f6329c59d..384f33a26 100644 --- a/source/blood/src/common_game.h +++ b/source/blood/src/common_game.h @@ -511,18 +511,24 @@ inline int QRandom2(int a1) return mulscale(qrand(), a1, 14)-a1; } -inline void SetBitString(char *pArray, int nIndex) +template +inline void SetBitString(T *pArray, int nIndex) { - pArray[nIndex>>3] |= 1<<(nIndex&7); + static_assert(sizeof(T) == 1); + pArray[nIndex>>3] |= 1<<(nIndex&7); } -inline void ClearBitString(char *pArray, int nIndex) +template +inline void ClearBitString(T *pArray, int nIndex) { - pArray[nIndex >> 3] &= ~(1 << (nIndex & 7)); + static_assert(sizeof(T) == 1); + pArray[nIndex >> 3] &= ~(1 << (nIndex & 7)); } -inline char TestBitString(char *pArray, int nIndex) +template +inline char TestBitString(T *pArray, int nIndex) { + static_assert(sizeof(T) == 1); return pArray[nIndex>>3] & (1<<(nIndex&7)); }