Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Pumping BitBoards

Author: Hristo

Date: 17:16:59 11/17/98

Go up one level in this thread


On November 17, 1998 at 18:55:02, Peter Fendrich wrote:

>On November 17, 1998 at 15:11:19, Hristo wrote:
>
>>On November 17, 1998 at 14:22:26, Peter Fendrich wrote:
>>
>>>In my program, Terra, I have the following union:
>>>
>>>typedef union BitBoardDef {
>>>  unsigned __int64 i64;
>>>  unsigned __int32 half[2];   // a5-h8 and a1-h4
>>>} BITBOARD;
>>>
>>>I always use BITBOARD as parameters to funcions and I also return BITBOARD's in
>>>many functions.
>>>
>>>Does compilers in general understand that BITBOARD really is an int64 or would
>>>it be better to use pure int64 instead?
>>>
>>>//Peter
>>
>>Set your compiler to generate listing code (assembler+"c-cpp"source) and then
>>just look at what is pushed on the stack, or if you are using register param.
>>passing then see what registers get set before calling yourFunction(BITBOARD b).
>>
>>MSVC5.0-6.0 understnads the union definitions correctly. In your case it will
>>treat it as __int64. I do not know how other compilers would handle this.
>>
>>regards.
>>hristo
>
>Yes, MSV6.0 seems to do this right but I don't know if this is stated by some
>C++ spec or it's just a 'coincident' and I have no idea what other compilers
>might do with this union...
>//Peter

I would bet that most of the compilers would do it right!!!
The only "trouble" you might have is the default data alignment ... in
VC6.0 you can change it with #pragma pack(n) ... where n=number of bytes.
and then #pragma pack() to reset things back to normal ...
hope this helps a bit.

hristo



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.