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
27gif_hash.h - magfic constants and declarations for GIF LZW
28
29******************************************************************************/
30
31#ifndef _GIF_HASH_H_
32#define _GIF_HASH_H_
33
34/** Begin JDK modifications to support building on Windows **/
35#ifndef _WIN32
36#include <unistd.h>
37#endif
38/** End JDK modifications to support building on Windows **/
39#include <stdint.h>
40
41#define HT_SIZE 8192 /* 12bits = 4096 or twice as big! */
42#define HT_KEY_MASK 0x1FFF /* 13bits keys */
43#define HT_KEY_NUM_BITS 13 /* 13bits keys */
44#define HT_MAX_KEY 8191 /* 13bits - 1, maximal code possible */
45#define HT_MAX_CODE 4095 /* Biggest code possible in 12 bits. */
46
47/* The 32 bits of the long are divided into two parts for the key & code: */
48/* 1. The code is 12 bits as our compression algorithm is limited to 12bits */
49/* 2. The key is 12 bits Prefix code + 8 bit new char or 20 bits. */
50/* The key is the upper 20 bits. The code is the lower 12. */
51#define HT_GET_KEY(l) (l >> 12)
52#define HT_GET_CODE(l) (l & 0x0FFF)
53#define HT_PUT_KEY(l) (l << 12)
54#define HT_PUT_CODE(l) (l & 0x0FFF)
55
56typedef struct GifHashTableType {
57 uint32_t HTable[HT_SIZE];
58} GifHashTableType;
59
60GifHashTableType *_InitHashTable(void);
61void _ClearHashTable(GifHashTableType *HashTable);
62void _InsertHashTable(GifHashTableType *HashTable, uint32_t Key, int Code);
63int _ExistsHashTable(GifHashTableType *HashTable, uint32_t Key);
64
65#endif /* _GIF_HASH_H_ */
66
67/* end */
68