Author: Robert Hyatt
Date: 16:59:22 01/19/04
Go up one level in this thread
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?
Define "portable".
Bit fields will work with no problems, so long as you do not care which end
of the variable they actually start on. If you want to port data from one
machine to another, bit fields are not portable, because the ANSI standard
does not dictate which end of the word the bits start from. But if that is
not an issue, they work fine. I have found it is faster to roll your own
using AND, OR and >>/<< (shifts). Sign extensions are particularly messy.
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.