Lines Matching +full:16 +full:- +full:input
1 /*-
9 * These are functions for producing 32-bit hashes for hash table lookup...
13 * Copyright (c) 2014-2016 Solarflare Communications Inc.
50 * Rotate a 32-bit value left
53 * fall-back to a simple shift based implementation.
63 (((_value) << (_shift)) | ((_value) >> (32 - (_shift))))
67 /* Mix three 32-bit values reversibly */
70 _a -= _c; \
73 _b -= _a; \
76 _c -= _b; \
79 _a -= _c; \
80 _a ^= EFX_HASH_ROTATE(_c, 16); \
82 _b -= _a; \
85 _c -= _b; \
91 /* Final mixing of three 32-bit values into one (_c) */
95 _c -= EFX_HASH_ROTATE(_b, 14); \
97 _a -= EFX_HASH_ROTATE(_c, 11); \
99 _b -= EFX_HASH_ROTATE(_a, 25); \
101 _c -= EFX_HASH_ROTATE(_b, 16); \
103 _a -= EFX_HASH_ROTATE(_c, 4); \
105 _b -= EFX_HASH_ROTATE(_a, 14); \
107 _c -= EFX_HASH_ROTATE(_b, 24); \
111 /* Produce a 32-bit hash from 32-bit aligned input */
114 __in_ecount(count) uint32_t const *input, in efx_hash_dwords()
126 /* Handle all but the last three dwords of the input */ in efx_hash_dwords()
128 a += input[0]; in efx_hash_dwords()
129 b += input[1]; in efx_hash_dwords()
130 c += input[2]; in efx_hash_dwords()
133 count -= 3; in efx_hash_dwords()
134 input += 3; in efx_hash_dwords()
137 /* Handle the left-overs */ in efx_hash_dwords()
140 c += input[2]; in efx_hash_dwords()
141 /* Fall-through */ in efx_hash_dwords()
143 b += input[1]; in efx_hash_dwords()
144 /* Fall-through */ in efx_hash_dwords()
146 a += input[0]; in efx_hash_dwords()
160 /* Produce a 32-bit hash from arbitrarily aligned input */
163 __in_ecount(length) uint8_t const *input, in efx_hash_bytes()
174 /* Handle all but the last twelve bytes of the input */ in efx_hash_bytes()
176 a += ((uint32_t)input[0]) << 24; in efx_hash_bytes()
177 a += ((uint32_t)input[1]) << 16; in efx_hash_bytes()
178 a += ((uint32_t)input[2]) << 8; in efx_hash_bytes()
179 a += ((uint32_t)input[3]); in efx_hash_bytes()
180 b += ((uint32_t)input[4]) << 24; in efx_hash_bytes()
181 b += ((uint32_t)input[5]) << 16; in efx_hash_bytes()
182 b += ((uint32_t)input[6]) << 8; in efx_hash_bytes()
183 b += ((uint32_t)input[7]); in efx_hash_bytes()
184 c += ((uint32_t)input[8]) << 24; in efx_hash_bytes()
185 c += ((uint32_t)input[9]) << 16; in efx_hash_bytes()
186 c += ((uint32_t)input[10]) << 8; in efx_hash_bytes()
187 c += ((uint32_t)input[11]); in efx_hash_bytes()
189 length -= 12; in efx_hash_bytes()
190 input += 12; in efx_hash_bytes()
193 /* Handle the left-overs */ in efx_hash_bytes()
196 c += ((uint32_t)input[11]); in efx_hash_bytes()
197 /* Fall-through */ in efx_hash_bytes()
199 c += ((uint32_t)input[10]) << 8; in efx_hash_bytes()
200 /* Fall-through */ in efx_hash_bytes()
202 c += ((uint32_t)input[9]) << 16; in efx_hash_bytes()
203 /* Fall-through */ in efx_hash_bytes()
205 c += ((uint32_t)input[8]) << 24; in efx_hash_bytes()
206 /* Fall-through */ in efx_hash_bytes()
208 b += ((uint32_t)input[7]); in efx_hash_bytes()
209 /* Fall-through */ in efx_hash_bytes()
211 b += ((uint32_t)input[6]) << 8; in efx_hash_bytes()
212 /* Fall-through */ in efx_hash_bytes()
214 b += ((uint32_t)input[5]) << 16; in efx_hash_bytes()
215 /* Fall-through */ in efx_hash_bytes()
217 b += ((uint32_t)input[4]) << 24; in efx_hash_bytes()
218 /* Fall-through */ in efx_hash_bytes()
220 a += ((uint32_t)input[3]); in efx_hash_bytes()
221 /* Fall-through */ in efx_hash_bytes()
223 a += ((uint32_t)input[2]) << 8; in efx_hash_bytes()
224 /* Fall-through */ in efx_hash_bytes()
226 a += ((uint32_t)input[1]) << 16; in efx_hash_bytes()
227 /* Fall-through */ in efx_hash_bytes()
229 a += ((uint32_t)input[0]) << 24; in efx_hash_bytes()
243 /* Produce a 32-bit hash from arbitrarily aligned input */
246 __in_ecount(length) uint8_t const *input, in efx_hash_bytes()
257 /* Handle all but the last twelve bytes of the input */ in efx_hash_bytes()
259 a += ((uint32_t)input[0]); in efx_hash_bytes()
260 a += ((uint32_t)input[1]) << 8; in efx_hash_bytes()
261 a += ((uint32_t)input[2]) << 16; in efx_hash_bytes()
262 a += ((uint32_t)input[3]) << 24; in efx_hash_bytes()
263 b += ((uint32_t)input[4]); in efx_hash_bytes()
264 b += ((uint32_t)input[5]) << 8; in efx_hash_bytes()
265 b += ((uint32_t)input[6]) << 16; in efx_hash_bytes()
266 b += ((uint32_t)input[7]) << 24; in efx_hash_bytes()
267 c += ((uint32_t)input[8]); in efx_hash_bytes()
268 c += ((uint32_t)input[9]) << 8; in efx_hash_bytes()
269 c += ((uint32_t)input[10]) << 16; in efx_hash_bytes()
270 c += ((uint32_t)input[11]) << 24; in efx_hash_bytes()
272 length -= 12; in efx_hash_bytes()
273 input += 12; in efx_hash_bytes()
276 /* Handle the left-overs */ in efx_hash_bytes()
279 c += ((uint32_t)input[11]) << 24; in efx_hash_bytes()
280 /* Fall-through */ in efx_hash_bytes()
282 c += ((uint32_t)input[10]) << 16; in efx_hash_bytes()
283 /* Fall-through */ in efx_hash_bytes()
285 c += ((uint32_t)input[9]) << 8; in efx_hash_bytes()
286 /* Fall-through */ in efx_hash_bytes()
288 c += ((uint32_t)input[8]); in efx_hash_bytes()
289 /* Fall-through */ in efx_hash_bytes()
291 b += ((uint32_t)input[7]) << 24; in efx_hash_bytes()
292 /* Fall-through */ in efx_hash_bytes()
294 b += ((uint32_t)input[6]) << 16; in efx_hash_bytes()
295 /* Fall-through */ in efx_hash_bytes()
297 b += ((uint32_t)input[5]) << 8; in efx_hash_bytes()
298 /* Fall-through */ in efx_hash_bytes()
300 b += ((uint32_t)input[4]); in efx_hash_bytes()
301 /* Fall-through */ in efx_hash_bytes()
303 a += ((uint32_t)input[3]) << 24; in efx_hash_bytes()
304 /* Fall-through */ in efx_hash_bytes()
306 a += ((uint32_t)input[2]) << 16; in efx_hash_bytes()
307 /* Fall-through */ in efx_hash_bytes()
309 a += ((uint32_t)input[1]) << 8; in efx_hash_bytes()
310 /* Fall-through */ in efx_hash_bytes()
312 a += ((uint32_t)input[0]); in efx_hash_bytes()