[lkml]   [1998]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: new dentry feature in 2.1.78
   From: (Linus Torvalds)
Date: 10 Jan 1998 23:16:34 GMT

Michael Elizabeth Chastain <> 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 ;-)

David S. Miller

 \ /
  Last update: 2005-03-22 13:41    [W:0.032 / U:4.856 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site