X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/baca54322c66983205edecd2ebb00d997878be50..270869139db617e29a35bb9ded41087bb702f9ac:/lunaix-os/includes/lunaix/types.h diff --git a/lunaix-os/includes/lunaix/types.h b/lunaix-os/includes/lunaix/types.h index 52faac3..f74c9b8 100644 --- a/lunaix-os/includes/lunaix/types.h +++ b/lunaix-os/includes/lunaix/types.h @@ -43,9 +43,12 @@ typedef int bool; #define container_of(ptr, type, member) \ ({ \ const typeof(((type*)0)->member)* __mptr = (ptr); \ - (ptr) ? (type*)((char*)__mptr - offsetof(type, member)) : 0; \ + ((ptr_t)ptr != 0UL) ? (type*)((char*)__mptr - offsetof(type, member)) : 0; \ }) +#define offset(data, off) \ + ((void*)(__ptr(data) + (off))) + #define __ptr(val) ((ptr_t)(val)) typedef va_list* sc_va_list;