Computer Chess Club Archives


Search

Terms

Messages

Subject: question about using firstone in bitboard

Author: Uri Blass

Date: 11:06:15 01/20/03


I find in crafty 2 functions for firstone

The first function is something has some function cntlzw that I am unable to
understand.

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.

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.