mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
let the empty bitmask evaluate to False in Python
This commit is contained in:
parent
b83c81bee4
commit
3ddad3e2d2
@ -833,6 +833,17 @@ get_key() const {
|
|||||||
return (int)_word;
|
return (int)_word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: BitMask::__nonzero__
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if the bitmask is not zero.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
template<class WType, int nbits>
|
||||||
|
INLINE bool BitMask<WType, nbits>::
|
||||||
|
__nonzero__() const {
|
||||||
|
return _word != 0;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: BitMask::generate_hash
|
// Function: BitMask::generate_hash
|
||||||
// Access: Public
|
// Access: Public
|
||||||
@ -949,8 +960,8 @@ INLINE BitMask<WType, nbits> BitMask<WType, nbits>::
|
|||||||
keep_next_highest_bit(int index) const {
|
keep_next_highest_bit(int index) const {
|
||||||
BitMask<WType, nbits> mask,temp;
|
BitMask<WType, nbits> mask,temp;
|
||||||
nassertr(index >= 0 && index < num_bits, mask);
|
nassertr(index >= 0 && index < num_bits, mask);
|
||||||
|
|
||||||
mask.set_bit(index);
|
mask.set_bit(index);
|
||||||
mask.flood_down_in_place();
|
mask.flood_down_in_place();
|
||||||
mask.invert_in_place();
|
mask.invert_in_place();
|
||||||
mask &= *this;
|
mask &= *this;
|
||||||
@ -960,7 +971,7 @@ keep_next_highest_bit(int index) const {
|
|||||||
mask.flood_up_in_place();
|
mask.flood_up_in_place();
|
||||||
mask.invert_in_place();
|
mask.invert_in_place();
|
||||||
mask &= temp;
|
mask &= temp;
|
||||||
|
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -975,8 +986,8 @@ INLINE BitMask<WType, nbits> BitMask<WType, nbits>::
|
|||||||
keep_next_lowest_bit(int index) const {
|
keep_next_lowest_bit(int index) const {
|
||||||
BitMask<WType, nbits> mask, temp;
|
BitMask<WType, nbits> mask, temp;
|
||||||
nassertr(index >= 0 && index < num_bits, mask);
|
nassertr(index >= 0 && index < num_bits, mask);
|
||||||
|
|
||||||
mask.set_bit(index);
|
mask.set_bit(index);
|
||||||
mask.flood_up_in_place();
|
mask.flood_up_in_place();
|
||||||
mask.invert_in_place();
|
mask.invert_in_place();
|
||||||
mask &= *this;
|
mask &= *this;
|
||||||
@ -986,7 +997,7 @@ keep_next_lowest_bit(int index) const {
|
|||||||
mask.flood_down_in_place();
|
mask.flood_down_in_place();
|
||||||
mask.invert_in_place();
|
mask.invert_in_place();
|
||||||
mask &= temp;
|
mask &= temp;
|
||||||
|
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -994,8 +1005,8 @@ keep_next_lowest_bit(int index) const {
|
|||||||
// Function: BitMask::keep_next_highest_bit
|
// Function: BitMask::keep_next_highest_bit
|
||||||
// Access: Published
|
// Access: Published
|
||||||
// Description: Returns a BitMask with only the next highest "on"
|
// Description: Returns a BitMask with only the next highest "on"
|
||||||
// bit above all "on" bits in the passed in bitmask, or
|
// bit above all "on" bits in the passed in bitmask, or
|
||||||
// all_off. If there are no "on" bits in the passed in
|
// all_off. If there are no "on" bits in the passed in
|
||||||
// bitmask, it will return keep_next_highest_bit().
|
// bitmask, it will return keep_next_highest_bit().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class WType, int nbits>
|
template<class WType, int nbits>
|
||||||
@ -1013,8 +1024,8 @@ keep_next_highest_bit(const BitMask<WType, nbits> &other) const {
|
|||||||
// Function: BitMask::keep_next_lowest_bit
|
// Function: BitMask::keep_next_lowest_bit
|
||||||
// Access: Published
|
// Access: Published
|
||||||
// Description: Returns a BitMask with only the next lowest "on"
|
// Description: Returns a BitMask with only the next lowest "on"
|
||||||
// bit below all "on" bits in the passed in bitmask, or
|
// bit below all "on" bits in the passed in bitmask, or
|
||||||
// all_off. If there are no "on" bits in the passed in
|
// all_off. If there are no "on" bits in the passed in
|
||||||
// bitmask, it will return keep_next_lowest_bit().
|
// bitmask, it will return keep_next_lowest_bit().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
template<class WType, int nbits>
|
template<class WType, int nbits>
|
||||||
|
@ -131,6 +131,8 @@ PUBLISHED:
|
|||||||
|
|
||||||
INLINE int get_key() const;
|
INLINE int get_key() const;
|
||||||
|
|
||||||
|
INLINE bool __nonzero__() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
INLINE void generate_hash(ChecksumHashGenerator &hashgen) const;
|
INLINE void generate_hash(ChecksumHashGenerator &hashgen) const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user