Add simple bitmap manipulation functions

git-svn-id: https://svn.eduke32.com/eduke32@7475 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-04-06 06:37:22 +00:00 committed by Christoph Oelckers
parent 9b0573f0f2
commit 146fa7e79e

View file

@ -1119,6 +1119,11 @@ static inline void append_ext_UNSAFE(char *outbuf, const char *ext)
Bstrcpy(p, ext);
}
////////// Bitfield manipulation //////////
static FORCE_INLINE void bitmap_set(uint8_t *const ptr, int const n) { ptr[n >> 3] |= 1 << (n & 7); }
static FORCE_INLINE void bitmap_clear(uint8_t *const ptr, int const n) { ptr[n >> 3] &= ~(1 << (n & 7)); }
static FORCE_INLINE CONSTEXPR char bitmap_test(uint8_t const *const ptr, int const n) { return ptr[n >> 3] & (1 << (n & 7)); }
/* Begin dependence on compat.o object. */