Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/ntirpc/misc/city.h
$ cat -n /usr/include/ntirpc/misc/city.h 1 /* city.h - cityhash-c 2 * CityHash on C 3 * Copyright (c) 2011-2012, Alexander Nusov 4 * 5 * - original copyright notice - 6 * Copyright (c) 2011 Google, Inc. 7 * 8 * Permission is hereby granted, free of charge, to any person obtaining a copy 9 * of this software and associated documentation files (the "Software"), to deal 10 * in the Software without restriction, including without limitation the rights 11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 * copies of the Software, and to permit persons to whom the Software is 13 * furnished to do so, subject to the following conditions: 14 * 15 * The above copyright notice and this permission notice shall be included in 16 * all copies or substantial portions of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 * THE SOFTWARE. 25 * 26 * CityHash, by Geoff Pike and Jyrki Alakuijala 27 * 28 * This file provides a few functions for hashing strings. On x86-64 29 * hardware in 2011, CityHash64() is faster than other high-quality 30 * hash functions, such as Murmur. This is largely due to higher 31 * instruction-level parallelism. CityHash64() and CityHash128() also perform 32 * well on hash-quality tests. 33 * 34 * CityHash128() is optimized for relatively long strings and returns 35 * a 128-bit hash. For strings more than about 2000 bytes it can be 36 * faster than CityHash64(). 37 * 38 * Functions in the CityHash family are not suitable for cryptography. 39 * 40 * WARNING: This code has not been tested on big-endian platforms! 41 * It is known to work well on little-endian platforms that have a small penalty 42 * for unaligned reads, such as current Intel and AMD moderate-to-high-end CPUs. 43 * 44 * By the way, for some hash functions, given strings a and b, the hash 45 * of a+b is easily derived from the hashes of a and b. This property 46 * doesn't hold for any hash functions in this file. 47 */ 48 49 #ifndef CITY_HASH_H_ 50 #define CITY_HASH_H_ 51 52 #include
53 #include
54 55 typedef uint8_t uint8; 56 typedef uint32_t uint32; 57 typedef uint64_t uint64; 58 59 typedef struct _uint128 uint128; 60 struct _uint128 { 61 uint64 first; 62 uint64 second; 63 }; 64 65 #define Uint128Low64(x) ((x).first) 66 #define Uint128High64(x) ((x).second) 67 68 /* Hash function for a byte array. */ 69 uint64 CityHash64(const char *buf, size_t len); 70 71 /* Hash function for a byte array. For convenience, a 64-bit seed is also 72 * hashed into the result. */ 73 uint64 CityHash64WithSeed(const char *buf, size_t len, uint64 seed); 74 75 /* Hash function for a byte array. For convenience, two seeds are also 76 * hashed into the result. */ 77 uint64 CityHash64WithSeeds(const char *buf, size_t len, uint64 seed0, 78 uint64 seed1); 79 80 /* Hash function for a byte array. */ 81 uint128 CityHash128(const char *s, size_t len); 82 83 /* Hash function for a byte array. For convenience, a 128-bit seed is also 84 * hashed into the result. */ 85 uint128 CityHash128WithSeed(const char *s, size_t len, uint128 seed); 86 87 #endif /* CITY_HASH_H_ */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™