mirror of
https://github.com/open-goal/jak-project
synced 2026-07-11 23:30:16 -04:00
[decompiler] performance improvements in extraction (#1309)
* small speedups to extractor * faster extraction
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "common/util/print_float.h"
|
||||
#include "common/util/CopyOnWrite.h"
|
||||
#include "common/util/SmallVector.h"
|
||||
#include "common/util/crc32.h"
|
||||
|
||||
TEST(CommonUtil, CpuInfo) {
|
||||
setup_cpu_info();
|
||||
@@ -396,5 +397,26 @@ TEST(Assert, Death) {
|
||||
EXPECT_DEATH(private_assert_failed("foo", "bar", 12, "aaa"), "");
|
||||
}
|
||||
|
||||
uint32_t crc_reference(const u8* data, size_t size) {
|
||||
u32 crc = 0xffffffff;
|
||||
while (size--) {
|
||||
crc ^= *data++;
|
||||
for (int k = 0; k < 8; k++)
|
||||
crc = crc & 1 ? (crc >> 1) ^ 0x82f63b78 : crc >> 1;
|
||||
}
|
||||
return ~crc;
|
||||
}
|
||||
|
||||
TEST(CRC32, Reference) {
|
||||
for (u32 so = 0; so < 7; so++) {
|
||||
std::vector<u8> test_data;
|
||||
for (u32 i = 0; i < 1024 + so; i++) {
|
||||
test_data.push_back(i & 0xff);
|
||||
}
|
||||
EXPECT_EQ(crc_reference(test_data.data(), test_data.size()),
|
||||
crc32(test_data.data(), test_data.size()));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace cu
|
||||
Reference in New Issue
Block a user