]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
use bigger prime numbers in calculating vertex hash indices to improve
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 25 Sep 2007 18:52:03 +0000 (18:52 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 25 Sep 2007 18:52:03 +0000 (18:52 +0000)
loading performance

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7586 d7cf8633-e32d-0410-b094-e92efae38249

model_shared.c

index b52762364fad43b3d0f243c5dee9e86d7f75015f..16bc502213594afeb63e59392ffec16dfcf708b5 100644 (file)
@@ -818,7 +818,7 @@ int Mod_ShadowMesh_AddVertex(shadowmesh_t *mesh, float *vertex14f)
        int hashindex, vnum;
        shadowmeshvertexhash_t *hash;
        // this uses prime numbers intentionally
-       hashindex = (unsigned int) (vertex14f[0] * 3 + vertex14f[1] * 5 + vertex14f[2] * 7) % SHADOWMESHVERTEXHASH;
+       hashindex = (unsigned int) (vertex14f[0] * 29 + vertex14f[1] * 71 + vertex14f[2] * 113) % SHADOWMESHVERTEXHASH;
        for (hash = mesh->vertexhashtable[hashindex];hash;hash = hash->next)
        {
                vnum = (hash - mesh->vertexhashentries);