Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: question about using firstone in bitboard

Author: Robert Hyatt

Date: 12:33:28 01/20/03

Go up one level in this thread


On January 20, 2003 at 14:06:15, Uri Blass wrote:

>I find in crafty 2 functions for firstone
>
>The first function is something has some function cntlzw that I am unable to
>understand.

That is because that is not used on the X86 machines.  :)

That is only useful on the macintosh or something based on the power-pc
chip.


>
>int FirstOne(register BITBOARD a) {
>  register unsigned long i;
>
>  if (i = a >> 32)
>    return(__cntlzw(i));
>  if (i = (unsigned int) a)
>    return(__cntlzw(i) + 32);
>  return(64);
>}
>
>I can understand only the second one.
>
>int FirstOne(BITBOARD arg1) {
>    if (arg1>>48)
>      return (first_ones[arg1>>48]);
>    if ((arg1>>32)&65535)
>      return (first_ones[(arg1>>32)&65535]+16);
>    if ((arg1>>16)&65535)
>      return (first_ones[(arg1>>16)&65535]+32);
>    return (first_ones[arg1&65535]+48);
>}
>
>I also want to know if there is a faster algorithm to find all 1's if I do not
>care about the order when in most cases there is a small number of 1's.

find all 1's??  do you mean "count all ones?"


>
>1 should be only for isolated pawn.
>
>I want to use firstone to evaluate weak pawns not based on their number and I
>need to find the weak pawns in order to evaluate them.
>
>Uri



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.