projects
/
fairystockfish.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
7cc61e2
)
Guard against overflow in piece types
author
Fabian Fichter
<ianfab@users.noreply.github.com>
Sun, 16 Sep 2018 14:21:24 +0000 (16:21 +0200)
committer
Fabian Fichter
<ianfab@users.noreply.github.com>
Sun, 16 Sep 2018 14:21:24 +0000 (16:21 +0200)
No functional change.
src/types.h
patch
|
blob
|
history
diff --git
a/src/types.h
b/src/types.h
index
ecf1e05
..
25834b7
100644
(file)
--- 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");