From 14461c6fe8a7d7e8c7fd0b61fd3c4a534dc2cb35 Mon Sep 17 00:00:00 2001 From: apio Date: Sat, 17 Dec 2022 10:49:19 +0100 Subject: [PATCH] Atomic: Add operators += and -= --- luna/include/luna/Atomic.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/luna/include/luna/Atomic.h b/luna/include/luna/Atomic.h index d6be5f93..8f2dd9ff 100644 --- a/luna/include/luna/Atomic.h +++ b/luna/include/luna/Atomic.h @@ -103,6 +103,16 @@ template class Atomic return fetch_sub(1); } + T operator+=(const T& other) + { + return fetch_add(other) + other; + } + + T operator-=(const T& other) + { + return fetch_sub(other) - other; + } + private: T m_value; }; \ No newline at end of file