# HG changeset patch # User Tuomo Valkonen # Date 1109410640 -3600 # Node ID 17a16ed84bbf6d8f936abef6ca0abb782b88ba1f # Parent 308dfa54da3edb3fb61b651f92309bc1ab2f8692 Added struct field address macros. diff -r 308dfa54da3e -r 17a16ed84bbf pointer.h --- /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 */