lkml.org 
[lkml]   [2006]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] fix alloc_large_system_hash roundup
Date
Roland Dreier wrote on Wednesday, March 15, 2006 9:41 AM
> > /* rounded up to nearest power of 2 in size */
> > - numentries = 1UL << (long_log2(numentries) + 1);
> > + numentries = 1UL << (long_log2(2*numentries - 1));
>
> How about just using roundup_pow_of_two()? You could kill the comment
> too then.

roundup_pow_of_two uses fls, but fls takes an "int" argument. I think
that function is buggy on 64-bit arch. Is it an oversight or something?


static inline unsigned long roundup_pow_of_two(unsigned long x)
{
return (1UL << fls(x - 1));
}

- Ken

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

\
 
 \ /
  Last update: 2006-03-15 23:11    [W:0.036 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site