varg.h (516B)
1 #ifndef __VARG_H 2 #define __VARG_H 3 4 #include <inttypes.h> 5 6 #define __BND (sizeof(uintptr_t) - 1) 7 #define __bnd(X) ((sizeof(X) + __BND) & (~__BND)) 8 9 /* AAPCS p.28 */ 10 struct __va_list { 11 char *__ap; 12 }; 13 14 typedef struct __va_list va_list; 15 16 #define va_start(ap, last) ((void) ((ap).__ap = ((char*) &(last) + __bnd(last)))) 17 #define va_end(ap) ((void) 0) 18 #define va_arg(ap, type) (*(type*) (((ap).__ap += __bnd(type)) - __bnd(type))) 19 #define va_copy(dest, src) ((void) ((dest).__ap = (src).__ap)) 20 21 #endif /* __VARG_H */