1 /* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. Oracle designates this 7 * particular file as subject to the "Classpath" exception as provided 8 * by Oracle in the LICENSE file that accompanied this code. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 */ 24 25 /****************************************************************************** 26 27 gif_hash.h - magfic constants and declarations for GIF LZW 28 29 ******************************************************************************/ 30 31 #ifndef _GIF_HASH_H_ 32 #define _GIF_HASH_H_ 33 34 #include <stdint.h> 35 36 #define HT_SIZE 8192 /* 12bits = 4096 or twice as big! */ 37 #define HT_KEY_MASK 0x1FFF /* 13bits keys */ 38 #define HT_KEY_NUM_BITS 13 /* 13bits keys */ 39 #define HT_MAX_KEY 8191 /* 13bits - 1, maximal code possible */ 40 #define HT_MAX_CODE 4095 /* Biggest code possible in 12 bits. */ 41 42 /* The 32 bits of the long are divided into two parts for the key & code: */ 43 /* 1. The code is 12 bits as our compression algorithm is limited to 12bits */ 44 /* 2. The key is 12 bits Prefix code + 8 bit new char or 20 bits. */ 45 /* The key is the upper 20 bits. The code is the lower 12. */ 46 #define HT_GET_KEY(l) (l >> 12) 47 #define HT_GET_CODE(l) (l & 0x0FFF) 48 #define HT_PUT_KEY(l) (l << 12) 49 #define HT_PUT_CODE(l) (l & 0x0FFF) 50 51 typedef struct GifHashTableType { 52 uint32_t HTable[HT_SIZE]; 53 } GifHashTableType; 54 55 GifHashTableType *_InitHashTable(void); 56 void _ClearHashTable(GifHashTableType *HashTable); 57 void _InsertHashTable(GifHashTableType *HashTable, uint32_t Key, int Code); 58 int _ExistsHashTable(GifHashTableType *HashTable, uint32_t Key); 59 60 #endif /* _GIF_HASH_H_ */ 61 62 /* end */ --- EOF ---