mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
allow casting bitmasks to their integer type, and make sure that bool(bitmask) is False when all bits are off
This commit is contained in:
parent
8ba7b5d0de
commit
47f3933489
@ -821,6 +821,29 @@ operator >>= (int shift) {
|
|||||||
_word >>= shift;
|
_word >>= shift;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: BitMask::operator WType
|
||||||
|
// Access: Published
|
||||||
|
// Description: Used to cast this BitMask back into the
|
||||||
|
// underlying integer type.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
template<class WType, int nbits>
|
||||||
|
INLINE BitMask<WType, nbits>::
|
||||||
|
operator WType () const {
|
||||||
|
return _word;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: BitMask::operator bool
|
||||||
|
// Access: Published
|
||||||
|
// Description: Will return true, unless all bits are off.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
template<class WType, int nbits>
|
||||||
|
INLINE BitMask<WType, nbits>::
|
||||||
|
operator bool () const {
|
||||||
|
return (_word != 0);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: BitMask::get_key
|
// Function: BitMask::get_key
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
Loading…
x
Reference in New Issue
Block a user