Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: mask of highest bit - additional notes

Author: Gerd Isenberg

Date: 00:47:58 09/22/05

Go up one level in this thread


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.