Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: mask of highest bit - additional notes

Author: Andrew Shapira

Date: 09:35:50 09/22/05

Go up one level in this thread


"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



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.