Sat, 26 Feb 2005 10:37:20 +0100
Added struct field address macros.
pointer.h | file | annotate | diff | comparison | revisions |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pointer.h Sat Feb 26 10:37:20 2005 +0100 @@ -0,0 +1,16 @@ +/* + * libtu/pointer.h + * + * Copyright (c) Tuomo Valkonen 2005. + * + * You may distribute and modify this library under the terms of either + * the Clarified Artistic License or the GNU LGPL, version 2.1 or later. + */ + +#ifndef LIBTU_POINTER_H +#define LIBTU_POINTER_H + +#define FIELD_OFFSET(T, F) ((long)((char*)&((T*)0)->F)) +#define FIELD_TO_STRUCT(T, F, A) ((T*)(((char*)A)-FIELD_OFFSET(T, F))) + +#endif /* LIBTU_POINTER_H */