From 23813d9bc9ef9908644092991296906f2e9d7f7e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 21 Aug 2020 13:46:07 +0200 Subject: [PATCH] LibChess: Shrink Chess::Piece from 8 bytes to 1 byte This makes the engine footprint a lot smaller. --- Libraries/LibChess/Chess.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Libraries/LibChess/Chess.h b/Libraries/LibChess/Chess.h index f0e0b91aab..0a49f49165 100644 --- a/Libraries/LibChess/Chess.h +++ b/Libraries/LibChess/Chess.h @@ -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; } };