Added comment about RT hash. Fixed memory leak in NavmeshList main.
This commit is contained in:
@@ -31,9 +31,13 @@ int main(void) {
|
||||
|
||||
espr_decompress(buffer, size, decompressed, dc_size);
|
||||
|
||||
free(buffer);
|
||||
|
||||
size_t formid_count = espr_formid_count(decompressed, dc_size);
|
||||
|
||||
printf("FormID Count: %zu\n", formid_count);
|
||||
|
||||
free(decompressed);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
/* For reading structured data out of Creation Engine esp/esm files.
|
||||
* Based on information from:
|
||||
* https://en.uesp.net/wiki/Skyrim_Mod:Mod_File_Format
|
||||
* https://github.com/TES5Edit/TES5Edit
|
||||
*
|
||||
* esp/esm files generally have a tree-like structure where:
|
||||
* - top level is a a TES4 record concatenated with each of the top-level groups
|
||||
@@ -29,6 +30,13 @@ extern "C" {
|
||||
|
||||
#define RT_SIZE 128
|
||||
|
||||
/* RT hash seed was externally calculated s.t. the fourcc codes perfectly hash into
|
||||
* indices between 0 and 511. That is, there are no hashing collisions. This allows
|
||||
* for hard coded lookup tables for the fourcc codes in a relatively small space.
|
||||
*
|
||||
* A minimal perfect hash is also possible with an intermediate seed table, though
|
||||
* I'm not sure which is faster, if it's worth trying to speed this up, etc.
|
||||
*/
|
||||
#define RT_HASH_SIZE 512
|
||||
#define RT_HASH_BITS 9
|
||||
#define RT_HASH_SEED 131261257
|
||||
|
||||
Reference in New Issue
Block a user