Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: BitScan with reset - not so impressive with 3DNow!

Author: Matt Taylor

Date: 04:34:37 12/05/02

Go up one level in this thread


<snip>
>> I went on and did some testing with the b & -b
>
>Okay, I'm going to ask now. Can someone explain to me the meaning of b& -b? My
>compiler generates a warning that changing a sign on an unsigned accomplishes
>nothing, so the expression reduces to b & b which is b?
<snip>

You may have to cast if your compiler is too "smart" for you. The b & -b gives a
mask such that the only bit set in the mask is the first bit set in b. (e.g.
1111b -> mask of 0001b, 1000b -> mask of 1000b, 1010b -> mask of 0010b)

-Matt



This page took 0.01 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.