Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Basic bitboard representation in C (shifting)

Author: Alessandro Scotti

Date: 11:16:05 01/06/06

Go up one level in this thread


On January 06, 2006 at 12:49:25, frogMeSebastian wrote:

>Now let's say there is one single Pawn on A1. If I simply do
>  bb_WhitePawns = 1000..0 (63 0)
>Then
>  printf(" %i", bb_WhitePawns >> 1);
>would not return '0100..00' but some nonsense integer value.

You must tell printf() that the argument is a 64-bit integer, using the "ll" or
"I64" prefix (for GCC and MSVC respectively). For example:
  printf( "%llx", bb_WhitePawns );
there should be some macros like PRIx64 defined in the compiler headers. If not,
you should define your own so it's easier to port code to a different compiler.
You can find some code here:

http://cvs.sourceforge.net/viewcvs.py/smartmontools/sm5/int64.h?rev=1.12

(just taken randomly out of a Google search, but does what you need).




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.