About Social Code
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarol Herbst <kherbst@redhat.com>2025-09-02 23:44:29 +0200
committerMarge Bot <marge-bot@fdo.invalid>2025-09-05 20:01:00 +0000
commit083a3dc5457a999bc30c8ab3550dd95b8547a61f (patch)
tree6b25e8477dff23dec9bb6e66afa4729540db23fa
parent1c764357e889916808b13a264b110b814dcbf6b1 (diff)
util: move typed_memcpy into macros.h
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37135>
-rw-r--r--src/util/macros.h9
-rw-r--r--src/vulkan/util/vk_util.h9
2 files changed, 9 insertions, 9 deletions
diff --git a/src/util/macros.h b/src/util/macros.h
index e84f2be13a7..829031c88ca 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -555,4 +555,13 @@ typedef int lock_cap_t;
} while (0)
#endif
+#define typed_memcpy(dest, src, count) do { \
+ STATIC_ASSERT(sizeof(*(src)) == sizeof(*(dest))); \
+ uint8_t *d = (uint8_t*)(dest); \
+ const uint8_t *s = (const uint8_t*)(src); \
+ if (d != NULL && s != NULL && (count) > 0) { \
+ memcpy(d, s, (count) * sizeof(*(src))); \
+ } \
+} while (0)
+
#endif /* UTIL_MACROS_H */
diff --git a/src/vulkan/util/vk_util.h b/src/vulkan/util/vk_util.h
index 7f518ea38cf..aea4c569a18 100644
--- a/src/vulkan/util/vk_util.h
+++ b/src/vulkan/util/vk_util.h
@@ -306,15 +306,6 @@ struct vk_pipeline_cache_header {
#define VK_ENUM_OFFSET(__enum) \
((__enum) >= VK_EXT_OFFSET ? ((__enum) % 1000) : (__enum))
-#define typed_memcpy(dest, src, count) do { \
- STATIC_ASSERT(sizeof(*(src)) == sizeof(*(dest))); \
- uint8_t *d = (uint8_t*)(dest); \
- const uint8_t *s = (const uint8_t*)(src); \
- if (d != NULL && s != NULL && (count) > 0) { \
- memcpy(d, s, (count) * sizeof(*(src))); \
- } \
-} while (0)
-
static inline mesa_shader_stage
vk_to_mesa_shader_stage(VkShaderStageFlagBits vk_stage)
{