match JGadget hashcode

This commit is contained in:
SwareJonge 2023-08-27 18:14:57 +02:00
parent 5123430b90
commit 9c1be6c0c1
6 changed files with 60 additions and 1 deletions

View File

@ -115,6 +115,9 @@ libs/JSystem/JUtility/JUTXfb.cpp:
libs/JSystem/JUtility/JUTFontData_Ascfont_fix12.s:
.rodata: [0x80362160, 0x803662c0]
libs/JSystem/JGadget/hashcode.cpp:
.text: [0x8007853c, 0x800785a4]
libs/JSystem/JSupport/JSUInputStream.cpp:
.text: [0x80078780, 0x80078b2c]
.rodata: [0x80366778, 0x80366798]

View File

@ -181,6 +181,9 @@ libs/JSystem/JSupport/JSUFileStream.cpp:
.text: [0x80017e94, 0x800180b4]
.data: [0x80348018, 0x80348040]
libs/JSystem/JGadget/hashcode.cpp:
.text: [0x800180b4, 0x8001811c]
libs/JSystem/JUtility/JUTAssert.cpp:
.text: [0x800182a0, 0x800185a0]
.bss: [0x8036df80, 0x8036e0c0]

View File

@ -472,13 +472,18 @@ global:
0x80017e84: getLength__20JSUMemoryInputStreamCFv
0x80017e8c: getPosition__20JSUMemoryInputStreamCFv
0x80347ff0: __vt__20JSUMemoryInputStream
# JSUFileInputStream.cpp
# JSUFileStream.cpp
0x80017e94: __ct__18JSUFileInputStreamFP7JKRFile
0x80017ed8: readData__18JSUFileInputStreamFPvl
0x80017fa4: seekPos__18JSUFileInputStreamFl17JSUStreamSeekFrom
0x8001807c: getLength__18JSUFileInputStreamCFv
0x800180ac: getPosition__18JSUFileInputStreamCFv
0x80348018: __vt__18JSUFileInputStream
# JGadget
# hashcode.cpp
0x800180b4: getHashCode__7JGadgetFPCc
# JUtility
# JUTAssert.cpp
0x800182a0: create__12JUTAssertionFv

View File

@ -0,0 +1,37 @@
#ifndef JSYSTEM_HASHCODE_H
#define JSYSTEM_HASHCODE_H
#include "types.h"
namespace JGadget
{
u32 getHashCode(const char *, u32);
u32 getHashCode(const char *);
namespace
{
template <typename T>
struct TPRIsEnd_value_
{
TPRIsEnd_value_()
{
val = 0;
}
T val;
};
template <typename T, typename U>
static u32 getHashCode_(const char *pName, U end)
{
u32 hash = 0;
for (; *pName != end.val; pName++)
{
hash = *pName + hash * 31;
}
return hash;
}
}
}
#endif

View File

@ -0,0 +1,11 @@
#include "JSystem/JGadget/hashcode.h"
u32 JGadget::getHashCode(const char *, u32)
{
// UNUSED
}
u32 JGadget::getHashCode(const char *data)
{
return getHashCode_<char>(data, TPRIsEnd_value_<char>());
}