projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b1c024a
)
anv/private: Add a typed_memcpy macro
author
Jason Ekstrand
<jason.ekstrand@intel.com>
Wed, 7 Oct 2015 16:27:31 +0000
(09:27 -0700)
committer
Jason Ekstrand
<jason.ekstrand@intel.com>
Wed, 7 Oct 2015 16:36:27 +0000
(09:36 -0700)
This is amazingly helpful when copying arrays of things around.
src/vulkan/anv_private.h
patch
|
blob
|
history
diff --git
a/src/vulkan/anv_private.h
b/src/vulkan/anv_private.h
index e9735706a67128cc79f79ce394dedb8dd2cbec67..ac9422f6b90003fe3ecc33bbf87ef2494aaf4f05 100644
(file)
--- a/
src/vulkan/anv_private.h
+++ b/
src/vulkan/anv_private.h
@@
-115,6
+115,11
@@
anv_clear_mask(uint32_t *inout_mask, uint32_t clear_mask)
(b) = __builtin_ffs(__dword) - 1, __dword; \
__dword &= ~(1 << (b)))
+#define typed_memcpy(dest, src, count) ({ \
+ static_assert(sizeof(*src) == sizeof(*dest), ""); \
+ memcpy((dest), (src), (count) * sizeof(*(src))); \
+})
+
/* Define no kernel as 1, since that's an illegal offset for a kernel */
#define NO_KERNEL 1