diff --git a/src/runtime/d3d12compute.cpp b/src/runtime/d3d12compute.cpp index f4f85180a56e..8d472e22a0ba 100644 --- a/src/runtime/d3d12compute.cpp +++ b/src/runtime/d3d12compute.cpp @@ -232,6 +232,12 @@ WEAK void d3d12_free(void *p) { free(p); } +template +WEAK T zero_struct() { + T zero = {}; + return zero; +} + template WEAK T *malloct() { TRACELOG; @@ -244,12 +250,6 @@ WEAK T *malloct() { return p; } -template -WEAK T zero_struct() { - T zero = {}; - return zero; -} - #define hashmap_malloc(user_context, size) d3d12_malloc(size) #define hashmap_free(user_context, memory) d3d12_free(memory) #include "hashmap.h" diff --git a/src/runtime/runtime_atomics.h b/src/runtime/runtime_atomics.h index 61139a622d75..1e9a2367c3e0 100644 --- a/src/runtime/runtime_atomics.h +++ b/src/runtime/runtime_atomics.h @@ -39,27 +39,27 @@ ALWAYS_INLINE T atomic_fetch_add_acquire_release(T *addr, T val) { } template::type> -ALWAYS_INLINE T atomic_fetch_add_sequentially_consistent(T *addr, TV val) { +ALWAYS_INLINE TV atomic_fetch_add_sequentially_consistent(T *addr, TV val) { return __sync_fetch_and_add(addr, val); } template::type> -ALWAYS_INLINE T atomic_fetch_sub_sequentially_consistent(T *addr, TV val) { +ALWAYS_INLINE TV atomic_fetch_sub_sequentially_consistent(T *addr, TV val) { return __sync_fetch_and_sub(addr, val); } template::type> -ALWAYS_INLINE T atomic_fetch_or_sequentially_consistent(T *addr, TV val) { +ALWAYS_INLINE TV atomic_fetch_or_sequentially_consistent(T *addr, TV val) { return __sync_fetch_and_or(addr, val); } -template -ALWAYS_INLINE T atomic_add_fetch_sequentially_consistent(T *addr, T val) { +template::type> +ALWAYS_INLINE TV atomic_add_fetch_sequentially_consistent(T *addr, TV val) { return __sync_add_and_fetch(addr, val); } -template -ALWAYS_INLINE T atomic_sub_fetch_sequentially_consistent(T *addr, T val) { +template::type> +ALWAYS_INLINE TV atomic_sub_fetch_sequentially_consistent(T *addr, TV val) { return __sync_sub_and_fetch(addr, val); } @@ -103,7 +103,7 @@ ALWAYS_INLINE T atomic_fetch_and_release(T *addr, T val) { } template::type> -ALWAYS_INLINE T atomic_fetch_and_sequentially_consistent(T *addr, TV val) { +ALWAYS_INLINE TV atomic_fetch_and_sequentially_consistent(T *addr, TV val) { return __sync_fetch_and_and(addr, val); } @@ -165,27 +165,27 @@ ALWAYS_INLINE T atomic_fetch_add_acquire_release(T *addr, T val) { } template::type> -ALWAYS_INLINE T atomic_fetch_add_sequentially_consistent(T *addr, TV val) { +ALWAYS_INLINE TV atomic_fetch_add_sequentially_consistent(T *addr, TV val) { return __atomic_fetch_add(addr, val, __ATOMIC_SEQ_CST); } template::type> -ALWAYS_INLINE T atomic_fetch_sub_sequentially_consistent(T *addr, TV val) { +ALWAYS_INLINE TV atomic_fetch_sub_sequentially_consistent(T *addr, TV val) { return __atomic_fetch_sub(addr, val, __ATOMIC_SEQ_CST); } template::type> -ALWAYS_INLINE T atomic_fetch_or_sequentially_consistent(T *addr, TV val) { +ALWAYS_INLINE TV atomic_fetch_or_sequentially_consistent(T *addr, TV val) { return __atomic_fetch_or(addr, val, __ATOMIC_SEQ_CST); } -template -ALWAYS_INLINE T atomic_add_fetch_sequentially_consistent(T *addr, T val) { +template::type> +ALWAYS_INLINE TV atomic_add_fetch_sequentially_consistent(T *addr, TV val) { return __atomic_add_fetch(addr, val, __ATOMIC_SEQ_CST); } -template -ALWAYS_INLINE T atomic_sub_fetch_sequentially_consistent(T *addr, T val) { +template::type> +ALWAYS_INLINE TV atomic_sub_fetch_sequentially_consistent(T *addr, TV val) { return __atomic_sub_fetch(addr, val, __ATOMIC_SEQ_CST); }