Commit e319aaa0 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Andrei Vagin

compiler: Add FIELD_SIZEOF helper

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
Reviewed-by: 's avatarDmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent bc7d57eb
......@@ -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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment