Swap NELEMS for ARRAY_COUNT

This commit is contained in:
citrusbolt
2024-03-10 11:36:36 -06:00
parent 3128bace4c
commit 390972cec3
3 changed files with 8 additions and 8 deletions

View File

@@ -31,7 +31,7 @@
#include "constants/vars.h"
#include "constants/flags.h"
#define NELEMS(arr) (sizeof(arr)/sizeof(*(arr)))
#define ARRAY_COUNT(array) (size_t)(sizeof(array) / sizeof((array)[0]))
#define MOVE_NAME_LENGTH 12
#define POKEMON_NAME_LENGTH 10

View File

@@ -102,16 +102,16 @@ static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon)
union PokemonSubstruct *substruct3 = GetSubstruct(boxMon, boxMon->personality, 3);
s32 i;
for (i = 0; i < (s32)NELEMS(substruct0->raw); i++)
for (i = 0; i < (s32)ARRAY_COUNT(substruct0->raw); i++)
checksum += substruct0->raw[i];
for (i = 0; i < (s32)NELEMS(substruct1->raw); i++)
for (i = 0; i < (s32)ARRAY_COUNT(substruct1->raw); i++)
checksum += substruct1->raw[i];
for (i = 0; i < (s32)NELEMS(substruct2->raw); i++)
for (i = 0; i < (s32)ARRAY_COUNT(substruct2->raw); i++)
checksum += substruct2->raw[i];
for (i = 0; i < (s32)NELEMS(substruct3->raw); i++)
for (i = 0; i < (s32)ARRAY_COUNT(substruct3->raw); i++)
checksum += substruct3->raw[i];
return checksum;
@@ -121,7 +121,7 @@ static inline void EncryptBoxMon(struct BoxPokemon *boxMon)
{
u32 i;
for (i = 0; i < NELEMS(boxMon->secure.raw); i++)
for (i = 0; i < ARRAY_COUNT(boxMon->secure.raw); i++)
{
boxMon->secure.raw[i] ^= boxMon->personality;
boxMon->secure.raw[i] ^= boxMon->otId;
@@ -132,7 +132,7 @@ static inline void DecryptBoxMon(struct BoxPokemon *boxMon)
{
u32 i;
for (i = 0; i < NELEMS(boxMon->secure.raw); i++)
for (i = 0; i < ARRAY_COUNT(boxMon->secure.raw); i++)
{
boxMon->secure.raw[i] ^= boxMon->otId;
boxMon->secure.raw[i] ^= boxMon->personality;

View File

@@ -72,7 +72,7 @@ s32 validate_rom_header_internal(void)
languageCode = *(const u8 *)0x080000AF;
version = *(const u8 *)0x080000BC;
sp4 = -1;
for (i = 0; i < NELEMS(gUnknown_0201F298); i++)
for (i = 0; i < ARRAY_COUNT(gUnknown_0201F298); i++)
{
if (languageCode != gUnknown_0201F298[i][0])
{