Author: Dann Corbit
Date: 18:27:13 01/22/04
Go up one level in this thread
On January 19, 2004 at 04:39:59, Mathieu Pagé wrote:
>On January 19, 2004 at 01:00:14, Michael Henderson wrote:
>
>>I have the following struct for a hash element in C language:
>>
>>struct hashElement {
>> U64 hashLock;
>> signed short int score;
>> signed depth: 10;
>> unsigned flag: 2;
>> move bestSavedMove;
>>};
>>
>>My worry is, would this type of struct be portable, and have the inner workings
>>of bitfield been standardized?
>
>Yes, it's part of ANSI C, so it's supposed to be portable.
Of course, you can't say *anything* about the size of a struct hashElement,
except perhaps to deduce a minimum size.
It could occupy 64K on a conforming C compiler. The size of a signed short is
AT LEAST 16 bits (hence 2 bytes) but it can be as large as the vendor likes.
For instance, on a CDC Cyber, an unsigned short could very sensibly be 60 bits
long.
Packing is also up to the implementation.
However, it should compile, link and run anywhere (assuming U64 and move are
sensible typedefs).
But do not imagine that you can move the book from one machine to another.
That's definitely right out.
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.