summaryrefslogtreecommitdiff
path: root/AK/Atomic.h
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-10-17 00:06:11 +0200
committerLinus Groh <mail@linusgroh.de>2022-12-03 23:52:23 +0000
commitd26aabff0401690d6dd1332558b40f5cb64e4428 (patch)
treefd56d0ab5b672814a1a2fb7b8a92fefb01f24e6f /AK/Atomic.h
parent8639d8bc212dcb45aff80405b4b0f6b1ef1087e7 (diff)
downloadserenity-d26aabff0401690d6dd1332558b40f5cb64e4428.zip
Everywhere: Run clang-format
Diffstat (limited to 'AK/Atomic.h')
-rw-r--r--AK/Atomic.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/AK/Atomic.h b/AK/Atomic.h
index 81bbe8169f..ce0a34351d 100644
--- a/AK/Atomic.h
+++ b/AK/Atomic.h
@@ -29,25 +29,25 @@ static inline void full_memory_barrier() noexcept
}
template<typename T>
-static inline T atomic_exchange(volatile T* var, T desired, MemoryOrder order = memory_order_seq_cst) noexcept
+static inline T atomic_exchange(T volatile* var, T desired, MemoryOrder order = memory_order_seq_cst) noexcept
{
return __atomic_exchange_n(var, desired, order);
}
template<typename T, typename V = RemoveVolatile<T>>
-static inline V* atomic_exchange(volatile T** var, V* desired, MemoryOrder order = memory_order_seq_cst) noexcept
+static inline V* atomic_exchange(T volatile** var, V* desired, MemoryOrder order = memory_order_seq_cst) noexcept
{
return __atomic_exchange_n(var, desired, order);
}
template<typename T, typename V = RemoveVolatile<T>>
-static inline V* atomic_exchange(volatile T** var, std::nullptr_t, MemoryOrder order = memory_order_seq_cst) noexcept
+static inline V* atomic_exchange(T volatile** var, std::nullptr_t, MemoryOrder order = memory_order_seq_cst) noexcept
{
return __atomic_exchange_n(const_cast<V**>(var), nullptr, order);
}
template<typename T>
-[[nodiscard]] static inline bool atomic_compare_exchange_strong(volatile T* var, T& expected, T desired, MemoryOrder order = memory_order_seq_cst) noexcept
+[[nodiscard]] static inline bool atomic_compare_exchange_strong(T volatile* var, T& expected, T desired, MemoryOrder order = memory_order_seq_cst) noexcept
{
if (order == memory_order_acq_rel || order == memory_order_release)
return __atomic_compare_exchange_n(var, &expected, desired, false, memory_order_release, memory_order_acquire);
@@ -55,7 +55,7 @@ template<typename T>
}
template<typename T, typename V = RemoveVolatile<T>>
-[[nodiscard]] static inline bool atomic_compare_exchange_strong(volatile T** var, V*& expected, V* desired, MemoryOrder order = memory_order_seq_cst) noexcept
+[[nodiscard]] static inline bool atomic_compare_exchange_strong(T volatile** var, V*& expected, V* desired, MemoryOrder order = memory_order_seq_cst) noexcept
{
if (order == memory_order_acq_rel || order == memory_order_release)
return __atomic_compare_exchange_n(var, &expected, desired, false, memory_order_release, memory_order_acquire);
@@ -63,7 +63,7 @@ template<typename T, typename V = RemoveVolatile<T>>
}
template<typename T, typename V = RemoveVolatile<T>>
-[[nodiscard]] static inline bool atomic_compare_exchange_strong(volatile T** var, V*& expected, std::nullptr_t, MemoryOrder order = memory_order_seq_cst) noexcept
+[[nodiscard]] static inline bool atomic_compare_exchange_strong(T volatile** var, V*& expected, std::nullptr_t, MemoryOrder order = memory_order_seq_cst) noexcept
{
if (order == memory_order_acq_rel || order == memory_order_release)
return __atomic_compare_exchange_n(const_cast<V**>(var), &expected, nullptr, false, memory_order_release, memory_order_acquire);
@@ -71,67 +71,67 @@ template<typename T, typename V = RemoveVolatile<T>>
}
template<typename T>
-static inline T atomic_fetch_add(volatile T* var, T val, MemoryOrder order = memory_order_seq_cst) noexcept
+static inline T atomic_fetch_add(T volatile* var, T val, MemoryOrder order = memory_order_seq_cst) noexcept
{
return __atomic_fetch_add(var, val, order);
}
template<typename T>
-static inline T atomic_fetch_sub(volatile T* var, T val, MemoryOrder order = memory_order_seq_cst) noexcept
+static inline T atomic_fetch_sub(T volatile* var, T val, MemoryOrder order = memory_order_seq_cst) noexcept
{
return __atomic_fetch_sub(var, val, order);
}
template<typename T>
-static inline T atomic_fetch_and(volatile T* var, T val, MemoryOrder order = memory_order_seq_cst) noexcept
+static inline T atomic_fetch_and(T volatile* var, T val, MemoryOrder order = memory_order_seq_cst) noexcept
{
return __atomic_fetch_and(var, val, order);
}
template<typename T>
-static inline T atomic_fetch_or(volatile T* var, T val, MemoryOrder order = memory_order_seq_cst) noexcept
+static inline T atomic_fetch_or(T volatile* var, T val, MemoryOrder order = memory_order_seq_cst) noexcept
{
return __atomic_fetch_or(var, val, order);
}
template<typename T>
-static inline T atomic_fetch_xor(volatile T* var, T val, MemoryOrder order = memory_order_seq_cst) noexcept
+static inline T atomic_fetch_xor(T volatile* var, T val, MemoryOrder order = memory_order_seq_cst) noexcept
{
return __atomic_fetch_xor(var, val, order);
}
template<typename T>
-static inline T atomic_load(volatile T* var, MemoryOrder order = memory_order_seq_cst) noexcept
+static inline T atomic_load(T volatile* var, MemoryOrder order = memory_order_seq_cst) noexcept
{
return __atomic_load_n(var, order);
}
template<typename T, typename V = RemoveVolatile<T>>
-static inline V* atomic_load(volatile T** var, MemoryOrder order = memory_order_seq_cst) noexcept
+static inline V* atomic_load(T volatile** var, MemoryOrder order = memory_order_seq_cst) noexcept
{
return __atomic_load_n(const_cast<V**>(var), order);
}
template<typename T>
-static inline void atomic_store(volatile T* var, T desired, MemoryOrder order = memory_order_seq_cst) noexcept
+static inline void atomic_store(T volatile* var, T desired, MemoryOrder order = memory_order_seq_cst) noexcept
{
__atomic_store_n(var, desired, order);
}
template<typename T, typename V = RemoveVolatile<T>>
-static inline void atomic_store(volatile T** var, V* desired, MemoryOrder order = memory_order_seq_cst) noexcept
+static inline void atomic_store(T volatile** var, V* desired, MemoryOrder order = memory_order_seq_cst) noexcept
{
__atomic_store_n(var, desired, order);
}
template<typename T, typename V = RemoveVolatile<T>>
-static inline void atomic_store(volatile T** var, std::nullptr_t, MemoryOrder order = memory_order_seq_cst) noexcept
+static inline void atomic_store(T volatile** var, std::nullptr_t, MemoryOrder order = memory_order_seq_cst) noexcept
{
__atomic_store_n(const_cast<V**>(var), nullptr, order);
}
template<typename T>
-static inline bool atomic_is_lock_free(volatile T* ptr = nullptr) noexcept
+static inline bool atomic_is_lock_free(T volatile* ptr = nullptr) noexcept
{
return __atomic_is_lock_free(sizeof(T), ptr);
}
@@ -156,7 +156,7 @@ public:
{
}
- volatile T* ptr() noexcept
+ T volatile* ptr() noexcept
{
return &m_value;
}
@@ -225,7 +225,7 @@ public:
{
}
- volatile T* ptr() noexcept
+ T volatile* ptr() noexcept
{
return &m_value;
}
@@ -356,7 +356,7 @@ public:
{
}
- volatile T** ptr() noexcept
+ T volatile** ptr() noexcept
{
return &m_value;
}