|
From: Ying X. <yin...@wi...> - 2020-11-13 12:56:06
|
On 11/12/20 9:26 AM, jm...@re... wrote:
> +static inline u32 hash128to32(char *bytes)
> +{
> + u32 *tmp = (u32 *)bytes;
> + u32 res;
> +
> + res = ntohl(tmp[0] ^ tmp[1] ^ tmp[2] ^ tmp[3]);
> + if (likely(res))
> + return res;
> + res = tmp[0] | tmp[1] | tmp[2] | tmp[3];
> + return !res ? 0 : ntohl(18140715);
In case that the hashed result is accidentally equal to the fix
number(ie, ntohl(18140715)), how would we be able to differentiate it
with the case where the hashed result is 0?
> +}
|