146049Sbostic /*- 2*61068Sbostic * Copyright (c) 1983, 1993 3*61068Sbostic * The Regents of the University of California. All rights reserved. 446049Sbostic * 546049Sbostic * %sccs.include.redist.c% 646049Sbostic * 7*61068Sbostic * @(#)struct.h 8.1 (Berkeley) 06/02/93 812195Ssam */ 912195Ssam 1047781Sbostic #ifndef _STRUCT_H_ 1147781Sbostic #define _STRUCT_H_ 1247781Sbostic 1346049Sbostic /* Offset of the field in the structure. */ 1446049Sbostic #define fldoff(name, field) \ 1546049Sbostic ((int)&(((struct name *)0)->field)) 1646049Sbostic 1746049Sbostic /* Size of the field in the structure. */ 1846049Sbostic #define fldsiz(name, field) \ 1946049Sbostic (sizeof(((struct name *)0)->field)) 2046049Sbostic 2146049Sbostic /* Address of the structure from a field. */ 2246049Sbostic #define strbase(name, addr, field) \ 2346049Sbostic ((struct name *)((char *)(addr) - fldoff(name, field))) 2447781Sbostic 2547781Sbostic #endif /* !_STRUCT_H_ */ 26