Computer Chess Club Archives


Search

Terms

Messages

Subject: Compiler bug?

Author: Sune Fischer

Date: 13:09:37 07/03/02


Hi quick question.

// this one is "faulty":
#define RANK64(r) (0x00000000000000FF<<(r<<3))  // r is 0-7

// this one works:
#define RANK64(r) (0x00000000000000FF<<((UINT64)r<<3))  // r is 0-7

Q: Why do need I to cast the shifting parameter also, it's always a number
between 0 and 63, isn't that obvious to the compiler (msvc++ 6)?

I get these bitboards with the first version, after 31 bits things get nutty:

--------
--------
--------
--------
--------
--------
--------
xxxxxxxx

--------
--------
--------
--------
--------
--------
xxxxxxxx
--------

--------
--------
--------
--------
--------
xxxxxxxx
--------
--------

xxxxxxxx
xxxxxxxx
xxxxxxxx
xxxxxxxx
xxxxxxxx
--------
--------
--------

--------
--------
--------
--------
--------
--------
--------
--------

--------
--------
--------
--------
--------
--------
--------
--------

--------
--------
--------
--------
--------
--------
--------
--------

--------
--------
--------
--------
--------
--------
--------
--------



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.