A bit more GetPointer cleanup.

Probably not worth it for performance reasons, but some semantic cleanup
is good, especially the accidental GetPointer -> writable casts without
using GetPointerWrite.

Using Unchecked on already checked pointers, or when we'd crash anyway
if it returned nullptr, is good for clarity.
This commit is contained in:
Henrik Rydgård committed 2023-01-10 12:13:47 +01:00
1 parent 70e149e3ca
commit e1a48d74c4
11 files changed
+42 -26

No files matched your search

+6 -1
View File
@@ -65,7 +65,12 @@ static uint64_t HashJitBlock(const JitBlock &b) {
PROFILE_THIS_SCOPE("jithash");
if (JIT_USE_COMPILEDHASH) {
// Includes the emuhack (or emuhacks) in memory.
return XXH3_64bits(Memory::GetPointerRange(b.originalAddress, b.originalSize * 4), b.originalSize * 4);
if (Memory::IsValidRange(b.originalAddress, b.originalSize * 4)) {
return XXH3_64bits(Memory::GetPointerUnchecked(b.originalAddress), b.originalSize * 4);
} else {
// Hm, this would be bad.
return 0;
}
}
return 0;
}