From 3e9bdcca84e22c997a071dddf37449ead85aed75 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Sat, 16 Jun 2018 04:49:57 +1000 Subject: Initial commit --- include/stdarg.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 include/stdarg.h (limited to 'include/stdarg.h') 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 -- cgit v1.3