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

#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)

#undef __CLC_DECLARE_ATOMIC
#undef __CLC_DECLARE_ATOMIC_ADDRSPACE
