replace xxhash with d implementation

This commit is contained in:
matthew 2025-07-12 09:03:41 +10:00
parent f604b9a5ca
commit 486c17465b
4 changed files with 3341 additions and 9 deletions

View File

@ -7,7 +7,7 @@
"targetType": "executable",
"targetName": "Gears",
"targetPath": "build",
"sourceFiles-linux": ["build/libvma.a", "build/libxxhash.a", "build/libstb_image.a"],
"sourceFiles-linux": ["build/libvma.a", "build/libstb_image.a"],
"sourceFiles-windows": [],
"importPaths": ["src/gears", "src/shared", "src/generated"],
"sourcePaths": ["src/gears", "src/shared", "src/generated"],
@ -15,6 +15,7 @@
"libs-windows": [],
"preGenerateCommands-linux": ["./build-vma.sh", "build/Codegen", "dub main:packer", "build/Packer"],
"preGenerateCommands-windows": [],
"dflags-dmd": ["-P=-DSTBI_NO_SIMD"]
},
{
"name": "packer",
@ -23,10 +24,10 @@
"targetName": "Packer",
"importPaths": ["src/packer", "src/shared", "src/generated"],
"sourcePaths": ["src/packer", "src/shared", "src/generated"],
"sourceFiles-linux": ["build/libxxhash.a", "build/libstb_image.a", "build/libm3d.a"],
"sourceFiles-linux": ["build/libstb_image.a", "build/libm3d.a"],
"preGenerateCommands-linux": ["./build-vma.sh"],
"preGenerateCommands-windows": [],
"dflags-dmd": ["-P=-DXXH_VECTOR=0", "-P=-DSTBI_NO_SIMD", "-P=-DXXH_NO_PREFTECH"],
"dflags-dmd": ["-P=-DSTBI_NO_SIMD"],
},
{
"name": "codegen",
@ -35,11 +36,11 @@
"targetName": "Codegen",
"importPaths": ["src/codegen", "src/shared"],
"sourcePaths": ["src/codegen", "src/shared"],
"sourceFiles-linux": ["build/libxxhash.a", "build/libstb_image.a"],
"sourceFiles-linux": ["build/libstb_image.a"],
"preGenerateCommands-linux": ["./build-vma.sh"],
"preGenerateCommands-windows": [],
"versions": ["codegen"],
"dflags-dmd": ["-P=-DXXH_VECTOR=0", "-P=-DSTBI_NO_SIMD", "-P=-DXXH_NO_PREFTECH"],
"dflags-dmd": ["-P=-DSTBI_NO_SIMD"],
}
]
}

3332
external/xxhash/xxhash.d vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -22,8 +22,6 @@
#include "../../external/vma/vk_mem_alloc.h"
#include "../../external/xxhash/xxhash.c"
#define STB_IMAGE_IMPLEMENTATION
#include "../../external/stb/stb_image.h"

View File

@ -1,4 +1,5 @@
import aliases;
import xxhash3;
import includes;
import std.stdio;
import core.stdc.string : memset;
@ -304,11 +305,11 @@ const u64 HASH_SEED = 5995;
pragma(inline): u64
Hash(T)(T* value)
{
return XXH3_64bits_withSeed(value, T.sizeof / u8.sizeof, HASH_SEED);
return xxh3_64bits_withSeed(value, T.sizeof / u8.sizeof, HASH_SEED);
}
pragma(inline): u64
Hash(string str)
{
return XXH3_64bits_withSeed(str.ptr, str.length, HASH_SEED);
return xxh3_64bits_withSeed(str.ptr, str.length, HASH_SEED);
}