utils: Add missing vk_container_of macro 87/72787/1
authorTaekyun Kim <tkq.kim@samsung.com>
Thu, 19 May 2016 05:06:25 +0000 (14:06 +0900)
committerTaekyun Kim <tkq.kim@samsung.com>
Thu, 2 Jun 2016 11:02:50 +0000 (20:02 +0900)
Change-Id: I5dc389412a8a22098f994b29e281d8dde659f2bf

src/utils/utils.h

index f92a2c8..4750d90 100644 (file)
@@ -68,6 +68,9 @@
 
 #define VK_ASSERT(exp) assert(exp)
 
+#define vk_container_of(ptr, sample, member)                                                                   \
+       (__typeof__(sample))((char *)(ptr) - offsetof(__typeof__(*sample), member))
+
 typedef VkBool32       vk_bool_t;
 
 void