Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2018-07-19 15:47:30 +0300
committerAndrei Vagin <avagin@gmail.com>2018-10-30 19:27:55 +0300
commite319aaa0cf489488d7796b6abea7f88a21d6e07f (patch)
tree7c5341c2cd723b905a7a87142206f8eac677c397 /include
parentbc7d57ebadc00bff01e8e90ccc2600687eb6d025 (diff)
compiler: Add FIELD_SIZEOF helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Diffstat (limited to 'include')
-rw-r--r--include/common/compiler.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/common/compiler.h b/include/common/compiler.h
index ada79f293..eaf545b26 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))