[ros-dev] ping Alex regarding log2() for scheduler

Magnus Olsen magnus at itkonsult-olsen.com
Thu Mar 24 01:18:07 CET 2005


I will test it later to moring see if I can fix the broket part and keep the
speed.
I did worte it direcly on mailing list without test see if really works or
not

----- Original Message ----- 
From: "Royce Mitchell III" <royce3 at ev1.net>
To: "ReactOS Development List" <ros-dev at reactos.com>
Sent: Wednesday, March 23, 2005 11:04 PM
Subject: Re: [ros-dev] ping Alex regarding log2() for scheduler


> Magnus Olsen wrote:
>
> >Hi I have not test run this code. But i think this form maby
> >are faster that v3 of  Royce  Mitchell III code
> >it leave to the compiler to optimze it more or I complete wrong
> >
> > int highest_bit ( unsigned int i )
> > {
> >     int ret = 0;
> >     int n ;
> >     int t;
> >     int x;
> >
> >    for (t = 0; t>3;t++)
> >   {
> >      x = (16 << t);
> >      n = i >> x;
> >     if ( n )  i = n, ret  += x ;
> >   }
> >      return ret + (i>>1);
> >}
> >
> >
> >
> Magnus,
>
> Well... I was skeptical at first....
>
> Your code is indeed faster, but it is not outputting correct results, so
> if you can tweak it to output correct results without sacrificing speed
> I will indeed be impressed!
>
> /me crosses fingers ;)
>
> Royce3
>
> _______________________________________________
> Ros-dev mailing list
> Ros-dev at reactos.com
> http://reactos.com:8080/mailman/listinfo/ros-dev



More information about the Ros-dev mailing list