diff --git a/invertedlogic/iLPlatform/iLAtomics.h b/invertedlogic/iLPlatform/iLAtomics.h index bab0b7c..f817203 100644 --- a/invertedlogic/iLPlatform/iLAtomics.h +++ b/invertedlogic/iLPlatform/iLAtomics.h @@ -8,6 +8,11 @@ int32_t iLAtomic_CompareAndSwap32(iLAtomic32* a_ptr, int32_t a_comparand, int32_t a_val); int64_t iLAtomic_CompareAndSwap64(iLAtomic64* a_ptr, int64_t a_comparand, int64_t a_val); +int32_t iLAtomic_Increment32(iLAtomic32* a_ptr); +int64_t iLAtomic_Increment64(iLAtomic64* a_ptr); +int32_t iLAtomic_Decrement32(iLAtomic32* a_ptr); +int64_t iLAtomic_Decrement64(iLAtomic64* a_ptr); + #include "iLAtomics.inl" diff --git a/invertedlogic/iLPlatform/iLAtomics.h b/invertedlogic/iLPlatform/iLAtomics.h index bab0b7c..f817203 100644 --- a/invertedlogic/iLPlatform/iLAtomics.h +++ b/invertedlogic/iLPlatform/iLAtomics.h @@ -8,6 +8,11 @@ int32_t iLAtomic_CompareAndSwap32(iLAtomic32* a_ptr, int32_t a_comparand, int32_t a_val); int64_t iLAtomic_CompareAndSwap64(iLAtomic64* a_ptr, int64_t a_comparand, int64_t a_val); +int32_t iLAtomic_Increment32(iLAtomic32* a_ptr); +int64_t iLAtomic_Increment64(iLAtomic64* a_ptr); +int32_t iLAtomic_Decrement32(iLAtomic32* a_ptr); +int64_t iLAtomic_Decrement64(iLAtomic64* a_ptr); + #include "iLAtomics.inl" diff --git a/invertedlogic/iLPlatform/iLAtomics.inl b/invertedlogic/iLPlatform/iLAtomics.inl index 37899eb..68c33d2 100644 --- a/invertedlogic/iLPlatform/iLAtomics.inl +++ b/invertedlogic/iLPlatform/iLAtomics.inl @@ -32,3 +32,27 @@ } +int32_t iLAtomic_Increment32(iLAtomic32* a_ptr) +{ + return __sync_fetch_and_add(a_ptr, 1); +} + + +int64_t iLAtomic_Increment64(iLAtomic64* a_ptr) +{ + return __sync_fetch_and_add(a_ptr, 1); +} + + +int32_t iLAtomic_Decrement32(iLAtomic32* a_ptr) +{ + return __sync_fetch_and_add(a_ptr, -1); +} + + +int64_t iLAtomic_Decrement64(iLAtomic64* a_ptr) +{ + return __sync_fetch_and_add(a_ptr, -1); +} + +