hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/linux/xxhash.h
....@@ -34,7 +34,7 @@
3434 * ("BSD").
3535 *
3636 * You can contact the author at:
37
- * - xxHash homepage: http://cyan4973.github.io/xxHash/
37
+ * - xxHash homepage: https://cyan4973.github.io/xxHash/
3838 * - xxHash source repository: https://github.com/Cyan4973/xxHash
3939 */
4040
....@@ -107,6 +107,29 @@
107107 */
108108 uint64_t xxh64(const void *input, size_t length, uint64_t seed);
109109
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
+
110133 /*-****************************
111134 * Streaming Hash Functions
112135 *****************************/