Author: Robert Hyatt
Date: 08:25:11 01/09/03
Go up one level in this thread
On January 09, 2003 at 08:00:09, Heiner Marxen wrote: >On January 08, 2003 at 14:52:20, Robert Hyatt wrote: > >>On January 08, 2003 at 09:41:54, Uri Blass wrote: >> >>>I want to initialize my pawn bitboards >>>I started by doing for every square of a pawn >>> >>>pawnBB[color(square)]|=(1<<square); >>> >>>I changed it to >>>pawnBB[color(square)]|=((Bitboard)1<<square); >>> >>>Do I need to do it? >> >>yes you do. 1 by itself is going to default to an int, so 1<<x where X >= 32 is >>going to produce a zero. > >It is even worse: "the behaviour is undefined" (ANSI-C, 6.3.7) >It may e.g. take the shift count modulo 32. It may even crash. Actually I think your first comment is what happens on Intel. > >> If you first cast 1 as a bitboard, then the shift will >>work. > >Exactly. That is the way to go. > >Cheers, >Heiner > > >>> >>>I suspected that the program may give me wrong value based on replacing my >>>perft command by a function that return perft|(1<<33) and I found that it >>>returns the correct perft without adding 1<<31 and only after I changed it to >>>(Bitboard)1 I got the right value. >>> >>>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.