mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-12 09:50:50 +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
5
src/libultra/libc/absf.c
Normal file
5
src/libultra/libc/absf.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "global.h"
|
||||
|
||||
f32 absf(f32 a) {
|
||||
return fabsf(a);
|
||||
}
|
27
src/libultra/libc/ldiv.c
Normal file
27
src/libultra/libc/ldiv.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include "global.h"
|
||||
|
||||
ldiv_t ldiv(s32 num, s32 denom) {
|
||||
ldiv_t ret;
|
||||
|
||||
ret.quot = num / denom;
|
||||
ret.rem = num - denom * ret.quot;
|
||||
if (ret.quot < 0 && ret.rem > 0) {
|
||||
ret.quot++;
|
||||
ret.rem -= denom;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
lldiv_t lldiv(s64 num, s64 denom) {
|
||||
lldiv_t ret;
|
||||
|
||||
ret.quot = num / denom;
|
||||
ret.rem = num - denom * ret.quot;
|
||||
if (ret.quot < 0 && ret.rem > 0) {
|
||||
ret.quot++;
|
||||
ret.rem -= denom;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
47
src/libultra/libc/ll.c
Normal file
47
src/libultra/libc/ll.c
Normal file
|
@ -0,0 +1,47 @@
|
|||
#include "global.h"
|
||||
|
||||
s64 __ull_rshift(u64 l, s64 r) {
|
||||
return l >> r;
|
||||
}
|
||||
|
||||
u64 __ull_rem(u64 l, u64 r) {
|
||||
return l % r;
|
||||
}
|
||||
|
||||
u64 __ull_div(u64 l, u64 r) {
|
||||
return l / r;
|
||||
}
|
||||
|
||||
s64 __ll_lshift(s64 l, s64 r) {
|
||||
return l << r;
|
||||
}
|
||||
|
||||
s64 __ll_rem(s64 l, u64 r) {
|
||||
return l % r;
|
||||
}
|
||||
|
||||
s64 __ll_div(s64 l, s64 r) {
|
||||
return l / r;
|
||||
}
|
||||
|
||||
s64 __ll_mul(s64 l, s64 r) {
|
||||
return l * r;
|
||||
}
|
||||
|
||||
void __ull_divremi(u64* quotient, u64* remainder, u64 dividend, u16 divisor) {
|
||||
*quotient = dividend / divisor;
|
||||
*remainder = dividend % divisor;
|
||||
}
|
||||
|
||||
s64 __ll_mod(s64 l, s64 r) {
|
||||
s64 remainder = l % r;
|
||||
|
||||
if (((remainder < 0) && (r > 0)) || ((remainder > 0) && (r < 0))) {
|
||||
remainder += r;
|
||||
}
|
||||
return remainder;
|
||||
}
|
||||
|
||||
s64 __ll_rshift(s64 l, s64 r) {
|
||||
return l >> r;
|
||||
}
|
33
src/libultra/libc/llcvt.c
Normal file
33
src/libultra/libc/llcvt.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include "global.h"
|
||||
|
||||
s64 __d_to_ll(f64 d) {
|
||||
return d;
|
||||
}
|
||||
|
||||
s64 __f_to_ll(f32 f) {
|
||||
return f;
|
||||
}
|
||||
|
||||
u64 __d_to_ull(f64 d) {
|
||||
return d;
|
||||
}
|
||||
|
||||
u64 __f_to_ull(f32 f) {
|
||||
return f;
|
||||
}
|
||||
|
||||
f64 __ll_to_d(s64 l) {
|
||||
return l;
|
||||
}
|
||||
|
||||
f32 __ll_to_f(s64 l) {
|
||||
return l;
|
||||
}
|
||||
|
||||
f64 __ull_to_d(u64 l) {
|
||||
return l;
|
||||
}
|
||||
|
||||
f32 __ull_to_f(u64 l) {
|
||||
return l;
|
||||
}
|
9
src/libultra/libc/sqrt.c
Normal file
9
src/libultra/libc/sqrt.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "global.h"
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __builtin_sqrt sqrt
|
||||
#endif
|
||||
|
||||
f64 sqrt(f64 f) {
|
||||
return __builtin_sqrt(f);
|
||||
}
|
33
src/libultra/libc/string.c
Normal file
33
src/libultra/libc/string.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include "global.h"
|
||||
|
||||
const char* strchr(const char* str, s32 ch) {
|
||||
u8 c = ch;
|
||||
|
||||
while (*str != c) {
|
||||
if (*str == 0) {
|
||||
return NULL;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
u32 strlen(const char* str) {
|
||||
const char* ptr = str;
|
||||
|
||||
while (*ptr) {
|
||||
ptr++;
|
||||
}
|
||||
return ptr - str;
|
||||
}
|
||||
|
||||
void* memcpy(void* dst, const void* src, u32 size) {
|
||||
u8* _dst = dst;
|
||||
const u8* _src = src;
|
||||
|
||||
while (size > 0) {
|
||||
*_dst++ = *_src++;
|
||||
size--;
|
||||
}
|
||||
return dst;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue