1#include <clc/clc.h> 2 3#define IMPL(TYPE, AS, OP) \ 4_CLC_OVERLOAD _CLC_DEF TYPE atomic_max(volatile AS TYPE *p, TYPE val) { \ 5 return __sync_fetch_and_##OP(p, val); \ 6} 7 8IMPL(int, global, max) 9IMPL(unsigned int, global, umax) 10IMPL(int, local, max) 11IMPL(unsigned int, local, umax) 12#undef IMPL 13