Formats minimally release source files based on former clang-format
This commit is contained in:
387 files changed
+37323
-38074
No files matched your search
Executable → Regular
+32
-41
@@ -3,33 +3,33 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace NGL {
|
||||
template<class T>
|
||||
class BitSet {
|
||||
namespace NGL
|
||||
{
|
||||
template <class T> class BitSet
|
||||
{
|
||||
public:
|
||||
BitSet(T bitset = T())
|
||||
: mBitSet(bitset)
|
||||
, mSize(sizeof(T)*8)
|
||||
{}
|
||||
: mBitSet(bitset)
|
||||
, mSize(sizeof(T) * 8)
|
||||
{
|
||||
}
|
||||
BitSet(const BitSet<T> &other)
|
||||
: mBitSet(other.mBitSet)
|
||||
, mSize(other.mSize)
|
||||
{}
|
||||
: mBitSet(other.mBitSet)
|
||||
, mSize(other.mSize)
|
||||
{
|
||||
}
|
||||
BitSet &operator=(const BitSet<T> &other)
|
||||
{
|
||||
if(this == &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 operator==(const BitSet<T> &other) const { return (mBitSet == other.mBitSet && mSize == other.mSize); }
|
||||
bool setBit(unsigned int bitNum)
|
||||
{
|
||||
if(bitNum >= mSize)
|
||||
if (bitNum >= mSize)
|
||||
return false;
|
||||
mBitSet |= getBit(bitNum);
|
||||
return true;
|
||||
@@ -37,55 +37,46 @@ namespace NGL {
|
||||
|
||||
bool clearBit(unsigned int bitNum)
|
||||
{
|
||||
if(bitNum >= mSize)
|
||||
if (bitNum >= mSize)
|
||||
return false;
|
||||
mBitSet &= ~(getBit(bitNum));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool at(unsigned int bitNum) const
|
||||
{
|
||||
if(bitNum >= sizeof(T) * 8)
|
||||
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 operator[](unsigned int bitNum) const { return at(bitNum); }
|
||||
|
||||
size_t size() const { return mSize; }
|
||||
|
||||
bool resize(size_t newSize)
|
||||
{
|
||||
if(newSize >= sizeof(T) * 8)
|
||||
if (newSize >= sizeof(T) * 8)
|
||||
return false;
|
||||
for(unsigned int i = mSize; i < newSize; ++i)
|
||||
for (unsigned int i = mSize; i < newSize; ++i)
|
||||
clearBit(i);
|
||||
mSize = newSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
fill(false);
|
||||
}
|
||||
|
||||
|
||||
void clear() { fill(false); }
|
||||
|
||||
void fill(bool bBitsSet)
|
||||
{
|
||||
if(bBitsSet)
|
||||
if (bBitsSet)
|
||||
mBitSet = ~T();
|
||||
else
|
||||
mBitSet = T();
|
||||
}
|
||||
|
||||
|
||||
T operator()() const { return mBitSet; }
|
||||
|
||||
|
||||
protected:
|
||||
static T getBit(unsigned int bitNum_)
|
||||
{
|
||||
@@ -97,4 +88,4 @@ namespace NGL {
|
||||
T mBitSet;
|
||||
size_t mSize;
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user