mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-13 11:24:40 +00:00
libultra files and directories restructure (#1038)
* Restructure files, begin header restructure * Format * us2dex * Fix parallel spelling Co-authored-by: JoshDuMan <40190173+JoshDuMan@users.noreply.github.com> * Use OS_K0_TO_PHYSICAL in place of VIRTUAL_TO_PHYSICAL in osAiSetNextBuffer * Uppercase hex, exception vector address defines * Interrupt flags 1 Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * Interrupt flags 2 Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> Co-authored-by: JoshDuMan <40190173+JoshDuMan@users.noreply.github.com> Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
parent
eabc918817
commit
f1d183d6fe
164 changed files with 1171 additions and 738 deletions
43
include/libc/stdarg.h
Normal file
43
include/libc/stdarg.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
#ifndef STDARG_H
|
||||
#define STDARG_H
|
||||
|
||||
// When building with GCC, use the official vaarg macros to avoid warnings
|
||||
// and possibly bad codegen.
|
||||
#ifdef __GNUC__
|
||||
#define va_list __builtin_va_list
|
||||
#define va_start __builtin_va_start
|
||||
#define va_arg __builtin_va_arg
|
||||
#define va_end __builtin_va_end
|
||||
#else
|
||||
|
||||
typedef char* va_list;
|
||||
#define _FP 1
|
||||
#define _INT 0
|
||||
#define _STRUCT 2
|
||||
|
||||
#define _VA_FP_SAVE_AREA 0x10
|
||||
#define _VA_ALIGN(p, a) (((u32)(((char*)p) + ((a) > 4 ? (a) : 4) - 1)) & -((a) > 4 ? (a) : 4))
|
||||
#define va_start(vp, parmN) (vp = ((va_list)&parmN + sizeof(parmN)))
|
||||
|
||||
#define __va_stack_arg(list, mode) \
|
||||
( \
|
||||
((list) = (char*)_VA_ALIGN(list, __builtin_alignof(mode)) + \
|
||||
_VA_ALIGN(sizeof(mode), 4)), \
|
||||
(((char*)list) - (_VA_ALIGN(sizeof(mode), 4) - sizeof(mode))))
|
||||
|
||||
#define __va_double_arg(list, mode) \
|
||||
( \
|
||||
(((s32)list & 0x1) /* 1 byte aligned? */ \
|
||||
? (list = (char*)((s32)list + 7), (char*)((s32)list - 6 - _VA_FP_SAVE_AREA)) \
|
||||
: (((s32)list & 0x2) /* 2 byte aligned? */ \
|
||||
? (list = (char*)((s32)list + 10), (char*)((s32)list - 24 - _VA_FP_SAVE_AREA)) \
|
||||
: __va_stack_arg(list, mode))))
|
||||
|
||||
#define va_arg(list, mode) ((mode*)(((__builtin_classof(mode) == _FP && \
|
||||
__builtin_alignof(mode) == sizeof(f64)) \
|
||||
? __va_double_arg(list, mode) \
|
||||
: __va_stack_arg(list, mode))))[-1]
|
||||
#define va_end(__list)
|
||||
|
||||
#endif
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue