Talk:Bit manipulation
From Wikipedia, the free encyclopedia
I added the [dubious ] tag to the following
In most cases, the programmer would choose the former method. If it was necessary to find the minimum of two integers millions of times per second, the programmer might exploit his knowledge of binary representation of integers and come up with the latter method. Since that method does not use branching, it runs faster on some processors.
Already the first part is not true, in most cases the programmer would use the MIN(x,y) macro implemented as (x<y)?x:y, or a min(x,y) procedure that would be inlined by the compiler and avoid duplicate evaluation of x,y if this would eb a concern. But the main problem is the last phrase; since so far I only know counter-examples providing evidence against the truth of the statement, so even if it is m-m-maybe conceivable that the idea could apply (and still, I could not think of a microprogram realizing that situation), if there is no commercially available CPU with this property, then I don't think it is relevant and the statement should better be removed since it would only create confusion in > 99% of the cases. For current processors as AMD and Pentium my tests provide evidence for the fact that (x<y)?x:y virtually takes no time (almost all of the time of the loop, being needed to decrement & zero test the counter and branch back), while the "complicated" solution takes over 20% of the total time.— MFH:Talk 15:59, 5 June 2008 (UTC)

