Re: diff to speed up fdalloc using two-level bitmaps
David Laight <[email protected]>
| Newsgroups | gmane.os.netbsd.devel.performance |
|---|---|
| Message-ID | <[email protected]> |
> It's much easier to find the last (that is, least significant) set
> or clear bit. You can sometimes change the algorithm or the data
> representation to suit.
>
> unsigned int find_last_set(unsigned int x)
> {
> return (x & -x);
> }
>
> unsigned int find_last_clear(unsigned int x)
> {
> return (~x & (x+1));
> }
Unfortunately you still need to do the log2(x)....
David
--
David Laight: [email protected]