Mario Kart 64
Loading...
Searching...
No Matches
stdarg.h
Go to the documentation of this file.
1#ifndef STDARG_H
2#define STDARG_H
3
4// When not building with IDO, use the builtin vaarg macros for portability.
5#ifndef __sgi
6#define va_list __builtin_va_list
7#define va_start __builtin_va_start
8#define va_arg __builtin_va_arg
9#define va_end __builtin_va_end
10#else
11
12typedef char* va_list;
13#define _FP 1
14#define _INT 0
15#define _STRUCT 2
16
17#define _VA_FP_SAVE_AREA 0x10
18#define _VA_ALIGN(p, a) (((unsigned int) (((char*) p) + ((a) > 4 ? (a) : 4) - 1)) & -((a) > 4 ? (a) : 4))
19#define va_start(vp, parmN) (vp = ((va_list) & parmN + sizeof(parmN)))
20
21#define __va_stack_arg(list, mode) \
22 (((list) = (char*) _VA_ALIGN(list, __builtin_alignof(mode)) + _VA_ALIGN(sizeof(mode), 4)), \
23 (((char*) list) - (_VA_ALIGN(sizeof(mode), 4) - sizeof(mode))))
24
25#define __va_double_arg(list, mode) \
26 ((((long) list & 0x1) /* 1 byte aligned? */ \
27 ? (list = (char*) ((long) list + 7), (char*) ((long) list - 6 - _VA_FP_SAVE_AREA)) \
28 : (((long) list & 0x2) /* 2 byte aligned? */ \
29 ? (list = (char*) ((long) list + 10), (char*) ((long) list - 24 - _VA_FP_SAVE_AREA)) \
30 : __va_stack_arg(list, mode))))
31
32#define va_arg(list, mode) \
33 ((mode*) (((__builtin_classof(mode) == _FP && __builtin_alignof(mode) == sizeof(double)) \
34 ? __va_double_arg(list, mode) \
35 : __va_stack_arg(list, mode))))[-1]
36#define va_end(__list)
37
38#endif
39#endif
#define va_list
Definition stdarg.h:6