dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / lib / libast / i386 / include / ast / fnv.h
blob2312a20118765af0a977cf0257052ca1a213c1e5
2 /* : : generated by proto : : */
3 /***********************************************************************
4 * *
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 *
10 * *
11 * A copy of the License is available at *
12 * http://www.opensource.org/licenses/cpl1.0.txt *
13 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
14 * *
15 * Information and Software Systems Research *
16 * AT&T Research *
17 * Florham Park NJ *
18 * *
19 * Glenn Fowler <gsf@research.att.com> *
20 * David Korn <dgk@research.att.com> *
21 * Phong Vo <kpv@research.att.com> *
22 * *
23 ***********************************************************************/
26 * Glenn Fowler
27 * Landon Kurt Knoll
28 * Phong Vo
30 * FNV-1 linear congruent checksum/hash/PRNG
31 * see http://www.isthe.com/chongo/tech/comp/fnv/
34 #ifndef _FNV_H
35 #if !defined(__PROTO__)
36 #include <prototyped.h>
37 #endif
38 #if !defined(__LINKAGE__)
39 #define __LINKAGE__ /* 2004-08-11 transition */
40 #endif
42 #define _FNV_H
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; \
53 while (_i_ < n) \
54 FNVPART(h, ((unsigned char*)s)[_i_++]); \
55 } while (0)
57 #if _typ_int64_t
59 #ifdef _ast_LL
61 #define FNV_INIT64 0xcbf29ce484222325LL
62 #define FNV_MULT64 0x00000100000001b3LL
64 #else
66 #define FNV_INIT64 ((int64_t)0xcbf29ce484222325)
67 #define FNV_MULT64 ((int64_t)0x00000100000001b3)
69 #endif
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; \
75 while (_i_ < n) \
76 FNVPART64(h, ((unsigned char*)s)[_i_++]); \
77 } while (0)
79 #endif
81 #endif