Author: Roberto Waldteufel
Date: 10:30:22 11/01/98
Go up one level in this thread
On November 01, 1998 at 13:07:25, Inmann Werner wrote: >I read some articles about the bitboards. >Seems nice! >But I have one simple problem. >If I have, lets say, all pawn moves possible, in one bitboard. How can I come >in a fast way to the moves (extract them from the bitboard). Counting through >all 64 Bits is ugly and slow. > >Can anybody help me? > >Werner Hi Werner, I use the bsf and bsr instructions to step throgh the bits. On 32-bit machines like the Pentium, you have to step through two "half-bitboards" of 32 bits each. The bsf (bit scan forward) returns the bit-position (0-31) of the least significant one-bit, and bsr (bit scan reverse) returns the bit position of the most significant one-bit. These instructions used to be very,very slow on intel machines, but on the PII and PPro they are very fast: both instructions execute in 1-2 clocks. However, it would probably be best to avoid them if you intend running the program on any of the earlier Intels like ordinary plain Pentium, or Pentium MMX or of course the old X86 dinosaurs. Best wishes, Roberto
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.