1
0

stdarg.h 406 B

12345678910111213141516171819
  1. #ifndef __STDARG_H
  2. #define __STDARG_H
  3. typedef struct {
  4. int ptr;
  5. } va_list;
  6. int __postadd(int *x, int y) {
  7. int r = *x;
  8. *x += y;
  9. return r;
  10. }
  11. #define va_start(list, param) ((void)(list.ptr = (int)&(param) + sizeof(param)))
  12. #define va_arg(list, type) (*(type*)__postadd(&list.ptr, sizeof(type)))
  13. #define va_copy(dest, src) ((void)(dest.ptr = src.ptr))
  14. #define va_end(list) ((void)0)
  15. #endif