xref: /original-bsd/include/struct.h (revision 331bfa8d)
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) 01/20/91
8  */
9 
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)))
21