 }
 
 static inline CUDA_DEVICE void AtomicMax(real3* pointer, real3 val) {
-    AtomicMaxf(&pointer->x, val.x);
-    AtomicMaxf(&pointer->y, val.y);
-    AtomicMaxf(&pointer->z, val.z);
+    AtomicMax(&pointer->x, val.x);
+    AtomicMax(&pointer->y, val.y);
+    AtomicMax(&pointer->z, val.z);
 }
 
 static inline CUDA_DEVICE void AtomicMin(real3* pointer, real3 val) {
-    AtomicMinf(&pointer->x, val.x);
-    AtomicMinf(&pointer->y, val.y);
-    AtomicMinf(&pointer->z, val.z);
-}
-}
+    AtomicMin(&pointer->x, val.x);
+    AtomicMin(&pointer->y, val.y);
+    AtomicMin(&pointer->z, val.z);
+}
+}


// Used by cub
struct real3Min {
    inline CUDA_DEVICE real3 operator()(const real3& a, const real3& b) { return Min(a, b); }
};

struct real3Max {
    inline CUDA_DEVICE real3 operator()(const real3& a, const real3& b) { return Max(a, b); }
};

// code adopted from http://stackoverflow.com/questions/17371275/implementing-max-reduce-in-cuda
// ========================================================================================
static inline CUDA_DEVICE float AtomicMaxf(float* address, float value) {
    int* address_as_int = (int*)address;
    int old = *address_as_int, assumed;


    return __int_as_float(old);
}

static inline CUDA_DEVICE float AtomicMin(float* address, float value) {
    int* address_as_int = (int*)address;
    int old = *address_as_int, assumed;

