Back to index

im-sdk  12.3.91
gif_hash.h
Go to the documentation of this file.
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 #define HT_SIZE                    8192      /* 12bits = 4096 or twice as big! */
00011 #define HT_KEY_MASK         0x1FFF                     /* 13bits keys */
00012 #define HT_KEY_NUM_BITS            13                         /* 13bits keys */
00013 #define HT_MAX_KEY          8191   /* 13bits - 1, maximal code possible */
00014 #define HT_MAX_CODE         4095   /* Biggest code possible in 12 bits. */
00015 
00016 /* The 32 bits of the long are divided into two parts for the key & code:   */
00017 /* 1. The code is 12 bits as our compression algorithm is limited to 12bits */
00018 /* 2. The key is 12 bits Prefix code + 8 bit new char or 20 bits.         */
00019 #define HT_GET_KEY(l)       (l >> 12)
00020 #define HT_GET_CODE(l)      (l & 0x0FFF)
00021 #define HT_PUT_KEY(l)       (l << 12)
00022 #define HT_PUT_CODE(l)      (l & 0x0FFF)
00023 
00024 typedef struct GifHashTableType {
00025     unsigned long HTable[HT_SIZE];
00026 } GifHashTableType;
00027 
00028 GifHashTableType *_InitHashTable(void);
00029 void _ClearHashTable(GifHashTableType *HashTable);
00030 void _InsertHashTable(GifHashTableType *HashTable, unsigned long Key, int Code);
00031 int _ExistsHashTable(GifHashTableType *HashTable, unsigned long Key);