Crate quadboard

Source
Expand description

A quadboard is simply a collection of four bitboards (i.e. u64s, here called channels) used to store information, most commonly about piece positions.

Generally, we treat quadboards as though they are given by four horizontal binary channels, each of length 64, and so each 4-bit vertical section is a Nibble.

§Typed and Untyped Quadboards

Since a quadboard is really just four bitboards, it is effectively an untyped fixed-length buffer. This usage is reflected in the RawQuadboard struct, which allows the writing of arbitrary nibbles to arbitrary locations with no concern for their interpretation or validity.

But in actual usage, a quadboard is meant to represent a [T; 64] for some T; in this context the manual conversion between Nibble and T values is just distracting boilerplate. Hence, the Quadboard struct wraps a RawQuadboard and includes a generic type parameter T; the possible interactions with this type are then governed by trait bounds on T, and in particular the From, Into, TryFrom, and TryInto impls whose type parameter is Nibble.

§SIMD

As the portable_simd feature is currently nightly-only, this crate is also considered to be unstable. It’s possible to write non-SIMD equivalents to the algorithms used here and provide the SIMD versions via cargo feature flags, but my hope is that std::simd will be stabilised relatively soon.

Modules§

index
Correct-by-construction indices into quadboards.
raw_quadboard
Untyped quadboards storing Nibble values.

Structs§

Nibble
A byte-width nibble, representing a 4-bit unit of data.
Quadboard
A fixed-length 32-byte buffer of 64 T values.