diff options
| author | Jake Mannens <jake72360@gmail.com> | 2018-06-16 04:49:57 +1000 |
|---|---|---|
| committer | Jake Mannens <jake72360@gmail.com> | 2018-06-16 04:49:57 +1000 |
| commit | 3e9bdcca84e22c997a071dddf37449ead85aed75 (patch) | |
| tree | 06def7ef704b348cdef2b704d3357b79d22f00bd /include/stdarg.h | |
Initial commit
Diffstat (limited to 'include/stdarg.h')
| -rw-r--r-- | include/stdarg.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/stdarg.h b/include/stdarg.h new file mode 100644 index 0000000..8eb1341 --- /dev/null +++ b/include/stdarg.h @@ -0,0 +1,27 @@ +/* + * stdarg.h + * + * Provides va_list and associated functions + */ + +#ifndef _STDARG_H +#define _STDARG_H + +typedef char* va_list; + +#define __va_rounded_size(TYPE) \ + (((sizeof(TYPE) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) + +#define va_start(AP, LAST) \ + (AP = ((char*) &LAST + __va_rounded_size(LAST))) + +#define va_arg(AP, TYPE) \ + (AP += __va_rounded_size(TYPE), \ + *((TYPE*) (AP - __va_rounded_size(TYPE)))) + +#define va_end(AP) + +#define va_copy(DEST, SRC) \ + (DEST = SRC) + +#endif |
