LibChess: Shrink Chess::Piece from 8 bytes to 1 byte

This makes the engine footprint a lot smaller.
This commit is contained in:
Andreas Kling 2020-08-21 13:46:07 +02:00
parent 1e57e32a93
commit 23813d9bc9
Notes: sideshowbarker 2024-07-19 03:21:58 +09:00

View file

@ -57,8 +57,18 @@ enum class Colour {
Colour opposing_colour(Colour colour);
struct Piece {
Colour colour;
Type type;
constexpr Piece()
: colour(Colour::None)
, type(Type::None)
{
}
constexpr Piece(Colour c, Type t)
: colour(c)
, type(t)
{
}
Colour colour : 4;
Type type : 4;
bool operator==(const Piece& other) const { return colour == other.colour && type == other.type; }
};