home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / GRAPHICS / MISC / PVQUAN15.ZIP / GIFLIB.ZIP / GIF_HASH.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-03  |  2.4 KB  |  46 lines

  1. /************************************************************************
  2.  *                                                                      *
  3.  *                  Copyright (c) 1991, Frank van der Hulst             *
  4.  *                          All Rights Reserved                         *
  5.  *                                                                      *
  6.  * Authors:                                                             *
  7.  *          FvdH - Frank van der Hulst (Wellington, NZ)                     *
  8.  *                                                                      *
  9.  * Versions:                                                            *
  10.  *      V1.1 910626 FvdH - QUANT released for DBW_RENDER                *
  11.  *      V1.2 911021 FvdH - QUANT released for PoV Ray                   *
  12.  *                                                                      *
  13.  ************************************************************************/
  14. /************************************************************************
  15. * Declarations, global to other of the GIF-HASH.C module.                  *
  16. *                                                                                              *
  17. *                    Written by Gershon Elber,  Jun 1989                               *
  18. *************************************************************************
  19. * History:                                                                                  *
  20. * 14 Jun 89 - Version 1.0 by Gershon Elber.                                      *
  21. *************************************************************************/
  22.  
  23. #ifdef __GNUC__
  24. #define cdecl
  25. #endif
  26.  
  27. #define ZL_MAX_CODE 4095        /* Biggest code possible in 12 bits */
  28. #define HT_SIZE 8192                /* 12 bits = 2 * 4096 */
  29.  
  30. void cdecl HashTable_Clear(unsigned long *HashTable);
  31. void cdecl HashTable_Insert(unsigned long *HashTable, unsigned long Key, int Code);
  32. int  cdecl HashTable_Exists(unsigned long *HashTable, unsigned long Key);
  33.  
  34. #define HT_KEY_MASK        0x1FFF                  /* 13bits keys */
  35. #define HT_KEY_NUM_BITS        13                  /* 13bits keys */
  36. #define HT_MAX_KEY        8191    /* 13bits - 1, maximal code possible */
  37. #define HT_MAX_CODE        4095    /* Biggest code possible in 12 bits. */
  38.  
  39. /* The 32 bits of the long are divided into two parts for the key & code:   */
  40. /* 1. The code is 12 bits as our compression algorithm is limited to 12bits */
  41. /* 2. The key is 12 bits Prefix code + 8 bit new char or 20 bits.        */
  42. #define HT_GET_KEY(l)    (l >> 12)
  43. #define HT_GET_CODE(l)    (l & 0x0FFF)
  44. #define HT_PUT_KEY(l)    (l << 12)
  45. #define HT_PUT_CODE(l)    (l & 0x0FFF)
  46.