xref: /csrg-svn/sys/pmax/include/stdarg.h (revision 57008)
156674Sbostic /*-
256674Sbostic  * Copyright (c) 1992 The Regents of the University of California.
356674Sbostic  * All rights reserved.
456674Sbostic  *
556674Sbostic  * %sccs.include.redist.c%
656674Sbostic  *
7*57008Sralph  *	@(#)stdarg.h	7.2 (Berkeley) 12/05/92
856674Sbostic  */
956674Sbostic 
1056674Sbostic typedef char *va_list;
1156674Sbostic 
1256674Sbostic #define	__va_promote(type) \
1356674Sbostic 	(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
1456674Sbostic 
1556674Sbostic #define	va_start(ap, last) \
1656674Sbostic 	(ap = ((char *)&(last) + __va_promote(last)))
1756674Sbostic 
1856674Sbostic #ifdef KERNEL
1956674Sbostic #define	va_arg(ap, type) \
2056674Sbostic 	((type *)(ap += sizeof(type)))[-1]
2156674Sbostic #else
2256674Sbostic #define	va_arg(ap, type) \
2356674Sbostic 	((type *)(ap += sizeof(type) == sizeof(int) ? sizeof(type) : \
2456674Sbostic 		sizeof(type) > sizeof(int) ? \
25*57008Sralph 		(-(int)(ap) & (sizeof(type) - 1)) + sizeof(type) : \
2656674Sbostic 		(abort(), 0)))[-1]
2756674Sbostic #endif
2856674Sbostic 
2956674Sbostic #define	va_end(ap)
30