Skip to content
Snippets Groups Projects
Commit 15106d9f authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Changed the char atomic max to a int8_t atomic max

parent 001c818b
No related branches found
No related tags found
1 merge request!1048Atomic gravity and time-step limiter
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#include "inline.h" #include "inline.h"
#include "minmax.h" #include "minmax.h"
/* Standard includes */
#include <stdint.h>
#define atomic_add(v, i) __sync_fetch_and_add(v, i) #define atomic_add(v, i) __sync_fetch_and_add(v, i)
#define atomic_sub(v, i) __sync_fetch_and_sub(v, i) #define atomic_sub(v, i) __sync_fetch_and_sub(v, i)
#define atomic_or(v, i) __sync_fetch_and_or(v, i) #define atomic_or(v, i) __sync_fetch_and_or(v, i)
...@@ -122,7 +125,7 @@ __attribute__((always_inline)) INLINE static void atomic_min_d( ...@@ -122,7 +125,7 @@ __attribute__((always_inline)) INLINE static void atomic_min_d(
} }
/** /**
* @brief Atomic max operation on chars. * @brief Atomic max operation on int8_t.
* *
* This is a text-book implementation based on an atomic CAS. * This is a text-book implementation based on an atomic CAS.
* *
...@@ -130,9 +133,9 @@ __attribute__((always_inline)) INLINE static void atomic_min_d( ...@@ -130,9 +133,9 @@ __attribute__((always_inline)) INLINE static void atomic_min_d(
* @param y The value to update the address with. * @param y The value to update the address with.
*/ */
__attribute__((always_inline)) INLINE static void atomic_max_c( __attribute__((always_inline)) INLINE static void atomic_max_c(
volatile char *const address, const char y) { volatile int8_t *const address, const int8_t y) {
char test_val, old_val, new_val; int8_t test_val, old_val, new_val;
old_val = *address; old_val = *address;
do { do {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment