| .. | .. |
|---|
| 34 | 34 | * ("BSD"). |
|---|
| 35 | 35 | * |
|---|
| 36 | 36 | * You can contact the author at: |
|---|
| 37 | | - * - xxHash homepage: http://cyan4973.github.io/xxHash/ |
|---|
| 37 | + * - xxHash homepage: https://cyan4973.github.io/xxHash/ |
|---|
| 38 | 38 | * - xxHash source repository: https://github.com/Cyan4973/xxHash |
|---|
| 39 | 39 | */ |
|---|
| 40 | 40 | |
|---|
| .. | .. |
|---|
| 107 | 107 | */ |
|---|
| 108 | 108 | uint64_t xxh64(const void *input, size_t length, uint64_t seed); |
|---|
| 109 | 109 | |
|---|
| 110 | +/** |
|---|
| 111 | + * xxhash() - calculate wordsize hash of the input with a given seed |
|---|
| 112 | + * @input: The data to hash. |
|---|
| 113 | + * @length: The length of the data to hash. |
|---|
| 114 | + * @seed: The seed can be used to alter the result predictably. |
|---|
| 115 | + * |
|---|
| 116 | + * If the hash does not need to be comparable between machines with |
|---|
| 117 | + * different word sizes, this function will call whichever of xxh32() |
|---|
| 118 | + * or xxh64() is faster. |
|---|
| 119 | + * |
|---|
| 120 | + * Return: wordsize hash of the data. |
|---|
| 121 | + */ |
|---|
| 122 | + |
|---|
| 123 | +static inline unsigned long xxhash(const void *input, size_t length, |
|---|
| 124 | + uint64_t seed) |
|---|
| 125 | +{ |
|---|
| 126 | +#if BITS_PER_LONG == 64 |
|---|
| 127 | + return xxh64(input, length, seed); |
|---|
| 128 | +#else |
|---|
| 129 | + return xxh32(input, length, seed); |
|---|
| 130 | +#endif |
|---|
| 131 | +} |
|---|
| 132 | + |
|---|
| 110 | 133 | /*-**************************** |
|---|
| 111 | 134 | * Streaming Hash Functions |
|---|
| 112 | 135 | *****************************/ |
|---|