stddef: Add macro for member_size
Add macro to calculate size of a structure member BUG=chrome-os-partner:41125 BRANCH=None TEST=Compiles successfully Change-Id: I71bcefe1c3b32ad559d7764e77369c67d09422a0 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: b425a310c14eabad79caf97649db6469380bd602 Original-Change-Id: I377fff062729aa664f7db469b86764b0ad941c38 Original-Signed-off-by: Furquan Shaikh <furquan@google.com> Original-Reviewed-on: https://chromium-review.googlesource.com/276809 Original-Reviewed-by: Jimmy Zhang <jimmzhang@nvidia.com> Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Original-Tested-by: Furquan Shaikh <furquan@chromium.org> Original-Commit-Queue: Furquan Shaikh <furquan@chromium.org> Original-Trybot-Ready: Furquan Shaikh <furquan@chromium.org> Reviewed-on: http://review.coreboot.org/10560 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
parent
0cd0d28f0a
commit
63a3e1ec7f
|
@ -14,6 +14,7 @@ typedef __SIZE_TYPE__ ssize_t;
|
||||||
#undef unsigned
|
#undef unsigned
|
||||||
|
|
||||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
|
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
|
||||||
|
#define member_size(TYPE, MEMBER) (sizeof(((TYPE *) 0)->MEMBER))
|
||||||
|
|
||||||
/* Standard units. */
|
/* Standard units. */
|
||||||
#define KiB (1<<10)
|
#define KiB (1<<10)
|
||||||
|
|
Loading…
Reference in New Issue