summaryrefslogtreecommitdiff
path: root/include/libc
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2023-09-02 15:34:29 -0400
committerGitHub <noreply@github.com>2023-09-02 15:34:29 -0400
commit4fa13e4132cf8adb2f07bb34927e62e525c8cc79 (patch)
tree5f00c923350f9386a7f46b0c50b888c878d7eacf /include/libc
parent9cceea48f31bdeea1c2933a1f64a74b60b80f17a (diff)
Move libultra function declarations to libultra headers (#1196)
* Delete unused headers * Move PR and io to ultra64 * move headers to ultra64 * more cleanups * more reorganizing * i think that should be all * format * ifdef guards cleanup * Add IO_READ and IO_WRITE macros for future use * warnings * review Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * warnings again * warn * ifdef guards * fix merge * fix merge * fix merge * bss * padutils.h * bss * bss * bss * fix merge * bss * bss * bss * fix merge * fixes * fixes * bss * bss * fix merge * fix * fix * fix includepaths * fix paths * bss * fix * ultra64/ -> PR/ * header guards * fix ehader guards * fix * fix++ * format * bss is borken * prevent 2 * :despair: * bss * rename assert to dbg_hungup * fix * a * fix * bss * fix * bss * bss --------- Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
Diffstat (limited to 'include/libc')
-rw-r--r--include/libc/alloca.h4
-rw-r--r--include/libc/assert.h4
-rw-r--r--include/libc/math.h10
-rw-r--r--include/libc/stdarg.h6
-rw-r--r--include/libc/stdbool.h4
-rw-r--r--include/libc/stddef.h4
-rw-r--r--include/libc/stdint.h4
-rw-r--r--include/libc/stdlib.h7
-rw-r--r--include/libc/string.h12
9 files changed, 33 insertions, 22 deletions
diff --git a/include/libc/alloca.h b/include/libc/alloca.h
index 4e8720f7e..fa49dd133 100644
--- a/include/libc/alloca.h
+++ b/include/libc/alloca.h
@@ -1,5 +1,5 @@
-#ifndef ALLOCA_H
-#define ALLOCA_H
+#ifndef LIBC_ALLOCA_H
+#define LIBC_ALLOCA_H
void* alloca(u32);
#define alloca __builtin_alloca
diff --git a/include/libc/assert.h b/include/libc/assert.h
deleted file mode 100644
index 1bc72e314..000000000
--- a/include/libc/assert.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef ASSERT_H
-#define ASSERT_H
-
-#endif
diff --git a/include/libc/math.h b/include/libc/math.h
index 1cdac0fb3..618ab52b5 100644
--- a/include/libc/math.h
+++ b/include/libc/math.h
@@ -1,5 +1,5 @@
-#ifndef MATH_H
-#define MATH_H
+#ifndef LIBC_MATH_H
+#define LIBC_MATH_H
#include "PR/ultratypes.h"
@@ -27,8 +27,10 @@ extern f32 __libm_qnan_f;
float fabsf(float f);
#pragma intrinsic(fabsf)
-float sqrtf(float f);
-#pragma intrinsic(sqrtf)
+#ifdef __GNUC__
+#define fabsf(f) __builtin_fabsf((float)(f))
+#endif
+
double sqrt(double d);
#pragma intrinsic(sqrt)
diff --git a/include/libc/stdarg.h b/include/libc/stdarg.h
index 77b8b8866..55f694385 100644
--- a/include/libc/stdarg.h
+++ b/include/libc/stdarg.h
@@ -1,7 +1,5 @@
-#ifndef STDARG_H
-#define STDARG_H
-
-#include "ultra64.h"
+#ifndef LIBC_STDARG_H
+#define LIBC_STDARG_H
// When building with GCC, use the official vaarg macros to avoid warnings
// and possibly bad codegen.
diff --git a/include/libc/stdbool.h b/include/libc/stdbool.h
index d441054c1..52546edb3 100644
--- a/include/libc/stdbool.h
+++ b/include/libc/stdbool.h
@@ -1,5 +1,5 @@
-#ifndef STDBOOL
-#define STDBOOL
+#ifndef LIBC_STDBOOL_H
+#define LIBC_STDBOOL_H
#define __bool_true_false_are_defined 1
diff --git a/include/libc/stddef.h b/include/libc/stddef.h
index 4f55e5725..e867d8e2a 100644
--- a/include/libc/stddef.h
+++ b/include/libc/stddef.h
@@ -1,5 +1,5 @@
-#ifndef STDDEF_H
-#define STDDEF_H
+#ifndef LIBC_STDDEF_H
+#define LIBC_STDDEF_H
#include "PR/ultratypes.h"
diff --git a/include/libc/stdint.h b/include/libc/stdint.h
index 20288d40d..854fd2546 100644
--- a/include/libc/stdint.h
+++ b/include/libc/stdint.h
@@ -1,5 +1,5 @@
-#ifndef STDINT_H
-#define STDINT_H
+#ifndef LIBC_STDINT_H
+#define LIBC_STDINT_H
#include "PR/ultratypes.h"
diff --git a/include/libc/stdlib.h b/include/libc/stdlib.h
index 57d352a13..ec15b4f6c 100644
--- a/include/libc/stdlib.h
+++ b/include/libc/stdlib.h
@@ -1,5 +1,5 @@
-#ifndef STDLIB_H
-#define STDLIB_H
+#ifndef LIBC_STDLIB_H
+#define LIBC_STDLIB_H
#include "libc/stddef.h"
@@ -22,4 +22,7 @@ typedef int ssize_t;
typedef long wchar_t;
+ldiv_t ldiv(long numer, long denom);
+lldiv_t lldiv(long long numer, long long denom);
+
#endif /* STDLIB_H */
diff --git a/include/libc/string.h b/include/libc/string.h
new file mode 100644
index 000000000..9c6a1cb08
--- /dev/null
+++ b/include/libc/string.h
@@ -0,0 +1,12 @@
+#ifndef LIBC_STRING_H
+#define LIBC_STRING_H
+
+#include "libc/stddef.h"
+
+
+const char* strchr(const char* s, int c);
+size_t strlen(const char* s);
+void* memcpy(void* s1, const void* s2, size_t n);
+
+
+#endif