• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2 * Declarations, global to other of the GIF-HASH.C module.		      *
3 *									      *
4 *					Written by Gershon Elber,  Jun 1989   *
5 *******************************************************************************
6 * History:								      *
7 * 14 Jun 89 - Version 1.0 by Gershon Elber.				      *
8 ******************************************************************************/
9 
10 #ifndef _GIF_HASH_H_
11 #define _GIF_HASH_H_
12 
13 #ifdef HAVE_CONFIG_H
14 #include <config.h>
15 #endif
16 
17 /* Find a thirty-two bit int type */
18 #ifdef HAVE_STDINT_H
19 #include <stdint.h>
20 #endif
21 #ifdef HAVE_INTTYPES_H
22 #include <inttypes.h>
23 #endif
24 #ifdef HAVE_SYS_TYPES_H
25 #include <sys/types.h>
26 #endif
27 #ifdef HAVE_UNISTD_H
28 #include <unistd.h>
29 #endif
30 
31 #ifdef HAVE_BASETSD_H
32 #include <basetsd.h>
33 #endif
34 
35 #define HT_SIZE			8192	   /* 12bits = 4096 or twice as big! */
36 #define HT_KEY_MASK		0x1FFF			      /* 13bits keys */
37 #define HT_KEY_NUM_BITS		13			      /* 13bits keys */
38 #define HT_MAX_KEY		8191	/* 13bits - 1, maximal code possible */
39 #define HT_MAX_CODE		4095	/* Biggest code possible in 12 bits. */
40 
41 /* The 32 bits of the long are divided into two parts for the key & code:   */
42 /* 1. The code is 12 bits as our compression algorithm is limited to 12bits */
43 /* 2. The key is 12 bits Prefix code + 8 bit new char or 20 bits.	    */
44 /* The key is the upper 20 bits.  The code is the lower 12. */
45 #define HT_GET_KEY(l)	(l >> 12)
46 #define HT_GET_CODE(l)	(l & 0x0FFF)
47 #define HT_PUT_KEY(l)	(l << 12)
48 #define HT_PUT_CODE(l)	(l & 0x0FFF)
49 
50 typedef struct GifHashTableType {
51     UINT32 HTable[HT_SIZE];
52 } GifHashTableType;
53 
54 GifHashTableType *_InitHashTable(void);
55 void _ClearHashTable(GifHashTableType *HashTable);
56 void _InsertHashTable(GifHashTableType *HashTable, UINT32 Key, int Code);
57 int _ExistsHashTable(GifHashTableType *HashTable, UINT32 Key);
58 
59 #endif /* _GIF_HASH_H_ */
60