diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h index 3e240710e7..c09fc172ef 100644 --- a/payloads/libpayload/include/libpayload.h +++ b/payloads/libpayload/include/libpayload.h @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include diff --git a/payloads/libpayload/include/stddef.h b/payloads/libpayload/include/stddef.h index bb2971dd3a..fe455b8a23 100644 --- a/payloads/libpayload/include/stddef.h +++ b/payloads/libpayload/include/stddef.h @@ -16,7 +16,15 @@ typedef __SIZE_TYPE__ ssize_t; #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER) #define member_size(TYPE, MEMBER) (sizeof(((TYPE *) 0)->MEMBER)) +#define check_member(structure, member, offset) _Static_assert( \ + offsetof(struct structure, member) == offset, \ + "`struct " #structure "` offset for `" #member "` is not " #offset) + /* Standard units. */ #define KiB (1<<10) #define MiB (1<<20) #define GiB (1<<30) + +#define KHz (1000) +#define MHz (1000*KHz) +#define GHz (1000*MHz)