summaryrefslogtreecommitdiff
path: root/include/stdarg.h
blob: 8eb13413f10919b6942eee5772a5353142ec14ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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