Michael Elizabeth Chastain <mec@shout.net> wrote:
> #define i (((unsigned long) inode)/(sizeof(struct inode) & ~ (sizeof(struct inode) - 1)))
So, ten points to the person who can guess what the hell the above does ;)
(Hint: the calculation is not actually strictly necessary, it only tries
to aim for a better hash)
It was so easy, I had to answer. ;-)
It removes the non-significant bits from the inode address ;-)
And even when struct inode is not a strict power of 2 (which it
typically isn't) gcc still does a decent job since most of the
operations are constant and get optimized away. Gcc in this case,
has a very good idea what you are trying to do ;-)
Later,
David S. Miller
davem@dm.cobaltmicro.com