Author: Dann Corbit
Date: 10:39:29 09/22/05
Go up one level in this thread
On September 22, 2005 at 12:35:50, Andrew Shapira wrote: >"There is no way to do that" is a pretty strong statement. Where's the proof? > >On September 22, 2005 at 03:47:58, Gerd Isenberg wrote: > >>On September 22, 2005 at 02:40:22, Andrew Shapira wrote: >> >>>Yeah, I know about http://graphics.stanford.edu/~seander/bithacks.html >>> - I have used it and some other web sites extensively. I have racked my brains >>>for 2 days, on the couch, in the shower, in bed, while walking around, and still >>>haven't figured it out. My sense is that it seems doable, and that a solution >>>could involve subtracting x from (2^n)-1. This might be a high-order analog of >>>the x-1 term that occurs in the expression x^(x-1) that comes up in low-order >>>bit computations. >> >>Nope, to answer your original question again, hopefully more clearly. >>There is no cheap way with the operators you mentioned to mask MS1B. >>The LS1B tricks works due to two's complement, or one's complement plus one. >>It has something to do with carry propagation which unfortunately only works in >>one direction as we don't have reverse arithmetic ;-) >> >>Gerd You can easily get an O(1) answer. Just compute all of the possible results and store them in a table. Admittedly, the table is "rather large" How's that for dry humor? Probably you won't find an answer better than Gerd's. IMO-YMMV.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.