Adds initial intermediate qt6 porting state

This commit is contained in:
torsten committed 2026-08-17 17:54:56 +02:00
1 parent 99136e9460
commit d176b5e0d7
11247 files changed
+1891537

No files matched your search

@@ -0,0 +1,100 @@
#pragma once
namespace NGL {
template<class T>
class BitSet {
public:
BitSet(T bitset = T())
: mBitSet(bitset)
, mSize(sizeof(T)*8)
{}
BitSet(const BitSet<T> &other)
: mBitSet(other.mBitSet)
, mSize(other.mSize)
{}
BitSet &operator=(const BitSet<T> &other)
{
if(this == &other)
return *this;
mBitSet = other.mBitSet;
mSize = other.mSize;
return *this;
}
bool operator==(const BitSet<T> &other) const
{
return (mBitSet == other.mBitSet && mSize == other.mSize);
}
bool setBit(unsigned int bitNum)
{
if(bitNum >= mSize)
return false;
mBitSet |= getBit(bitNum);
return true;
}
bool clearBit(unsigned int bitNum)
{
if(bitNum >= mSize)
return false;
mBitSet &= ~(getBit(bitNum));
return true;
}
bool at(unsigned int bitNum) const
{
if(bitNum >= sizeof(T) * 8)
return false;
T compVal = getBit(bitNum);
return ((mBitSet & compVal) == compVal);
}
bool operator[] (unsigned int bitNum) const
{
return at(bitNum);
}
size_t size() const
{
return mSize;
}
bool resize(size_t newSize)
{
if(newSize >= sizeof(T) * 8)
return false;
for(unsigned int i = mSize; i < newSize; ++i)
clearBit(i);
mSize = newSize;
return true;
}
void clear()
{
fill(false);
}
void fill(bool bBitsSet)
{
if(bBitsSet)
mBitSet = ~T();
else
mBitSet = T();
}
T operator()() const { return mBitSet; }
protected:
static T getBit(unsigned int bitNum_)
{
T bitNum = bitNum_;
const T one = 1;
return (one << bitNum);
}
T mBitSet;
size_t mSize;
};
}