You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
224 B
C

#pragma once
#include <stddef.h>
#include "typecheck.h"
#define TLSL_CONTAINER_OF(PTR, TYPE, MEMBER) ({ \
TLSL_TYPEOFS_EQ(((TYPE *)NULL)->MEMBER, *(PTR)); \
(TYPE *)((char *)(PTR) - offsetof(TYPE, MEMBER)); \
})