AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
BitSet_small.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#ifndef AGX_BITSET_SMALL_H
18#define AGX_BITSET_SMALL_H
19
20#include <agx/macros.h>
21
22namespace agx
23{
27 template <typename T>
29 {
30 public:
31 BitSet_small(T state = T(0));
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>
58
59 template <typename T>
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>
74 AGX_FORCE_INLINE T BitSet_small<T>::get() const { return m_state; }
75
76 template <typename T>
77 AGX_FORCE_INLINE T BitSet_small<T>::state() const { return m_state; }
78
79 template <typename T>
80 AGX_FORCE_INLINE T& BitSet_small<T>::get() { return m_state; }
81
82 template <typename T>
84
85}
86
87
88#endif /* AGX_BITSET_SMALL_H */
Special class for small bitset, because minimum bitset size in clang/gcc is 8 bytes,...
BitSet_small(T state=T(0))
void set(size_t bit, bool flag)
bool test(size_t bit) const
#define AGX_FORCE_INLINE
Definition macros.h:58
The agx namespace contains the dynamics/math part of the AGX Dynamics API.