more opt
This commit is contained in:
parent
b727e2a67a
commit
f12370c348
4 changed files with 82 additions and 82 deletions
|
@ -28,9 +28,9 @@ namespace ZeroTier {
|
|||
class AtomicCounter
|
||||
{
|
||||
public:
|
||||
inline AtomicCounter() { _v = 0; }
|
||||
ZT_ALWAYS_INLINE AtomicCounter() { _v = 0; }
|
||||
|
||||
inline int load() const
|
||||
ZT_ALWAYS_INLINE int load() const
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
return __sync_or_and_fetch(const_cast<int *>(&_v),0);
|
||||
|
@ -39,7 +39,7 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
inline int operator++()
|
||||
ZT_ALWAYS_INLINE int operator++()
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
return __sync_add_and_fetch(&_v,1);
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
inline int operator--()
|
||||
ZT_ALWAYS_INLINE int operator--()
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
return __sync_sub_and_fetch(&_v,1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue