AGX Dynamics
2.38.0.2
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>
28
class
BitSet_small
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
:
44
T
m_state
;
45
};
46
47
49
template
<
typename
T>
50
AGX_FORCE_INLINE
BitSet_small<T>::BitSet_small
(T state) : m_state(state)
51
{
52
}
53
54
template
<
typename
T>
55
AGX_FORCE_INLINE
BitSet_small<T>::~BitSet_small
()
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>
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>
83
AGX_FORCE_INLINE
T&
BitSet_small<T>::state
() {
return
m_state; }
84
85
}
86
87
88
#endif
/* AGX_BITSET_SMALL_H */
macros.h
agx::BitSet_small
Special class for small bitset, because minimum bitset size in clang/gcc is 8 bytes,...
Definition:
BitSet_small.h:28
agx::BitSet_small::m_state
T m_state
Definition:
BitSet_small.h:44
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition:
AddedMassInteraction.h:22
agx::BitSet_small::set
void set(size_t bit, bool flag)
Definition:
BitSet_small.h:67
agx::BitSet_small::~BitSet_small
~BitSet_small()
Definition:
BitSet_small.h:55
agx::BitSet_small::BitSet_small
BitSet_small(T state=T(0))
Definition:
BitSet_small.h:50
agx::BitSet_small::state
T state() const
Definition:
BitSet_small.h:77
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition:
macros.h:58
agx::BitSet_small::test
bool test(size_t bit) const
Definition:
BitSet_small.h:60
agx::BitSet_small::get
T get() const
Definition:
BitSet_small.h:74
include
agx
BitSet_small.h
Generated on Sun Sep 1 2024 11:18:24 for AGX Dynamics by
1.8.17