Skip to content

Commit 6c68cb3

Browse files
committed
address code review
1 parent 1ab1c3d commit 6c68cb3

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

include/ctr/macros.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ typedef int16_t s16;
1717
typedef uint8_t u8;
1818
typedef int8_t s8;
1919

20+
#define U32_MAX UINT32_MAX
21+
#define S32_MAX INT32_MAX
22+
#define U16_MAX UINT16_MAX
23+
#define S16_MAX INT16_MAX
24+
#define U8_MAX UINT8_MAX
25+
#define S8_MAX INT8_MAX
26+
27+
#define U32_MIN UINT32_MIN
28+
#define S32_MIN INT32_MIN
29+
#define U16_MIN UINT16_MIN
30+
#define S16_MIN INT16_MIN
31+
#define U8_MIN UINT8_MIN
32+
#define S8_MIN INT8_MIN
33+
2034
#define AugReview 805
2135
#define SepReview 903
2236
#define UsaRetail 926

rewrite/src/exe/coll.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ static void _COLL_TestLeaf_Quadblock(const Quadblock* quadblock, CollDCache* cac
416416
#endif
417417
COLL_TestTriangle(cache, &cache->quadblockCollVertices[5], &cache->quadblockCollVertices[6], &cache->quadblockCollVertices[2]);
418418
#ifndef FIX_CTR_BUG
419-
cache->currTriangleIndex = 6;
419+
cache->currTriangleIndex = 6; // not a bug, but unnecessary assignment...
420420
#endif
421421
if (cache->quadblockThirdIndex != cache->quadblockFourthIndex)
422422
{
@@ -437,7 +437,7 @@ static void _COLL_TestLeaf_Quadblock(const Quadblock* quadblock, CollDCache* cac
437437
cache->currTriangleIndex = 0;
438438
COLL_TestTriangle(cache, &cache->quadblockCollVertices[0], &cache->quadblockCollVertices[1], &cache->quadblockCollVertices[2]);
439439
#ifndef FIX_CTR_BUG
440-
cache->currTriangleIndex = 1;
440+
cache->currTriangleIndex = 1; // not a bug, but unnecessary assignment...
441441
#endif
442442
if (cache->quadblockThirdIndex != cache->quadblockFourthIndex)
443443
{

rewrite/src/tests/test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ u32 PatchFunction_Beg(u32* address, const char* funcName)
5555
s_nameTestedFunc = funcName;
5656
__asm__ volatile("move $k1, %0" : : "r"(addr));
5757

58-
u32 index = UINT32_MAX;
58+
u32 index = U32_MAX;
5959
const u32 funcCount = ARR_LEN(s_functions);
6060
for (u32 i = 0; i < funcCount; i++)
6161
{
@@ -73,7 +73,7 @@ u32 PatchFunction_Beg(u32* address, const char* funcName)
7373

7474
void PatchFunction_End(u32 index)
7575
{
76-
if (index == UINT32_MAX) { return; }
76+
if (index == U32_MAX) { return; }
7777
*(s_functions[index].address) = s_functions[index].firstNewInst;
7878
*(s_functions[index].address + 1) = s_functions[index].secondNewInst;
7979
FlushCache();

0 commit comments

Comments
 (0)