Commit | Line | Data |
---|---|---|
3cc64cba KB |
1 | /*- |
2 | * Copyright (c) 1983 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * %sccs.include.redist.c% | |
6 | * | |
7 | * @(#)struct.h 5.1 (Berkeley) %G% | |
e8453270 SL |
8 | */ |
9 | ||
3cc64cba KB |
10 | /* Offset of the field in the structure. */ |
11 | #define fldoff(name, field) \ | |
12 | ((int)&(((struct name *)0)->field)) | |
13 | ||
14 | /* Size of the field in the structure. */ | |
15 | #define fldsiz(name, field) \ | |
16 | (sizeof(((struct name *)0)->field)) | |
17 | ||
18 | /* Address of the structure from a field. */ | |
19 | #define strbase(name, addr, field) \ | |
20 | ((struct name *)((char *)(addr) - fldoff(name, field))) |