diff options
author | marha <marha@users.sourceforge.net> | 2015-04-30 23:24:30 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2015-04-30 23:24:30 +0200 |
commit | a71d524ecad48837e0124a03124bc05f59a48be7 (patch) | |
tree | 87c5ba1711e03cb9692e23cc685b938571b52d76 /mesalib/src/glsl/glsl_types.cpp | |
parent | 2a00e489122f6c4b525090dbdba2855a2ea2d519 (diff) | |
download | vcxsrv-a71d524ecad48837e0124a03124bc05f59a48be7.tar.gz vcxsrv-a71d524ecad48837e0124a03124bc05f59a48be7.tar.bz2 vcxsrv-a71d524ecad48837e0124a03124bc05f59a48be7.zip |
fontconfig pixman libX11 mesa git update 30 Apr 2015
libX11 commit d3415d1f052530760b4617db45affcb984cfe35c
pixman commit e0c0153d8e5d42c08c2b9bd2cf2123bff2c48d75
fontconfig commit 4a6f5efd5f6a468e1872d58e589bcf30ba88e2fd
mesa commit 1ac7db07b363207e8ded9259f84bbcaa084b8667
Diffstat (limited to 'mesalib/src/glsl/glsl_types.cpp')
-rw-r--r-- | mesalib/src/glsl/glsl_types.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp index 4aa36a794..9c9b7efcb 100644 --- a/mesalib/src/glsl/glsl_types.cpp +++ b/mesalib/src/glsl/glsl_types.cpp @@ -738,24 +738,27 @@ glsl_type::record_key_compare(const void *a, const void *b) } +/** + * Generate an integer hash value for a glsl_type structure type. + */ unsigned glsl_type::record_key_hash(const void *a) { const glsl_type *const key = (glsl_type *) a; - char hash_key[128]; - unsigned size = 0; - - size = snprintf(hash_key, sizeof(hash_key), "%08x", key->length); + uintptr_t hash = key->length; + unsigned retval; for (unsigned i = 0; i < key->length; i++) { - if (size >= sizeof(hash_key)) - break; - - size += snprintf(& hash_key[size], sizeof(hash_key) - size, - "%p", (void *) key->fields.structure[i].type); + /* casting pointer to uintptr_t */ + hash = (hash * 13 ) + (uintptr_t) key->fields.structure[i].type; } - return hash_table_string_hash(& hash_key); + if (sizeof(hash) == 8) + retval = (hash & 0xffffffff) ^ ((uint64_t) hash >> 32); + else + retval = hash; + + return retval; } |