Commit 6b752a57 authored by Richard Gobeille's avatar Richard Gobeille

engine: switch a few things over to xxh3

parent 3ef484c4
......@@ -14,7 +14,7 @@
#include "cache1d.h"
#include "palette.h"
#include "a.h"
#include "xxhash.h"
#include "xxh3.h"
#include "vfs.h"
......@@ -708,7 +708,7 @@ void videoSetPalette(char dabrightness, uint8_t dapalid, uint8_t flags)
paletteSetFade(palfadedelta>>2);
static uint32_t lastpalettesum=0;
uint32_t newpalettesum = XXH32((uint8_t *) curpalettefaded, sizeof(curpalettefaded), sizeof(curpalettefaded));
uint32_t newpalettesum = XXH3_64bits((uint8_t *) curpalettefaded, sizeof(curpalettefaded));
palsumdidchange = (newpalettesum != lastpalettesum);
......@@ -793,7 +793,7 @@ void videoFadePalette(uint8_t r, uint8_t g, uint8_t b, uint8_t offset)
paletteSetFade(offset);
static uint32_t lastpalettesum=0;
uint32_t newpalettesum = XXH32((uint8_t *) curpalettefaded, sizeof(curpalettefaded), sizeof(curpalettefaded));
uint32_t newpalettesum = XXH3_64bits((uint8_t *) curpalettefaded, sizeof(curpalettefaded));
if (newpalettesum != lastpalettesum || newpalettesum != g_lastpalettesum)
{
......
......@@ -3907,7 +3907,7 @@ void polymer_updatesprite(int32_t snum)
if (tspr->cstat & 48 && searchit != 2)
{
uint32_t const changed = XXH32((uint8_t *) tspr, offsetof(spritetype, owner), 0xDEADBEEF);
uint32_t const changed = XXH3_64bits((uint8_t *) tspr, offsetof(spritetype, owner));
if (changed == s->hash)
return;
......
......@@ -43,7 +43,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "keyboard.h"
#include "scriptfile.h"
#include "xxhash.h"
#include "sounds_mapster32.h"
#include "fx_man.h"
......
......@@ -14,7 +14,7 @@
#include "m32def.h"
#include "lz4.h"
#include "xxhash.h"
#include "xxh3.h"
// XXX: This breaks editors for games other than Duke. The OSD needs a way to specify colors in abstract instead of concatenating palswap escape sequences.
#include "common_game.h"
......@@ -451,24 +451,14 @@ void create_map_snapshot(void)
if (numsectors)
{
#if !defined UINTPTR_MAX
# error Need UINTPTR_MAX define to select between 32- and 64-bit functions
#endif
#if UINTPTR_MAX == 0xffffffff
/* 32-bit */
#define XXH__ XXH32
#else
/* 64-bit */
#define XXH__ XXH64
#endif
uintptr_t temphash = XXH__((uint8_t *)sector, numsectors*sizeof(sectortype), numsectors*sizeof(sectortype));
uintptr_t temphash = XXH3_64bits((uint8_t *)sector, numsectors*sizeof(sectortype));
if (!try_match_with_prev(0, numsectors, temphash))
create_compressed_block(0, sector, numsectors*sizeof(sectortype), temphash);
if (numwalls)
{
temphash = XXH__((uint8_t *)wall, numwalls*sizeof(walltype), numwalls*sizeof(walltype));
temphash = XXH3_64bits((uint8_t *)wall, numwalls*sizeof(walltype));
if (!try_match_with_prev(1, numwalls, temphash))
create_compressed_block(1, wall, numwalls*sizeof(walltype), temphash);
......@@ -476,7 +466,7 @@ void create_map_snapshot(void)
if (Numsprites)
{
temphash = XXH__((uint8_t *)sprite, MAXSPRITES*sizeof(spritetype), MAXSPRITES*sizeof(spritetype));
temphash = XXH3_64bits((uint8_t *)sprite, MAXSPRITES*sizeof(spritetype));
if (!try_match_with_prev(2, Numsprites, temphash))
{
......@@ -495,7 +485,6 @@ void create_map_snapshot(void)
Xfree(uspri);
}
}
#undef XXH__
}
CheckMapCorruption(5, 0);
......
......@@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "input.h"
#include "osdcmds.h"
#include "savegame.h"
#include "xxhash.h"
#include "xxh3.h"
#include "music.h"
#include "sbar.h"
......@@ -3827,7 +3827,7 @@ static void Menu_EntryStringActivate(/*MenuEntry_t *entry*/)
{
savebrief_t & sv = g_menusaves[M_SAVE.currentEntry-1].brief;
if (!save_xxh)
save_xxh = XXH32((uint8_t *)sv.name, MAXSAVEGAMENAME, 0xDEADBEEF);
save_xxh = XXH3_64bits_withSeed((uint8_t *)sv.name, MAXSAVEGAMENAME, 0xDEADBEEF);
if (sv.isValid())
Menu_Change(MENU_SAVEVERIFY);
}
......@@ -3859,7 +3859,7 @@ static int32_t Menu_EntryStringSubmit(/*MenuEntry_t *entry, */char *input)
#else
if (input[0] == 0 || (sv.name[MAXSAVEGAMENAME] == 127 &&
strncmp(sv.name, input, MAXSAVEGAMENAME) == 0 &&
save_xxh == XXH32((uint8_t *)sv.name, MAXSAVEGAMENAME, 0xDEADBEEF)))
save_xxh == XXH3_64bits_withSeed((uint8_t *)sv.name, MAXSAVEGAMENAME, 0xDEADBEEF)))
#endif
{
strncpy(sv.name, g_mapInfo[ud.volume_number * MAXLEVELS + ud.level_number].name, MAXSAVEGAMENAME);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment