XenevaOS
Loading...
Searching...
No Matches
stdarg.h
Go to the documentation of this file.
1
30#ifndef __STDARG_H__
31#define __STDARG_H__
32
33
34#include <va_list.h>
35#include <stdint.h>
36
37
38#ifdef __cplusplus
39extern "C"
40{
41#endif
42
43 /* width of stack == width of int */
44#define STACKITEM int64_t
45
46 /* round up width of objects pushed on stack. The expression before the
47 & ensures that we get 0 for objects of size 0. */
48#define VA_SIZE(TYPE) \
49 ((sizeof(TYPE)+sizeof(STACKITEM)-1) \
50 & ~(sizeof(STACKITEM)-1))
51
52 /* &(LASTARG) points to the LEFTMOST argument of the function call
53 (before the ...) */
54#define va_start(AP, LASTARG) \
55 (AP = ((va_list)&(LASTARG)+VA_SIZE(LASTARG)))
56
57 /* nothing for va_end */
58#define va_end(AP)
59
60#define va_arg(AP, TYPE) \
61 (AP += VA_SIZE(TYPE), *((TYPE *)(AP - VA_SIZE(TYPE))))
62
63#ifdef __cplusplus
64}
65#endif
66
67#endif