1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:57:35 +00:00

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

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; }
};