[02/18] compiler: Add FIELD_SIZEOF helper

Submitted by Cyrill Gorcunov on July 19, 2018, 12:47 p.m.

Details

Message ID 20180719124746.7546-3-gorcunov@gmail.com
State Accepted
Series "x86: Add support for extendable fpu frames"
Headers show

Commit Message

Cyrill Gorcunov July 19, 2018, 12:47 p.m.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 include/common/compiler.h | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/include/common/compiler.h b/include/common/compiler.h
index ada79f293300..eaf545b26c29 100644
--- a/include/common/compiler.h
+++ b/include/common/compiler.h
@@ -57,6 +57,10 @@ 
 	const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
 	(type *)( (char *)__mptr - offsetof(type,member) );})
 
+#ifndef FIELD_SIZEOF
+# define FIELD_SIZEOF(t, f)	(sizeof(((t*)0)->f))
+#endif
+
 #define __round_mask(x, y)	((__typeof__(x))((y) - 1))
 #define round_up(x, y)		((((x) - 1) | __round_mask(x, y)) + 1)
 #define round_down(x, y)	((x) & ~__round_mask(x, y))

Comments

Dmitry Safonov July 25, 2018, 7:11 p.m.
2018-07-19 13:47 GMT+01:00 Cyrill Gorcunov <gorcunov@gmail.com>:
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>

Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>

Thanks,
             Dmitry