2 /* : : generated by proto : : */
3 /***********************************************************************
5 * This software is part of the ast package *
6 * Copyright (c) 1985-2010 AT&T Intellectual Property *
7 * and is licensed under the *
8 * Common Public License, Version 1.0 *
9 * by AT&T Intellectual Property *
11 * A copy of the License is available at *
12 * http://www.opensource.org/licenses/cpl1.0.txt *
13 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
15 * Information and Software Systems Research *
19 * Glenn Fowler <gsf@research.att.com> *
20 * David Korn <dgk@research.att.com> *
21 * Phong Vo <kpv@research.att.com> *
23 ***********************************************************************/
30 * FNV-1 linear congruent checksum/hash/PRNG
31 * see http://www.isthe.com/chongo/tech/comp/fnv/
35 #if !defined(__PROTO__)
36 #include <prototyped.h>
38 #if !defined(__LINKAGE__)
39 #define __LINKAGE__ /* 2004-08-11 transition */
44 #include <ast_common.h>
46 #define FNV_INIT 0x811c9dc5L
47 #define FNV_MULT 0x01000193L
49 #define FNVINIT(h) (h = FNV_INIT)
50 #define FNVPART(h,c) (h = (h) * FNV_MULT ^ (c))
51 #define FNVSUM(h,s,n) do { \
52 register size_t _i_ = 0; \
54 FNVPART(h, ((unsigned char*)s)[_i_++]); \
61 #define FNV_INIT64 0xcbf29ce484222325LL
62 #define FNV_MULT64 0x00000100000001b3LL
66 #define FNV_INIT64 ((int64_t)0xcbf29ce484222325)
67 #define FNV_MULT64 ((int64_t)0x00000100000001b3)
71 #define FNVINIT64(h) (h = FNV_INIT64)
72 #define FNVPART64(h,c) (h = (h) * FNV_MULT64 ^ (c))
73 #define FNVSUM64(h,s,n) do { \
74 register int _i_ = 0; \
76 FNVPART64(h, ((unsigned char*)s)[_i_++]); \