From 244a90cad3a1ee4c1817489d01ed937d337eebe8 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Sun, 16 Sep 2018 16:21:24 +0200 Subject: [PATCH] Guard against overflow in piece types No functional change. --- src/types.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/types.h b/src/types.h index ecf1e05..25834b7 100644 --- a/src/types.h +++ b/src/types.h @@ -230,6 +230,7 @@ enum PieceType { PIECE_TYPE_NB = 1 << PIECE_TYPE_BITS }; +static_assert(KING < PIECE_TYPE_NB, "KING exceeds PIECE_TYPE_NB."); static_assert(PIECE_TYPE_BITS <= 6, "PIECE_TYPE uses more than 6 bit"); static_assert(!(PIECE_TYPE_NB & (PIECE_TYPE_NB - 1)), "PIECE_TYPE_NB is not a power of 2"); -- 1.7.0.4