Skip to content

Commit 31bcff6

Browse files
committed
Fix #32: va_arg for generic data types
1 parent e287bf1 commit 31bcff6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/usr/include/stdarg.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ namespace std {
66
#endif
77

88
typedef struct va_list {
9-
int *base; // using int* to jmp at 4 bytes gap
9+
void *base;
1010
} va_list;
1111

12-
#define va_start(list, last) ((list).base = (((int*)&(last))+1))
12+
#define va_start(list, last) ((list).base = (((void*)&(last))+1))
1313
#define va_end(list) (list).base = NULL
14-
#define va_arg(list, type) (*(type*)((list).base++))
14+
#define va_arg(list, type) (*(type*)((list).base+=sizeof(type)))
1515
#define va_copy(dst, src) (dst).base = (src).base
1616

1717
#ifdef __cplusplus

0 commit comments

Comments
 (0)