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

Use atomic definitions

parent 6b6c7c84
Branches
Tags
2 merge requests!212Gravity infrastructure,!172[WIP] Self gravity (Barnes-Hut version)
...@@ -18,9 +18,18 @@ ...@@ -18,9 +18,18 @@
* *
******************************************************************************/ ******************************************************************************/
#include "map.h" /* Config parameters. */
#include "../config.h"
/* Some standard headers. */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
/* This object's header. */
#include "map.h"
/* Local headers. */
#include "atomic.h"
#include "error.h" #include "error.h"
/** /**
...@@ -97,7 +106,7 @@ void map_cells_plot(struct cell *c, void *data) { ...@@ -97,7 +106,7 @@ void map_cells_plot(struct cell *c, void *data) {
void map_cellcheck(struct cell *c, void *data) { void map_cellcheck(struct cell *c, void *data) {
int *count = (int *)data; int *count = (int *)data;
__sync_fetch_and_add(count, c->count); atomic_add(count, c->count);
/* Loop over all parts and check if they are in the cell. */ /* Loop over all parts and check if they are in the cell. */
for (int k = 0; k < c->count; k++) { for (int k = 0; k < c->count; k++) {
......
...@@ -38,13 +38,6 @@ ...@@ -38,13 +38,6 @@
#include "const.h" #include "const.h"
#include "error.h" #include "error.h"
/* Counter macros. */
#ifdef COUNTER
#define COUNT(c) (__sync_add_and_fetch(&queue_counter[c], 1))
#else
#define COUNT(c)
#endif
/* The counters. */ /* The counters. */
int queue_counter[queue_counter_count]; int queue_counter[queue_counter_count];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment