X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Ftypes.h;h=ba25ef6ed07cc0735f3170b28e903e852bec8ac3;hp=7de31d45f67853de4e3ea498c59157dce55c4b91;hb=0049d3f337b6f3a66a0;hpb=b356e0fae3b78e39af2ae8aca6ca6197e8669819 diff --git a/src/types.h b/src/types.h index 7de31d45..ba25ef6e 100644 --- a/src/types.h +++ b/src/types.h @@ -79,8 +79,8 @@ const bool Is64Bit = false; typedef uint64_t Key; typedef uint64_t Bitboard; -const int MAX_MOVES = 256; -const int MAX_PLY = 256; +const int MAX_MOVES = 192; +const int MAX_PLY = 100; const int MAX_PLY_PLUS_2 = MAX_PLY + 2; const Bitboard FileABB = 0x0101010101010101ULL; @@ -297,6 +297,12 @@ inline Score operator/(Score s, int i) { return make_score(mg_value(s) / i, eg_value(s) / i); } +/// Weight score v by score w trying to prevent overflow +inline Score apply_weight(Score v, Score w) { + return make_score((int(mg_value(v)) * mg_value(w)) / 0x100, + (int(eg_value(v)) * eg_value(w)) / 0x100); +} + #undef ENABLE_OPERATORS_ON #undef ENABLE_SAFE_OPERATORS_ON @@ -321,7 +327,7 @@ inline Color operator~(Color c) { } inline Square operator~(Square s) { - return Square(s ^ 56); + return Square(s ^ 56); // Vertical flip SQ_A1 -> SQ_A8 } inline Value mate_in(int ply) { @@ -348,7 +354,7 @@ inline Square make_square(File f, Rank r) { return Square((r << 3) | f); } -inline bool square_is_ok(Square s) { +inline bool is_ok(Square s) { return s >= SQ_A1 && s <= SQ_H8; } @@ -361,7 +367,7 @@ inline Rank rank_of(Square s) { } inline Square mirror(Square s) { - return Square(s ^ 7); + return Square(s ^ 7); // Horizontal flip SQ_A1 -> SQ_H1 } inline Square relative_square(Color c, Square s) {