summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-04-10 17:43:57 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-04-10 17:43:57 +0000
commit4901bf50fb6a71872b0cd726534a95da736ca5c0 (patch)
treea7516f45e0850e17b14cab3fc57ab7f6a15d759e
parent679515b83ad3aff93c0e759783e5a8e567d5dc15 (diff)
set table size to 1023 and use new HASH_FUNC() macro
-rw-r--r--src/mesa/main/hash.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index 230f86f30b..6ab36957dc 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -12,9 +12,9 @@
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 6.2.2
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -42,7 +42,9 @@
#include "context.h"
-#define TABLE_SIZE 1024 /**< Size of lookup table/array */
+#define TABLE_SIZE 1023 /**< Size of lookup table/array */
+
+#define HASH_FUNC(K) ((K) % TABLE_SIZE)
/**
* An entry in the hash table.
@@ -127,7 +129,7 @@ void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key)
assert(table);
assert(key);
- pos = key & (TABLE_SIZE-1);
+ pos = HASH_FUNC(key);
entry = table->Table[pos];
while (entry) {
if (entry->Key == key) {
@@ -166,7 +168,7 @@ void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data)
if (key > table->MaxKey)
table->MaxKey = key;
- pos = key & (TABLE_SIZE-1);
+ pos = HASH_FUNC(key);
entry = table->Table[pos];
while (entry) {
if (entry->Key == key) {
@@ -209,7 +211,7 @@ void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key)
_glthread_LOCK_MUTEX(table->Mutex);
- pos = key & (TABLE_SIZE-1);
+ pos = HASH_FUNC(key);
prev = NULL;
entry = table->Table[pos];
while (entry) {