Use size_t in some DSP code code

This commit is contained in:
Pokechu22 2020-04-08 18:19:37 -07:00
parent b996dcf871
commit 59dc7cfe7d
7 changed files with 10 additions and 10 deletions

View File

@ -95,7 +95,7 @@ u32 HashAdler32(const u8* data, size_t len)
// Stupid hash - but can't go back now :)
// Don't use for new things. At least it's reasonably fast.
u32 HashEctor(const u8* ptr, int length)
u32 HashEctor(const u8* ptr, size_t length)
{
u32 crc = 0;

View File

@ -12,7 +12,7 @@ namespace Common
{
u32 HashFletcher(const u8* data_u8, size_t length); // FAST. Length & 1 == 0.
u32 HashAdler32(const u8* data, size_t len); // Fairly accurate, slightly slower
u32 HashEctor(const u8* ptr, int length); // JUNK. DO NOT USE FOR NEW THINGS
u32 HashEctor(const u8* ptr, size_t length); // JUNK. DO NOT USE FOR NEW THINGS
u64 GetHash64(const u8* src, u32 len, u32 samples);
void SetHash64Function();
} // namespace Common

View File

@ -68,11 +68,11 @@ bool Compare(const std::vector<u16>& code1, const std::vector<u16>& code2)
if (code1.size() != code2.size())
printf("Size difference! 1=%zu 2=%zu\n", code1.size(), code2.size());
u32 count_equal = 0;
const int min_size = std::min<int>((int)code1.size(), (int)code2.size());
const u16 min_size = static_cast<u16>(std::min(code1.size(), code2.size()));
AssemblerSettings settings;
DSPDisassembler disassembler(settings);
for (int i = 0; i < min_size; i++)
for (u16 i = 0; i < min_size; i++)
{
if (code1[i] == code2[i])
{
@ -93,7 +93,7 @@ bool Compare(const std::vector<u16>& code1, const std::vector<u16>& code2)
{
printf("Extra code words:\n");
const std::vector<u16>& longest = code1.size() > code2.size() ? code1 : code2;
for (int i = min_size; i < (int)longest.size(); i++)
for (u16 i = min_size; i < longest.size(); i++)
{
u16 pc = i;
std::string line;
@ -146,7 +146,7 @@ bool SaveBinary(const std::vector<u16>& code, const std::string& filename)
return File::WriteStringToFile(filename, buffer);
}
bool DumpDSPCode(const u8* code_be, int size_in_bytes, u32 crc)
bool DumpDSPCode(const u8* code_be, size_t size_in_bytes, u32 crc)
{
const std::string root_name =
File::GetUserPath(D_DUMPDSP_IDX) + fmt::format("DSP_UC_{:08X}", crc);

View File

@ -24,5 +24,5 @@ std::vector<u16> BinaryStringBEToCode(const std::string& str);
std::optional<std::vector<u16>> LoadBinary(const std::string& filename);
bool SaveBinary(const std::vector<u16>& code, const std::string& filename);
bool DumpDSPCode(const u8* code_be, int size_in_bytes, u32 crc);
bool DumpDSPCode(const u8* code_be, size_t size_in_bytes, u32 crc);
} // namespace DSP

View File

@ -21,6 +21,6 @@ void OSD_AddMessage(std::string str, u32 ms);
bool OnThread();
bool IsWiiHost();
void InterruptRequest();
void CodeLoaded(const u8* ptr, int size);
void CodeLoaded(const u8* ptr, size_t size);
void UpdateDebugger();
} // namespace DSP::Host

View File

@ -57,7 +57,7 @@ void InterruptRequest()
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP);
}
void CodeLoaded(const u8* ptr, int size)
void CodeLoaded(const u8* ptr, size_t size)
{
if (SConfig::GetInstance().m_DumpUCode)
{

View File

@ -33,7 +33,7 @@ bool DSP::Host::IsWiiHost()
{
return false;
}
void DSP::Host::CodeLoaded(const u8* ptr, int size)
void DSP::Host::CodeLoaded(const u8* ptr, size_t size)
{
}
void DSP::Host::InterruptRequest()