clang-format this branch

This commit is contained in:
Adam Ierymenko 2025-07-03 12:02:18 -04:00
parent 8b77ef538a
commit 342fa9d33f
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
135 changed files with 42729 additions and 42439 deletions

View file

@ -27,54 +27,54 @@ namespace ZeroTier {
*/
class AtomicCounter {
public:
AtomicCounter()
{
_v = 0;
}
AtomicCounter()
{
_v = 0;
}
inline int load() const
{
inline int load() const
{
#ifdef __GNUC__
return __sync_or_and_fetch(const_cast<int*>(&_v), 0);
return __sync_or_and_fetch(const_cast<int*>(&_v), 0);
#else
return _v.load();
return _v.load();
#endif
}
}
inline int operator++()
{
inline int operator++()
{
#ifdef __GNUC__
return __sync_add_and_fetch(&_v, 1);
return __sync_add_and_fetch(&_v, 1);
#else
return ++_v;
return ++_v;
#endif
}
}
inline int operator--()
{
inline int operator--()
{
#ifdef __GNUC__
return __sync_sub_and_fetch(&_v, 1);
return __sync_sub_and_fetch(&_v, 1);
#else
return --_v;
return --_v;
#endif
}
}
private:
AtomicCounter(const AtomicCounter&)
{
}
const AtomicCounter& operator=(const AtomicCounter&)
{
return *this;
}
AtomicCounter(const AtomicCounter&)
{
}
const AtomicCounter& operator=(const AtomicCounter&)
{
return *this;
}
#ifdef __GNUC__
int _v;
int _v;
#else
std::atomic_int _v;
std::atomic_int _v;
#endif
};
} // namespace ZeroTier
} // namespace ZeroTier
#endif