Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3839144

Browse files
vkd3d: Add FNV-1a hash util.
To be used for pipeline library hashing.Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
1 parent6e697a5 commit3839144

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

‎include/private/hashmap.h‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,27 @@ static inline uint32_t hash_uint64(uint64_t n)
212212
returnhash_combine((uint32_t)n, (uint32_t)(n >>32));
213213
}
214214

215+
/* A somewhat stronger hash when we're meant to store the hash (pipeline caches, etc). Based on FNV-1a. */
216+
staticinlineuint64_thash_fnv1_init()
217+
{
218+
return0xcbf29ce484222325ull;
219+
}
220+
221+
staticinlineuint64_thash_fnv1_iterate_u8(uint64_th,uint8_tvalue)
222+
{
223+
return (h*0x100000001b3ull) ^value;
224+
}
225+
226+
staticinlineuint64_thash_fnv1_iterate_u32(uint64_th,uint32_tvalue)
227+
{
228+
return (h*0x100000001b3ull) ^value;
229+
}
230+
231+
staticinlineuint64_thash_fnv1_iterate_u64(uint64_th,uint64_tvalue)
232+
{
233+
h=hash_fnv1_iterate_u32(h,value&UINT32_MAX);
234+
h=hash_fnv1_iterate_u32(h,value >>32);
235+
returnh;
236+
}
237+
215238
#endif/* __VKD3D_HASHMAP_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp