home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / graphics / gif-util.zip / GIF_HASH.H < prev    next >
Text File  |  1989-08-01  |  1KB  |  32 lines

  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. #define HT_SIZE            8192       /* 12bits = 4096 or twice as big! */
  11. #define HT_KEY_MASK        0x1FFF                  /* 13bits keys */
  12. #define HT_KEY_NUM_BITS        13                  /* 13bits keys */
  13. #define HT_MAX_KEY        8191    /* 13bits - 1, maximal code possible */
  14. #define HT_MAX_CODE        4095    /* Biggest code possible in 12 bits. */
  15.  
  16. /* The 32 bits of the long are divided into two parts for the key & code:   */
  17. /* 1. The code is 12 bits as our compression algorithm is limited to 12bits */
  18. /* 2. The key is 12 bits Prefix code + 8 bit new char or 20 bits.        */
  19. #define HT_GET_KEY(l)    (l >> 12)
  20. #define HT_GET_CODE(l)    (l & 0x0FFF)
  21. #define HT_PUT_KEY(l)    (l << 12)
  22. #define HT_PUT_CODE(l)    (l & 0x0FFF)
  23.  
  24. typedef struct GifHashTableType {
  25.     unsigned long HTable[HT_SIZE];
  26. } GifHashTableType;
  27.  
  28. GifHashTableType *_InitHashTable(void);
  29. void _ClearHashTable(GifHashTableType *HashTable);
  30. void _InsertHashTable(GifHashTableType *HashTable, unsigned long Key, int Code);
  31. int _ExistsHashTable(GifHashTableType *HashTable, unsigned long Key);
  32.