AGX Dynamics  2.37.2.0
BitSet_small.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGX_BITSET_SMALL_H
18 #define AGX_BITSET_SMALL_H
19 
20 #include <agx/macros.h>
21 
22 namespace agx
23 {
27  template <typename T>
29  {
30  public:
31  BitSet_small(T state = T(0));
32  ~BitSet_small();
33 
34  bool test(size_t bit) const;
35  void set(size_t bit, bool flag);
36 
37  T get() const;
38  T state() const;
39 
40  T& get();
41  T& state();
42 
43  protected:
45  };
46 
47 
49  template <typename T>
51  {
52  }
53 
54  template <typename T>
56  {
57  }
58 
59  template <typename T>
60  AGX_FORCE_INLINE bool BitSet_small<T>::test(size_t bit) const
61  {
62  const T mask = (T)(1 << bit);
63  return (m_state & mask) != 0;
64  }
65 
66  template <typename T>
67  AGX_FORCE_INLINE void BitSet_small<T>::set(size_t bit, bool flag)
68  {
69  const T mask = (T)(1 << bit);
70  m_state = (m_state & ~mask) | ((T)flag << bit);
71  }
72 
73  template <typename T>
75 
76  template <typename T>
78 
79  template <typename T>
81 
82  template <typename T>
84 
85 }
86 
87 
88 #endif /* AGX_BITSET_SMALL_H */
void set(size_t bit, bool flag)
Definition: BitSet_small.h:67
#define AGX_FORCE_INLINE
Definition: Object.h:59
bool test(size_t bit) const
Definition: BitSet_small.h:60
Special class for small bitset, because minimum bitset size in clang/gcc is 8 bytes, and we only need 4.
Definition: BitSet_small.h:28
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
BitSet_small(T state=T(0))
Definition: BitSet_small.h:50