mirror of
https://github.com/MonsterDruide1/OdysseyDecomp.git
synced 2024-11-27 07:10:33 +00:00
Change compiler to emit some inlining, and start on some string utility functions
This commit is contained in:
parent
7d195d3571
commit
c287cccfc7
@ -16,7 +16,7 @@ includePath = root / "Include"
|
||||
libraryPath = root / "Libraries/NX-NXFP2-a64/Release"
|
||||
releasePath = root / "Common/Configs/Targets/NX-NXFP2-a64/Include"
|
||||
|
||||
compilerCommand = f"{compilerPath} -x c++ -std=gnu++14 -fno-common -fno-short-enums -ffunction-sections -fdata-sections -fPIC -Wall -O3 -fomit-frame-pointer -mcpu=cortex-a57+fp+simd+crypto+crc -g -DNN_NINTENDO_SDK -DNN_SDK_BUILD_RELEASE -I include -I {includePath} -I {releasePath} -c "
|
||||
compilerCommand = f"{compilerPath} -x c++ -std=gnu++14 -fno-common -fno-inline -fno-short-enums -ffunction-sections -fdata-sections -fPIC -Wall -O3 -fomit-frame-pointer -mcpu=cortex-a57+fp+simd+crypto+crc -g -DNN_NINTENDO_SDK -DNN_SDK_BUILD_RELEASE -I include -I {includePath} -I {releasePath} -c "
|
||||
|
||||
source_folder = pathlib.Path('source/')
|
||||
cpp_files = list(source_folder.rglob('*.cpp'))
|
||||
|
11
include/al/util/StringUtil.h
Normal file
11
include/al/util/StringUtil.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
namespace al
|
||||
{
|
||||
bool isEqualString(const char16_t *, const char16_t *);
|
||||
bool isEqualSubString(const char *, const char *);
|
||||
// isEqualSubString(const sead::SafeStringBase<char> &, const sead::SafeStringBase<char> &)
|
||||
bool isStartWithString(const char *, const char *);
|
||||
bool isEndWithString(const char *, const char *);
|
||||
bool isEqualString(const char *, const char *);
|
||||
};
|
99
source/al/util/StringUtil.cpp
Normal file
99
source/al/util/StringUtil.cpp
Normal file
@ -0,0 +1,99 @@
|
||||
#include "al/util/StringUtil.h"
|
||||
#include <cstring>
|
||||
|
||||
namespace al
|
||||
{
|
||||
bool isEqualString(const char16_t *pString_0, const char16_t *pString_1)
|
||||
{
|
||||
unsigned short val;
|
||||
|
||||
while (1)
|
||||
{
|
||||
val = *pString_0;
|
||||
if (val != *pString_1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
++pString_1;
|
||||
++pString_0;
|
||||
|
||||
if (!val)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isEqualSubString(const char *pString_0, const char *pString_1)
|
||||
{
|
||||
return strstr(pString_0, pString_1);
|
||||
}
|
||||
|
||||
bool isStartWithString(const char *pString_0, const char *pString_1)
|
||||
{
|
||||
char val = *pString_1;
|
||||
|
||||
if (!*pString_1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* nextVal = pString_1 + 1;
|
||||
|
||||
while(*pString_0 && *pString_0 == val)
|
||||
{
|
||||
char e = *nextVal++;
|
||||
val = e;
|
||||
++pString_0;
|
||||
|
||||
if (!e)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isEndWithString(const char *pString_0, const char *pString_1)
|
||||
{
|
||||
int pString0_Len = strlen(pString_0);
|
||||
int pString1_Len = strlen(pString_1);
|
||||
|
||||
if (pString0_Len < pString1_Len)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return isEqualString(&pString_0[pString0_Len - pString1_Len], pString_1);
|
||||
}
|
||||
}
|
||||
|
||||
bool isEqualString(const char *pString_0, const char *pString_1)
|
||||
{
|
||||
char val;
|
||||
|
||||
while (1)
|
||||
{
|
||||
val = *pString_0;
|
||||
if (val != *pString_1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
++pString_1;
|
||||
++pString_0;
|
||||
|
||||
if (!val)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
@ -1,6 +0,0 @@
|
||||
#include <nn/os.h>
|
||||
|
||||
int doStuff()
|
||||
{
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user