Author: Robert Hyatt
Date: 13:09:49 12/03/00
Go up one level in this thread
On December 03, 2000 at 10:40:03, David Rasmussen wrote:
>Most freely available sourcecode I've seen, implements hashtables in the manner
>of Crafty. That is, the a hashed record is a struct with some integers, which
>are treated at bit level to manage the necesary information. I do that too. But
>why aren't people just using the bitfield ability of C to do this?
>
>I mean
>
>struct HashRecord {
> int draft:6;
> int threat:1;
> etc.
>};
>
>Is this always slower? It should be pretty easy for a compiler to do exactly
>what, say, Crafty, is doing when reading and writing to such a structure.
There are two issues.
1. bitfields are slow. You can obviously try it to prove it to yourself. When
I first wrote crafty, I used them. But I discovered how badly the compilers are
at optimizing that code (probably because it isn't used much).
2. bitfields are a pain for portability. The ANSI standard doesn't dictate
which end of the word contains the first bit. Which means that if you use
then to transport information from one vendor to another (say in an opening
book or whatever) you can get screwed. Without getting kissed.
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.