summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2024-02-26 08:13:25 -0500
committer AJR <ajrhacker@users.noreply.github.com>2024-02-26 08:14:15 -0500
commit3e4ed5d6fe49037b39c5c13e611ba17fc3d4bc05 (patch)
tree4185f48f0eacaad71d55ad776f415652c5939cfd
parent114300659fb04ba789b18126ff2235d9dc2aa91a (diff)
coreutil.h: Eliminate core_crc32 wrapper function in favor of util::crc32_creator
-rw-r--r--src/emu/debug/debugcpu.cpp3
-rw-r--r--src/emu/rendfont.cpp3
-rw-r--r--src/emu/save.cpp9
-rw-r--r--src/lib/util/coreutil.cpp12
-rw-r--r--src/lib/util/coreutil.h7
5 files changed, 6 insertions, 28 deletions
diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp
index 5c5a186e2aa..fd0093bd283 100644
--- a/src/emu/debug/debugcpu.cpp
+++ b/src/emu/debug/debugcpu.cpp
@@ -25,7 +25,6 @@
#include "uiinput.h"
#include "corestr.h"
-#include "coreutil.h"
#include "osdepend.h"
#include "xmlfile.h"
@@ -1727,7 +1726,7 @@ u32 device_debug::compute_opcode_crc32(offs_t pc) const
buffer.data_get(pc, dasmresult & util::disasm_interface::LENGTHMASK, true, opbuf);
// return a CRC of the exact count of opcode bytes
- return core_crc32(0, &opbuf[0], opbuf.size());
+ return util::crc32_creator::simple(&opbuf[0], opbuf.size());
}
diff --git a/src/emu/rendfont.cpp b/src/emu/rendfont.cpp
index 2712a5121a7..60ea12f9400 100644
--- a/src/emu/rendfont.cpp
+++ b/src/emu/rendfont.cpp
@@ -16,7 +16,6 @@
#include "render.h"
#include "corestr.h"
-#include "coreutil.h"
#include "multibyte.h"
#include "path.h"
@@ -883,7 +882,7 @@ bool render_font::load_cached_bdf(std::string_view filename)
m_rawdata.clear();
return false;
}
- u32 const hash(core_crc32(0, reinterpret_cast<u8 const *>(&m_rawdata[0]), bytes));
+ u32 const hash(util::crc32_creator::simple(&m_rawdata[0], bytes));
// create the cached filename, changing the 'F' to a 'C' on the extension
std::string cachedname(filename, 0, filename.length() - ((4U < filename.length()) && core_filename_ends_with(filename, ".bdf") ? 4 : 0));
diff --git a/src/emu/save.cpp b/src/emu/save.cpp
index 6f49e6b2b06..8c3329e7b38 100644
--- a/src/emu/save.cpp
+++ b/src/emu/save.cpp
@@ -27,7 +27,6 @@
#include "main.h"
-#include "util/coreutil.h"
#include "util/ioprocs.h"
#include "util/ioprocsfilter.h"
@@ -495,11 +494,11 @@ inline save_error save_manager::do_read(T check_length, U read_block, V start_he
u32 save_manager::signature() const
{
// iterate over entries
- u32 crc = 0;
+ util::crc32_creator crc;
for (auto &entry : m_entry_list)
{
// add the entry name to the CRC
- crc = core_crc32(crc, (u8 *)entry->m_name.c_str(), entry->m_name.length());
+ crc.append(entry->m_name.data(), entry->m_name.length());
// add the type and size to the CRC
u32 temp[4];
@@ -507,9 +506,9 @@ u32 save_manager::signature() const
temp[1] = little_endianize_int32(entry->m_typecount);
temp[2] = little_endianize_int32(entry->m_blockcount);
temp[3] = little_endianize_int32(entry->m_stride);
- crc = core_crc32(crc, (u8 *)&temp[0], sizeof(temp));
+ crc.append(&temp[0], sizeof(temp));
}
- return crc;
+ return crc.finish();
}
diff --git a/src/lib/util/coreutil.cpp b/src/lib/util/coreutil.cpp
index 94ec6dec273..cebbceb037e 100644
--- a/src/lib/util/coreutil.cpp
+++ b/src/lib/util/coreutil.cpp
@@ -10,7 +10,6 @@
#include "coreutil.h"
#include <cassert>
-#include <zlib.h>
/***************************************************************************
@@ -55,14 +54,3 @@ uint32_t bcd_2_dec(uint32_t a)
}
return result;
}
-
-
-
-/***************************************************************************
- MISC
-***************************************************************************/
-
-uint32_t core_crc32(uint32_t crc, const uint8_t *buf, uint32_t len)
-{
- return crc32(crc, buf, len);
-}
diff --git a/src/lib/util/coreutil.h b/src/lib/util/coreutil.h
index 1f487232619..813deb27a83 100644
--- a/src/lib/util/coreutil.h
+++ b/src/lib/util/coreutil.h
@@ -72,11 +72,4 @@ inline int gregorian_days_in_month(int month, int year)
return result;
}
-
-/***************************************************************************
- MISC
-***************************************************************************/
-
-uint32_t core_crc32(uint32_t crc, const uint8_t *buf, uint32_t len);
-
#endif // MAME_UTIL_COREUTIL_H