-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* osCreateThread Stack top * Idle_InitVideo defines * Remove undef * libc stuff * headers
- Loading branch information
Showing
13 changed files
with
138 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,26 @@ | ||
#ifndef MATH_H | ||
#define MATH_H | ||
|
||
#include "PR/ultratypes.h" | ||
|
||
float fabsf(float f); | ||
#pragma intrinsic(fabsf) | ||
|
||
double fabs(double f); | ||
#pragma intrinsic(fabs) | ||
|
||
#endif | ||
#ifndef LIBC_MATH_H | ||
#define LIBC_MATH_H | ||
|
||
#define M_PI 3.14159265358979323846 | ||
#define M_PIf 3.14159265358979323846f | ||
#define M_SQRT2f 1.41421356237309504880f | ||
#define M_SQRT1_2f 0.70710678118654752440f /* 1/sqrt(2) */ | ||
|
||
#define FLT_MAX 3.40282347e+38f | ||
#define SHRT_MAX 32767.0f | ||
|
||
float fabsf(float f); | ||
#pragma intrinsic(fabsf) | ||
#ifdef __GNUC__ | ||
#define fabsf(f) __builtin_fabsf((float)(f)) | ||
#endif | ||
|
||
double fabs(double f); | ||
#pragma intrinsic(fabs) | ||
|
||
double sqrt(double d); | ||
#pragma intrinsic(sqrt) | ||
|
||
float fmodf(float dividend, float divisor); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef LIBC_STDARG_H | ||
#define LIBC_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) (((unsigned int)(((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) \ | ||
( \ | ||
(((long)list & 0x1) /* 1 byte aligned? */ \ | ||
? (list = (char *)((long)list + 7), (char *)((long)list - 6 - _VA_FP_SAVE_AREA)) \ | ||
: (((long)list & 0x2) /* 2 byte aligned? */ \ | ||
? (list = (char *)((long)list + 10), (char *)((long)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(double)) \ | ||
? __va_double_arg(list, mode) \ | ||
: __va_stack_arg(list, mode))))[-1] | ||
#define va_end(__list) | ||
|
||
#endif /* __GNUC__ */ | ||
|
||
#endif /* STDARG_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef LIBC_STDLIB_H | ||
#define LIBC_STDLIB_H | ||
|
||
#include "stddef.h" | ||
|
||
typedef struct { | ||
/* 0x0 */ int quot; | ||
/* 0x4 */ int rem; | ||
} div_t; | ||
|
||
typedef struct { | ||
/* 0x0 */ long quot; | ||
/* 0x4 */ long rem; | ||
} ldiv_t; | ||
|
||
typedef struct { | ||
/* 0x0 */ long long quot; | ||
/* 0x8 */ long long rem; | ||
} lldiv_t; | ||
|
||
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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters