34,24 → 34,19 |
|
#include <types.h> |
|
typedef struct va_list { |
int pos; |
uint8_t *last; |
} va_list; |
|
#define va_start(ap, lst) \ |
(ap).pos = sizeof(lst); \ |
(ap).last = (uint8_t *) &(lst) |
|
/** |
* va_arg macro for MIPS32 - problem is that 64 bit values must be aligned on an 8-byte boundary (32bit values not) |
* To satisfy this, paddings must be sometimes inserted. |
*/ |
#define va_arg(ap, type) \ |
(*((type *)((ap).last + ((ap).pos += sizeof(type) + ((sizeof(type) == 8) && (((ap).pos)&4) ? 4 : 0)) - sizeof(type)))) |
|
#define va_end(ap) |
typedef uint8_t* va_list; |
|
#define va_start(ap, lst) \ |
((ap) = (va_list)&(lst) + sizeof(lst)) |
|
#define va_arg(ap, type) \ |
(((type *)((ap) = (va_list)( (sizeof(type) <= 4) ? ((uint32_t)((ap) + 2*4 - 1) & (~3)) : ((uint32_t)((ap) + 2*8 -1) & (~7)) )))[-1]) |
|
#define va_end(ap) |
|
#endif |