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@ev1.net To: "ReactOS Development List" ros-dev@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@reactos.com http://reactos.com:8080/mailman/listinfo/ros-dev