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 /* GDAL added */ 51 typedef unsigned int UINT32; 52 53 typedef struct GifHashTableType { 54 UINT32 HTable[HT_SIZE]; 55 } GifHashTableType; 56 57 GifHashTableType *_InitHashTable(void); 58 void _ClearHashTable(GifHashTableType *HashTable); 59 void _InsertHashTable(GifHashTableType *HashTable, UINT32 Key, int Code); 60 int _ExistsHashTable(GifHashTableType *HashTable, UINT32 Key); 61 62 #endif /* GIF_HASH_H_ */ 63