pointer.h

Sun, 27 Feb 2005 00:09:12 +0100

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sun, 27 Feb 2005 00:09:12 +0100
changeset 94
f48ffd2f2224
parent 89
17a16ed84bbf
permissions
-rw-r--r--

Added routinesn for generic iterables.

89
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
1 /*
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
2 * libtu/pointer.h
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
3 *
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
4 * Copyright (c) Tuomo Valkonen 2005.
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
5 *
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
6 * You may distribute and modify this library under the terms of either
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
7 * the Clarified Artistic License or the GNU LGPL, version 2.1 or later.
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
8 */
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
9
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
10 #ifndef LIBTU_POINTER_H
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
11 #define LIBTU_POINTER_H
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
12
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
13 #define FIELD_OFFSET(T, F) ((long)((char*)&((T*)0)->F))
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
14 #define FIELD_TO_STRUCT(T, F, A) ((T*)(((char*)A)-FIELD_OFFSET(T, F)))
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
15
17a16ed84bbf Added struct field address macros.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
16 #endif /* LIBTU_POINTER_H */

mercurial