00001 /****************************************************************************** 00002 * Declarations, global to other of the GIF-HASH.C module. * 00003 * * 00004 * Written by Gershon Elber, Jun 1989 * 00005 ******************************************************************************* 00006 * History: * 00007 * 14 Jun 89 - Version 1.0 by Gershon Elber. * 00008 ******************************************************************************/ 00009 00010 #ifndef _GIF_HASH_H_ 00011 #define _GIF_HASH_H_ 00012 00013 /* Find a thirty-two bit int type */ 00014 #ifdef HAVE_SYS_TYPES_H 00015 #include <sys/types.h> 00016 #endif 00017 #ifdef HAVE_BASETSD_H 00018 #include <basetsd.h> 00019 #endif 00020 00021 #ifdef _WIN32 00022 # include "../win32/afterbase.h" 00023 #else 00024 # include "../afterbase.h" 00025 #endif 00026 #define UINT32 CARD32 00027 00028 00029 #define HT_SIZE 8192 /* 12bits = 4096 or twice as big! */ 00030 #define HT_KEY_MASK 0x1FFF /* 13bits keys */ 00031 #define HT_KEY_NUM_BITS 13 /* 13bits keys */ 00032 #define HT_MAX_KEY 8191 /* 13bits - 1, maximal code possible */ 00033 #define HT_MAX_CODE 4095 /* Biggest code possible in 12 bits. */ 00034 00035 /* The 32 bits of the long are divided into two parts for the key & code: */ 00036 /* 1. The code is 12 bits as our compression algorithm is limited to 12bits */ 00037 /* 2. The key is 12 bits Prefix code + 8 bit new char or 20 bits. */ 00038 /* The key is the upper 20 bits. The code is the lower 12. */ 00039 #define HT_GET_KEY(l) (l >> 12) 00040 #define HT_GET_CODE(l) (l & 0x0FFF) 00041 #define HT_PUT_KEY(l) (l << 12) 00042 #define HT_PUT_CODE(l) (l & 0x0FFF) 00043 00044 typedef struct GifHashTableType { 00045 UINT32 HTable[HT_SIZE]; 00046 } GifHashTableType; 00047 00048 GifHashTableType *_InitHashTable(void); 00049 void _ClearHashTable(GifHashTableType *HashTable); 00050 void _InsertHashTable(GifHashTableType *HashTable, UINT32 Key, int Code); 00051 int _ExistsHashTable(GifHashTableType *HashTable, UINT32 Key); 00052 00053 #endif /* _GIF_HASH_H_ */