mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 09:58:09 +00:00
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>
This commit is contained in:
parent
bc7d57ebad
commit
e319aaa0cf
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user