diff options
Diffstat (limited to 'thirdparty/bullet/BulletCollision/Gimpact/gim_bitset.h')
-rw-r--r-- | thirdparty/bullet/BulletCollision/Gimpact/gim_bitset.h | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/thirdparty/bullet/BulletCollision/Gimpact/gim_bitset.h b/thirdparty/bullet/BulletCollision/Gimpact/gim_bitset.h index 7dee48a4c7..c1fb41a5c0 100644 --- a/thirdparty/bullet/BulletCollision/Gimpact/gim_bitset.h +++ b/thirdparty/bullet/BulletCollision/Gimpact/gim_bitset.h @@ -34,34 +34,32 @@ email: projectileman@yahoo.com #include "gim_array.h" - #define GUINT_BIT_COUNT 32 #define GUINT_EXPONENT 5 class gim_bitset { public: - gim_array<GUINT> m_container; - - gim_bitset() - { + gim_array<GUINT> m_container; - } + gim_bitset() + { + } - gim_bitset(GUINT bits_count) - { - resize(bits_count); - } + gim_bitset(GUINT bits_count) + { + resize(bits_count); + } - ~gim_bitset() - { - } + ~gim_bitset() + { + } inline bool resize(GUINT newsize) { GUINT oldsize = m_container.size(); - m_container.resize(newsize/GUINT_BIT_COUNT + 1,false); - while(oldsize<m_container.size()) + m_container.resize(newsize / GUINT_BIT_COUNT + 1, false); + while (oldsize < m_container.size()) { m_container[oldsize] = 0; } @@ -70,12 +68,12 @@ public: inline GUINT size() { - return m_container.size()*GUINT_BIT_COUNT; + return m_container.size() * GUINT_BIT_COUNT; } inline void set_all() { - for(GUINT i = 0;i<m_container.size();++i) + for (GUINT i = 0; i < m_container.size(); ++i) { m_container[i] = 0xffffffff; } @@ -83,7 +81,7 @@ public: inline void clear_all() { - for(GUINT i = 0;i<m_container.size();++i) + for (GUINT i = 0; i < m_container.size(); ++i) { m_container[i] = 0; } @@ -91,33 +89,29 @@ public: inline void set(GUINT bit_index) { - if(bit_index>=size()) + if (bit_index >= size()) { resize(bit_index); } - m_container[bit_index >> GUINT_EXPONENT] |= (1 << (bit_index & (GUINT_BIT_COUNT-1))); + m_container[bit_index >> GUINT_EXPONENT] |= (1 << (bit_index & (GUINT_BIT_COUNT - 1))); } ///Return 0 or 1 inline char get(GUINT bit_index) { - if(bit_index>=size()) + if (bit_index >= size()) { return 0; } char value = m_container[bit_index >> GUINT_EXPONENT] & - (1 << (bit_index & (GUINT_BIT_COUNT-1))); + (1 << (bit_index & (GUINT_BIT_COUNT - 1))); return value; } inline void clear(GUINT bit_index) { - m_container[bit_index >> GUINT_EXPONENT] &= ~(1 << (bit_index & (GUINT_BIT_COUNT-1))); + m_container[bit_index >> GUINT_EXPONENT] &= ~(1 << (bit_index & (GUINT_BIT_COUNT - 1))); } }; - - - - -#endif // GIM_CONTAINERS_H_INCLUDED +#endif // GIM_CONTAINERS_H_INCLUDED |