-/* $Id: hash.c,v 1.3 1999/10/13 18:42:50 brianp Exp $ */
+/* $Id: hash.c,v 1.5 2000/01/04 08:14:36 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.1
+ * Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
*/
-
#ifdef PC_HEADER
#include "all.h"
#else
-#ifndef XFree86Server
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#else
-#include "GL/xf86glx.h"
-#endif
+#include "glheader.h"
#include "hash.h"
-#include "macros.h"
+#include "mem.h"
#endif
/*
- * Generic hash table. Only dependency is the GLuint datatype.
+ * Generic hash table.
*
* This is used to implement display list and texture object lookup.
* NOTE: key=0 is illegal.
* Find a block of 'numKeys' adjacent unused hash keys.
* Input: table - the hash table
* numKeys - number of keys needed
- * Return: startint key of free block or 0 if failure
+ * Return: starting key of free block or 0 if failure
*/
GLuint HashFindFreeKeyBlock(const struct HashTable *table, GLuint numKeys)
{
else {
/* the slow solution */
GLuint freeCount = 0;
- GLuint freeStart = 0;
+ GLuint freeStart = 1;
GLuint key;
- for (key=0; key!=maxKey; key++) {
+ for (key=1; key!=maxKey; key++) {
if (HashLookup(table, key)) {
/* darn, this key is already in use */
freeCount = 0;