4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1999 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #ifndef _ICONV_TM_HASH_H
28 #define _ICONV_TM_HASH_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
39 static itm_size_t
hash(const char *, itm_size_t
, itm_size_t
);
40 static itm_num_t
hash_dense_encoding(const unsigned char *, itm_size_t
,
41 const unsigned char *,
42 const unsigned char *);
46 hash(const char *ptr
, itm_size_t size
, itm_size_t hash_size
)
52 for (; 0 < size
; --size
) {
56 return (value
% hash_size
);
61 const unsigned char *byte_seq
,
63 const unsigned char *byte_seq_min
,
64 const unsigned char *byte_seq_max
)
69 num
= (*byte_seq
- *byte_seq_min
);
72 for (i
= 1, byte_seq
++; i
< length
;
73 i
++, byte_seq
++, byte_seq_min
++, byte_seq_max
++) {
74 if ((*byte_seq
< *byte_seq_min
) ||
75 (*byte_seq_max
< *byte_seq
)) {
78 num
*= (*byte_seq_max
- *byte_seq_min
+ 1);
79 num
+= (*byte_seq
- *byte_seq_min
);
88 #endif /* !_ICONV_TM_HASH_H */