Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Opening Book

Author: Miguel A. Ballicora

Date: 11:22:20 03/19/01

Go up one level in this thread


On March 19, 2001 at 13:54:23, David Rasmussen wrote:

>On March 19, 2001 at 12:28:14, Miguel A. Ballicora wrote:
>
>>On March 19, 2001 at 04:48:54, David Rasmussen wrote:
>>
>>>Hello there.
>>>
>>>I'm adding opening book support to my engine, but I've got a problem with
>>>figuring out a good portable book format. I have to be able to store binary
>>>data, such as a 64-bit hashkey, and I can't see any other way to do this in a
>>>portable way, than storing one byte at a time in the file, since I don't know
>>>how ints and other types are represented on various platforms.
>>
>>Excellent point. Not only endianess would be a problem, but also
>>size of int, etc. I haven't implemented a book yet and there is still areas
>
>An int is assured to be at least 32 bits by the ANSI standard.

It is 16, but anyway the problem would be that the standard guarantees "at
least" a number (16 for int, 32 for long int). That means that in another system
it could be bigger, corrupting the reading (if it is done by
sizeof(whatevertype) )

a semi-portable way could be to use something like

#if defined(INT_IS_32)
typedef unsigned int UINT32;
#elif defined(INT_IS_NOT32)
typedef unsigned long int UINT32;
#endif

But endianness still is a problem.

Regards,
Miguel







This page took 0.02 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.