mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:07:34 +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:
parent
1e57e32a93
commit
23813d9bc9
1 changed files with 12 additions and 2 deletions
|
@ -57,8 +57,18 @@ enum class Colour {
|
||||||
Colour opposing_colour(Colour colour);
|
Colour opposing_colour(Colour colour);
|
||||||
|
|
||||||
struct Piece {
|
struct Piece {
|
||||||
Colour colour;
|
constexpr Piece()
|
||||||
Type type;
|
: 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; }
|
bool operator==(const Piece& other) const { return colour == other.colour && type == other.type; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue