summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arm9/lib/include/FS_overlay.h2
-rw-r--r--arm9/lib/include/OS_alloc.h5
-rw-r--r--arm9/lib/include/nitro.h2
-rw-r--r--arm9/lib/src/FX_atan.c53
-rw-r--r--arm9/lib/src/OS_alloc.c8
-rw-r--r--arm9/lib/src/OS_protectionUnit.c1
6 files changed, 37 insertions, 34 deletions
diff --git a/arm9/lib/include/FS_overlay.h b/arm9/lib/include/FS_overlay.h
index 203f555f..7853e4ae 100644
--- a/arm9/lib/include/FS_overlay.h
+++ b/arm9/lib/include/FS_overlay.h
@@ -67,7 +67,7 @@ BOOL FS_LoadOverlay(MIProcessor target, FSOverlayID id);
BOOL FS_UnloadOverlay(MIProcessor target, FSOverlayID id);
#if defined(__cplusplus)
-};
+}
#endif
#endif //NITRO_FS_OVERLAY_H_
diff --git a/arm9/lib/include/OS_alloc.h b/arm9/lib/include/OS_alloc.h
index 08fb3224..74b7b0e5 100644
--- a/arm9/lib/include/OS_alloc.h
+++ b/arm9/lib/include/OS_alloc.h
@@ -32,7 +32,10 @@ typedef struct {
HeapDesc* heapArray;
} OSHeapInfo;
-void OS_FreeToHeap(OSArenaId id, OSHeapHandle heap, void *ptr);
+Cell* DLAddFront(Cell* list, Cell* cell);
+Cell* DLExtract(Cell* list, Cell* cell);
+Cell *DLInsert(Cell *original, Cell *inserted);
void* OS_AllocFromHeap(OSArenaId id, OSHeapHandle heap, u32 size);
+void OS_FreeToHeap(OSArenaId id, OSHeapHandle heap, void *ptr);
#endif //POKEDIAMOND_OS_ALLOC_H
diff --git a/arm9/lib/include/nitro.h b/arm9/lib/include/nitro.h
index f7397fb0..deace7ef 100644
--- a/arm9/lib/include/nitro.h
+++ b/arm9/lib/include/nitro.h
@@ -12,7 +12,7 @@ extern "C" {
#include "mmap.h"
#ifdef __cplusplus
-};
+}
#endif
#endif //POKEDIAMOND_NITRO_H
diff --git a/arm9/lib/src/FX_atan.c b/arm9/lib/src/FX_atan.c
index 9a936fa0..fa2d0dbe 100644
--- a/arm9/lib/src/FX_atan.c
+++ b/arm9/lib/src/FX_atan.c
@@ -141,11 +141,11 @@ ARM_FUNC u16 FX_Atan(fx32 x){
{
x = FX_Inv(x);
fx16 y = FX_AtanTable_[x >> 5];
- return 0x4000 - y;
+ return (u16)(0x4000 - y);
}
else if (x < 0x1000)
{
- return FX_AtanTable_[x >> 5];
+ return (u16)FX_AtanTable_[x >> 5];
}
else
{
@@ -158,21 +158,20 @@ ARM_FUNC u16 FX_Atan(fx32 x){
{
x = FX_Inv(-x);
fx16 y = FX_AtanTable_[x >> 5];
- return y - 0x4000;
+ return (u16)(y - 0x4000);
}
else if (x > -0x1000)
{
- return -FX_AtanTable_[-x >> 5];
+ return (u16)(-FX_AtanTable_[-x >> 5]);
}
else
{
- return -0x2000;
+ return (u16)(-0x2000);
}
}
}
ARM_FUNC u16 FX_Atan2(fx32 x, fx32 y){
- fx32 result;
u32 positive, bias, denominator, numerator;
if (x > 0)
{
@@ -180,15 +179,15 @@ ARM_FUNC u16 FX_Atan2(fx32 x, fx32 y){
{
if (y > x)
{
- numerator = x;
- denominator = y;
+ numerator = (u32)x;
+ denominator = (u32)y;
bias = 0;
positive = TRUE;
}
else if (y < x)
{
- numerator = y;
- denominator = x;
+ numerator = (u32)y;
+ denominator = (u32)x;
bias = 0x4000;
positive = FALSE;
}
@@ -202,15 +201,15 @@ ARM_FUNC u16 FX_Atan2(fx32 x, fx32 y){
y = -y;
if (y < x)
{
- numerator = y;
- denominator = x;
+ numerator = (u32)y;
+ denominator = (u32)x;
bias = 0x4000;
positive = TRUE;
}
else if (y > x)
{
- numerator = x;
- denominator = y;
+ numerator = (u32)x;
+ denominator = (u32)y;
bias = 0x8000;
positive = FALSE;
}
@@ -232,16 +231,16 @@ ARM_FUNC u16 FX_Atan2(fx32 x, fx32 y){
y = -y;
if (y > x)
{
- numerator = x;
- denominator = y;
- bias = -0x8000;
+ numerator = (u32)x;
+ denominator = (u32)y;
+ bias = (u32)(-0x8000);
positive = TRUE;
}
else if (y < x)
{
- numerator = y;
- denominator = x;
- bias = -0x4000;
+ numerator = (u32)y;
+ denominator = (u32)x;
+ bias = (u32)(-0x4000);
positive = FALSE;
}
else
@@ -253,15 +252,15 @@ ARM_FUNC u16 FX_Atan2(fx32 x, fx32 y){
{
if (y < x)
{
- numerator = y;
- denominator = x;
- bias = -0x4000;
+ numerator = (u32)y;
+ denominator = (u32)x;
+ bias = (u32)(-0x4000);
positive = TRUE;
}
else if (y > x)
{
- numerator = x;
- denominator = y;
+ numerator = (u32)x;
+ denominator = (u32)y;
bias = 0x0;
positive = FALSE;
}
@@ -285,7 +284,7 @@ ARM_FUNC u16 FX_Atan2(fx32 x, fx32 y){
if (denominator == 0x0)
return 0x0;
if (positive)
- return bias + FX_AtanTable_[FX_Div(numerator, denominator) >> 5];
+ return (u16)(bias + FX_AtanTable_[FX_Div((fx32)numerator, (fx32)denominator) >> 5]);
else
- return bias - FX_AtanTable_[FX_Div(numerator, denominator) >> 5];
+ return (u16)(bias - FX_AtanTable_[FX_Div((fx32)numerator, (fx32)denominator) >> 5]);
}
diff --git a/arm9/lib/src/OS_alloc.c b/arm9/lib/src/OS_alloc.c
index e883656e..32f386a8 100644
--- a/arm9/lib/src/OS_alloc.c
+++ b/arm9/lib/src/OS_alloc.c
@@ -94,7 +94,7 @@ ARM_FUNC void* OS_AllocFromHeap(OSArenaId id, OSHeapHandle heap, u32 size) {
OSIntrMode enabled = OS_DisableInterrupts();
heapInfo = OSiHeapInfo[id];
if (!heapInfo) {
- OS_RestoreInterrupts(enabled);
+ (void)OS_RestoreInterrupts(enabled);
return NULL;
}
@@ -114,7 +114,7 @@ ARM_FUNC void* OS_AllocFromHeap(OSArenaId id, OSHeapHandle heap, u32 size) {
}
if (cell == NULL) {
- OS_RestoreInterrupts(enabled);
+ (void)OS_RestoreInterrupts(enabled);
return NULL;
}
@@ -143,7 +143,7 @@ ARM_FUNC void* OS_AllocFromHeap(OSArenaId id, OSHeapHandle heap, u32 size) {
hd->allocated = DLAddFront(hd->allocated, cell);
- OS_RestoreInterrupts(enabled);
+ (void)OS_RestoreInterrupts(enabled);
return (void *)((char *)cell + HEADERSIZE);
}
@@ -165,5 +165,5 @@ ARM_FUNC void OS_FreeToHeap(OSArenaId id, OSHeapHandle heap, void* ptr) {
hd->allocated = DLExtract(hd->allocated, cell);
hd->free = DLInsert(hd->free, cell);
- OS_RestoreInterrupts(enabled);
+ (void)OS_RestoreInterrupts(enabled);
}
diff --git a/arm9/lib/src/OS_protectionUnit.c b/arm9/lib/src/OS_protectionUnit.c
index be57dcd6..6d3b7952 100644
--- a/arm9/lib/src/OS_protectionUnit.c
+++ b/arm9/lib/src/OS_protectionUnit.c
@@ -3,6 +3,7 @@
//
#include "function_target.h"
+#include "OS_protectionUnit.h"
ARM_FUNC asm void OS_EnableProtectionUnit(void)
{