#define __CLC_DECLARE_ATOMIC(FUNCTION, ADDRSPACE, TYPE) \
    TYPE __##FUNCTION##_##ADDRSPACE##_##TYPE( \
           volatile ADDRSPACE TYPE *x, TYPE y); \
    _CLC_INLINE _CLC_OVERLOAD TYPE __##FUNCTION( \
           volatile ADDRSPACE TYPE *x, TYPE y) { \
        return __##FUNCTION##_##ADDRSPACE##_##TYPE(x, y); \
    }

#define __CLC_DECLARE_ATOMIC_ADDRSPACE(FUNCTION, TYPE) \
    __CLC_DECLARE_ATOMIC(FUNCTION, global, TYPE) \
    __CLC_DECLARE_ATOMIC(FUNCTION, local, TYPE)

__CLC_DECLARE_ATOMIC_ADDRSPACE(__CLC_FUNCTION, int)
__CLC_DECLARE_ATOMIC_ADDRSPACE(__CLC_FUNCTION, uint)

#ifdef __CLC_NEED_ATOMIC_FLOAT
__CLC_DECLARE_ATOMIC_ADDRSPACE(__CLC_FUNCTION, float)
#endif

#undef __CLC_DECLARE_ATOMIC
#undef __CLC_DECLARE_ATOMIC_ADDRSPACE
