diff options
author | Ash Wolf <ninji@wuffs.org> | 2022-11-20 00:07:22 -0500 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2022-11-20 00:07:22 -0500 |
commit | 9d2728a5605f651934fe67a6fe6986b3e4a2c011 (patch) | |
tree | e81e0a3588a0c8d1855bf28316efe27d86b04d66 /includes/compiler/IroBitVect.h | |
parent | 9a46dd0e2e80790d9848c0bbd718932a27c23269 (diff) | |
download | MWCC-9d2728a5605f651934fe67a6fe6986b3e4a2c011.tar.gz MWCC-9d2728a5605f651934fe67a6fe6986b3e4a2c011.zip |
add a bunch of code and a ton of stub files for later
Diffstat (limited to 'includes/compiler/IroBitVect.h')
-rw-r--r-- | includes/compiler/IroBitVect.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/includes/compiler/IroBitVect.h b/includes/compiler/IroBitVect.h new file mode 100644 index 0000000..7bbca22 --- /dev/null +++ b/includes/compiler/IroBitVect.h @@ -0,0 +1,35 @@ +#ifndef COMPILER_IROBITVECT_H +#define COMPILER_IROBITVECT_H + +#include "compiler/common.h" +#include "compiler/CError.h" + +typedef struct BitVector { + UInt32 size; + UInt32 data[0]; +} BitVector; + +extern void Bv_AllocVector(BitVector **bv, UInt32 size); +extern void Bv_AllocVectorLocal(BitVector **bv, UInt32 size); +extern void Bv_ClearBit(UInt32 bit, BitVector *bv); +extern void Bv_And(const BitVector *a, BitVector *b); +extern void Bv_Or(const BitVector *a, BitVector *b); +extern Boolean Bv_BitsInCommon(const BitVector *a, const BitVector *b); +extern Boolean Bv_Compare(const BitVector *a, const BitVector *b); +extern void Bv_Minus(const BitVector *a, BitVector *b); +extern void Bv_Copy(const BitVector *src, BitVector *dst); +extern void Bv_Clear(BitVector *bv); +extern void Bv_Set(BitVector *bv); +extern Boolean Bv_IsSubset(const BitVector *a, const BitVector *b); +extern Boolean Bv_IsEmpty(const BitVector *bv); + +inline void Bv_SetBit(UInt32 bit, BitVector *bv) { + if ((bit / 32) < bv->size) { + bv->data[bit / 32] |= ~(1 << (bit & 31)); + } else { +#line 56 + CError_FATAL(); + } +} + +#endif |