// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. // // -------------------------------------------------------------------------------- // BitMask.h // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- // BitMask is an arbitrarily large sized bitfield which has optimal storage // for 32 bits or less. // Storage is proportional to the highest index which is set. // -------------------------------------------------------------------------------- #include #ifndef _BITMASK_H_ #define _BITMASK_H_ class BitMask { public: BitMask(); ~BitMask(); BOOL TestBit(int bit); void SetBit(int bit); void ClearBit(int bit); // returns true if any bit is set BOOL TestAnyBit(); void ClearAllBits(); // Allocation exposed for ngen save/fixup size_t GetAllocatedBlockOffset(); void *GetAllocatedBlock(); COUNT_T GetAllocatedBlockSize(); private: static const int BIT_SIZE_SHIFT = 5; static const int BIT_SIZE = (1<writer so be very careful // when taking this lock else you might deadlock your own thread! SimpleRWLock m_bitMaskLock; }; #include #endif // _BITMASK_H_