Author belopolsky
Recipients belopolsky, draghuram, mark.dickinson, rhettinger, stutzbach
Date 2010-05-12.15:27:59
SpamBayes Score 0.00132571
Marked as misclassified No
Message-id <AANLkTim61n5Wp8ttjtKSPzUFzjVfaOgWzeWIGwhRRiTJ@mail.gmail.com>
In-reply-to <AANLkTikg3ykV7gmbvWzBaeH0CFT0v5iXByehtDt3ywmo@mail.gmail.com>
Content
On Tue, May 11, 2010 at 10:19 PM, Alexander Belopolsky
<report@bugs.python.org> wrote:
..
> Another readability nit:  for me k % 2 == 0 is a more readable check
> for even number than (k & 1) != 1.  Performance-wise the two choices
> are the same, and either can be improved by combining k = (n + m) / 2
> and k & 1 into one ldiv call.

Strike this comment.  For some reason I though GCC would optimize
division by 2 and inline ldiv, but apparently neither is true.

Still,

if ((k & 1) != 1)
          k = k - 1;

looks odd to me. Maybe k += (k & 1) - 1?
History
Date User Action Args
2010-05-12 15:31:34belopolskysetrecipients: + belopolsky, rhettinger, mark.dickinson, draghuram, stutzbach
2010-05-12 15:28:23belopolskylinkissue8692 messages
2010-05-12 15:28:00belopolskycreate