Re: [PATCH 2/2] The new jhash implementation

From: Eric Dumazet
Date: Thu Nov 25 2010 - 09:05:59 EST


Le jeudi 25 novembre 2010 Ã 21:55 +0800, Changli Gao a Ãcrit :

> > I suggest :
> >
> > #include <linux/unaligned/packed_struct.h>
> > ...
> > a += __get_unaligned_cpu32(k);
> > b += __get_unaligned_cpu32(k+4);
> > c += __get_unaligned_cpu32(k+8);
> >
> > Fits nicely in registers.
> >
>
> I think you mean get_unaligned_le32().
>

No, I meant __get_unaligned_cpu32()

We do same thing in jhash2() :

a += k[0];
b += k[1];
c += k[2];

We dont care of bit order of the 32bit quantity we are adding to a,b or
c , as long its consistent for the current machine ;)

get_unaligned_le32() would be slow on big endian arches.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/