On Tue, 27 Feb 2024 22:57:06 +0100
Mattias Rönnblom <hof...@lysator.liu.se> wrote:
> The portable and x86 version will compile to the same thing on x86.
> 
> A simpler implementation would be
> 
> static __rte_always_inline uint64_t
> u8to64_le(const uint8_t *p)
> {
>       uint64_t w;
>       memcpy(&w, p, sizeof(w));
>       return rte_cpu_to_le(w);
> }
> 
> ...which probably also compiles to the same code.
> 
> Do you want the same hash value on big and little endian, or why the 
> conversion?

I am following what other implementations do here. The reference implementation
does it off of little endian. And so does FreeBSD and Linux.

The shift version comes from the reference version.
Your right, with -O3 both get optimized away.

Reply via email to