pointer.h

Tue, 17 Oct 2006 00:32:05 +0200

author
Tuomo Valkonen <tuomov@iki.fi>
date
Tue, 17 Oct 2006 00:32:05 +0200
changeset 103
76174c5f04b5
parent 89
17a16ed84bbf
permissions
-rw-r--r--

Path fix

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