Figure out fill() and isFull()
Stupid casting.
This commit is contained in:
parent
e92718cad0
commit
58817e7ced
1 changed files with 9 additions and 2 deletions
|
@ -31,6 +31,13 @@ struct Bitmap
|
||||||
: mBitmap(value)
|
: mBitmap(value)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
/** Get this bit field's primitive representation. */
|
||||||
|
operator FieldType()
|
||||||
|
const
|
||||||
|
{
|
||||||
|
return mBitmap;
|
||||||
|
}
|
||||||
|
|
||||||
/** Get the status of a single bit. Returns `true` if the bit is 1. */
|
/** Get the status of a single bit. Returns `true` if the bit is 1. */
|
||||||
bool
|
bool
|
||||||
isSet(usize bit)
|
isSet(usize bit)
|
||||||
|
@ -82,14 +89,14 @@ struct Bitmap
|
||||||
void
|
void
|
||||||
fill()
|
fill()
|
||||||
{
|
{
|
||||||
mBitmap = ~(0);
|
mBitmap = FieldType(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isFull()
|
isFull()
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
return mBitmap != ~(0);
|
return mBitmap == FieldType(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue