summaryrefslogtreecommitdiff
path: root/include/PR
diff options
context:
space:
mode:
authorTharo <17233964+Thar0@users.noreply.github.com>2024-12-14 02:28:22 +0000
committerGitHub <noreply@github.com>2024-12-13 18:28:22 -0800
commit01a1b113b40fedea4f95753275e28a9838c60591 (patch)
treeeba925634bacbc038ee0a512f3acb1de392bdbaa /include/PR
parentfc8d1165c8beb6d6d54b54c2a56387c99b8d7861 (diff)
libultra/libc cleanup (#1757)
* libultra/libc cleanup * Format * Correct prototype for strchr * Different prototypes for bzero, bcmp, bcopy under __GNUC__ to match builtin prototypes * Correct alloca prototype
Diffstat (limited to 'include/PR')
-rw-r--r--include/PR/os_libc.h11
-rw-r--r--include/PR/xstdio.h50
2 files changed, 36 insertions, 25 deletions
diff --git a/include/PR/os_libc.h b/include/PR/os_libc.h
index dfbf6cd43..aaff9fea9 100644
--- a/include/PR/os_libc.h
+++ b/include/PR/os_libc.h
@@ -3,10 +3,15 @@
#include "stdarg.h"
-
-void bcopy(void* __src, void* __dest, int __n);
-int bcmp(void* __s1, void* __s2, int __n);
+#ifdef __GNUC__
+void bzero(void* begin, unsigned int length);
+int bcmp(const void* __s1, const void* __s2, unsigned int __n);
+void bcopy(const void* __src, void* __dest, unsigned int __n);
+#else
void bzero(void* begin, int length);
+int bcmp(const void* __s1, const void* __s2, int __n);
+void bcopy(const void* __src, void* __dest, int __n);
+#endif
void osSyncPrintf(const char* fmt, ...);
diff --git a/include/PR/xstdio.h b/include/PR/xstdio.h
index 34d02ddeb..a2541ab4a 100644
--- a/include/PR/xstdio.h
+++ b/include/PR/xstdio.h
@@ -1,38 +1,44 @@
#ifndef PR_XSTDIO_H
#define PR_XSTDIO_H
-#include "ultratypes.h"
#include "stdarg.h"
+// IDO doesn't support long double types, improve portability for compilers supporting them
+#ifdef __sgi
+#define LONG_DOUBLE_TYPE double
+#else
+#define LONG_DOUBLE_TYPE long double
+#endif
+
typedef struct {
- /* 0x0 */ union {
- /* 0x0 */ s64 ll;
- /* 0x0 */ f64 ld;
+ /* 0x00 */ union {
+ long long ll;
+ LONG_DOUBLE_TYPE ld;
} v;
- /* 0x8 */ char* s;
- /* 0xC */ s32 n0;
- /* 0x10 */ s32 nz0;
- /* 0x14 */ s32 n1;
- /* 0x18 */ s32 nz1;
- /* 0x1C */ s32 n2;
- /* 0x20 */ s32 nz2;
- /* 0x24 */ s32 prec;
- /* 0x28 */ s32 width;
+ /* 0x08 */ char* s;
+ /* 0x0C */ int n0;
+ /* 0x10 */ int nz0;
+ /* 0x14 */ int n1;
+ /* 0x18 */ int nz1;
+ /* 0x1C */ int n2;
+ /* 0x20 */ int nz2;
+ /* 0x24 */ int prec;
+ /* 0x28 */ int width;
/* 0x2C */ size_t nchar;
- /* 0x30 */ u32 flags;
- /* 0x34 */ u8 qual;
+ /* 0x30 */ unsigned int flags;
+ /* 0x34 */ char qual;
} _Pft;
typedef void* (*PrintCallback)(void*, const char*, size_t);
-#define FLAGS_SPACE 1
-#define FLAGS_PLUS 2
-#define FLAGS_MINUS 4
-#define FLAGS_HASH 8
-#define FLAGS_ZERO 16
+#define FLAGS_SPACE (1 << 0)
+#define FLAGS_PLUS (1 << 1)
+#define FLAGS_MINUS (1 << 2)
+#define FLAGS_HASH (1 << 3)
+#define FLAGS_ZERO (1 << 4)
int _Printf(PrintCallback pfn, void* arg, const char* fmt, va_list ap);
-void _Litob(_Pft* args, u8 type);
-void _Ldtob(_Pft* args, u8 type);
+void _Litob(_Pft* args, char code);
+void _Ldtob(_Pft* args, char code);
#endif