1414
1515// ##########################################
1616
17- uchar CHECK_TABLE[0x10000 ];// is 0,1 or 2
18- uchar DIRECTION[64 ][64 ];// "unsigned" direction: [0..3] or INVALID_DIRECTION or KNIGHT_DIRECTION
17+ uint8_t CHECK_TABLE[0x10000 ];// is 0,1 or 2
18+ uint8_t DIRECTION[64 ][64 ];// "unsigned" direction: [0..3] or INVALID_DIRECTION or KNIGHT_DIRECTION
1919
2020// "signed" direction: [0..7] or INVALID_DIRECTION or KNIGHT_DIRECTION
2121// SDIRECTION[x][y] is the direction from x to y
22- uchar SDIRECTION[64 ][64 ];
22+ uint8_t SDIRECTION[64 ][64 ];
2323
2424Position DIRECTION_MOVE_TABLE[8 ][64 ];
2525
@@ -902,7 +902,7 @@ void Board2::init_CHECK_TABLE() {
902902 for (int i=0 ; i<0x10000 ; i++) {
903903 for (int j=0 ; j<8 ; j++)
904904 L[j] = (i>>(2 *j))&3 ;
905- uchar check = 0 ;
905+ uint8_t check = 0 ;
906906 bool threat;
907907
908908 // Check in one direction:
@@ -1322,7 +1322,7 @@ bool Board2::find_legal_move(Move& move) {
13221322// - hence the position would be illegal.
13231323// prev_num_checks is the number of checks against black king after undoing the move.
13241324// If prev_num_checks != 0, then threat_pos determines the position of one of the threats.
1325- triple<int ,uchar ,Position> Board2::retro_move_count_checks (Position from, Position to,
1325+ triple<int ,uint8_t ,Position> Board2::retro_move_count_checks (Position from, Position to,
13261326 Piece original_piece, Piece piece_killed) {
13271327
13281328 int check_count = num_checks;
@@ -1332,7 +1332,7 @@ triple<int,uchar,Position> Board2::retro_move_count_checks(Position from, Positi
13321332 if (IS_SHORT_DISTANCE_PIECE[original_piece] &&
13331333 BIT_BOARDS[original_piece][from][king_pos[player]]) {
13341334 // This piece can't have moved from "from". It could have taken the king.
1335- return triple<int ,uchar ,Position>(42 ,0 ,0 );
1335+ return triple<int ,uint8_t ,Position>(42 ,0 ,0 );
13361336 }
13371337
13381338 if (IS_SHORT_DISTANCE_PIECE[board[to]])
@@ -1426,13 +1426,13 @@ triple<int,uchar,Position> Board2::retro_move_count_checks(Position from, Positi
14261426
14271427 if (check_count) {
14281428 // No reason to proceed
1429- return triple<int ,uchar ,Position>(check_count, 0 , 0 );
1429+ return triple<int ,uint8_t ,Position>(check_count, 0 , 0 );
14301430 }
14311431
14321432 // ###############################################################################
14331433 // ###############################################################################
14341434
1435- uchar prev_num_checks = 0 ;
1435+ uint8_t prev_num_checks = 0 ;
14361436 Position threat_pos = ILLEGAL_POS;
14371437 {
14381438 if (PIECE_KIND[board[to]]==KING) {
@@ -1511,7 +1511,7 @@ triple<int,uchar,Position> Board2::retro_move_count_checks(Position from, Positi
15111511
15121512
15131513 { // Check other long distance threats
1514- const uchar *tmp = DIAG_PIECE_PATTERN[player ? WKING : BKING];
1514+ const uint8_t *tmp = DIAG_PIECE_PATTERN[player ? WKING : BKING];
15151515
15161516 for (int d=0 ; d<4 ; d++) {
15171517 uint pattern = board_lines[d][DIAG_INDEX[from][d]];
@@ -1609,7 +1609,7 @@ triple<int,uchar,Position> Board2::retro_move_count_checks(Position from, Positi
16091609 }
16101610 }
16111611
1612- return triple<int ,uchar ,Position>(check_count, prev_num_checks, threat_pos);
1612+ return triple<int ,uint8_t ,Position>(check_count, prev_num_checks, threat_pos);
16131613}
16141614
16151615struct EnPassantPP {
@@ -1729,10 +1729,10 @@ Board2::get_retro_moves(bool allow_pawn_promotion, bool allow_castling,
17291729 // Add one entry representing no en passant possible
17301730 ep_possibilities.push_back (EnPassantPP (ILLEGAL_POS, ILLEGAL_POS, ILLEGAL_POS));
17311731
1732- const uchar LEGAL_FROM = 1 ;
1733- const uchar LEGAL_TO = 2 ;
1734- const uchar PAWN_2_FORWARD_NOT_ALLOWED = 4 ;
1735- uchar LEGAL_FROM_TO[64 ];
1732+ const uint8_t LEGAL_FROM = 1 ;
1733+ const uint8_t LEGAL_TO = 2 ;
1734+ const uint8_t PAWN_2_FORWARD_NOT_ALLOWED = 4 ;
1735+ uint8_t LEGAL_FROM_TO[64 ];
17361736
17371737 if (get_num_pawns ()) {
17381738 // if en passant is possible, then unique last move is that pawn 2 forward
@@ -1914,7 +1914,7 @@ Board2::get_retro_moves(bool allow_pawn_promotion, bool allow_castling,
19141914 // rook/king move to p can gain castling capability.
19151915 // ADDED_CASTLING[p] is nonzero for a nonempty square, if a rook-capturing move
19161916 // is retracted, and the rook may have had castling capability before.
1917- uchar ADDED_CASTLING[64 ];
1917+ uint8_t ADDED_CASTLING[64 ];
19181918 memset (ADDED_CASTLING, 0 , 64 );
19191919
19201920 { // Find out if extra castling capabilities will be adding by undoing certain
@@ -1990,7 +1990,7 @@ Board2::get_retro_moves(bool allow_pawn_promotion, bool allow_castling,
19901990 int refl = KING_REFLECTIONS[player][king_pos[player]];
19911991
19921992 if (board[a1]) {
1993- const uchar C[2 ][8 ] = {{WHITE_LONG_CASTLING, WHITE_SHORT_CASTLING, 0 , 0 ,
1993+ const uint8_t C[2 ][8 ] = {{WHITE_LONG_CASTLING, WHITE_SHORT_CASTLING, 0 , 0 ,
19941994 WHITE_LONG_CASTLING, 0 , WHITE_SHORT_CASTLING, 0 },
19951995 {0 ,0 ,BLACK_LONG_CASTLING,BLACK_SHORT_CASTLING,
19961996 0 ,BLACK_LONG_CASTLING,0 ,BLACK_SHORT_CASTLING}};
@@ -2001,7 +2001,7 @@ Board2::get_retro_moves(bool allow_pawn_promotion, bool allow_castling,
20012001 }
20022002
20032003 if (board[h1]) {
2004- const uchar C[2 ][8 ] = {{WHITE_SHORT_CASTLING,WHITE_LONG_CASTLING,0 ,0 ,
2004+ const uint8_t C[2 ][8 ] = {{WHITE_SHORT_CASTLING,WHITE_LONG_CASTLING,0 ,0 ,
20052005 0 ,WHITE_LONG_CASTLING,0 ,WHITE_SHORT_CASTLING},
20062006 {0 ,0 ,BLACK_SHORT_CASTLING,BLACK_LONG_CASTLING,
20072007 BLACK_LONG_CASTLING,0 ,BLACK_SHORT_CASTLING,0 }};
@@ -2012,7 +2012,7 @@ Board2::get_retro_moves(bool allow_pawn_promotion, bool allow_castling,
20122012 }
20132013
20142014 if (board[a8]) {
2015- const uchar C[2 ][8 ] = {{0 ,0 ,WHITE_LONG_CASTLING,WHITE_SHORT_CASTLING,
2015+ const uint8_t C[2 ][8 ] = {{0 ,0 ,WHITE_LONG_CASTLING,WHITE_SHORT_CASTLING,
20162016 WHITE_SHORT_CASTLING,0 ,WHITE_LONG_CASTLING,0 },
20172017 {BLACK_LONG_CASTLING,BLACK_SHORT_CASTLING,0 ,0 ,
20182018 0 ,BLACK_SHORT_CASTLING,0 ,BLACK_LONG_CASTLING}};
@@ -2023,7 +2023,7 @@ Board2::get_retro_moves(bool allow_pawn_promotion, bool allow_castling,
20232023 }
20242024
20252025 if (board[h8]) {
2026- const uchar C[2 ][8 ] = {{0 ,0 ,WHITE_SHORT_CASTLING,WHITE_LONG_CASTLING,
2026+ const uint8_t C[2 ][8 ] = {{0 ,0 ,WHITE_SHORT_CASTLING,WHITE_LONG_CASTLING,
20272027 0 ,WHITE_SHORT_CASTLING,0 ,WHITE_LONG_CASTLING},
20282028 {BLACK_SHORT_CASTLING,BLACK_LONG_CASTLING,0 ,0 ,
20292029 BLACK_SHORT_CASTLING,0 ,BLACK_LONG_CASTLING,0 }};
@@ -2077,7 +2077,7 @@ Board2::get_retro_moves(bool allow_pawn_promotion, bool allow_castling,
20772077 // The necessary squares are empty
20782078 // cerr << "Finder ep?\n";
20792079
2080- triple<int ,uchar ,Position> t;
2080+ triple<int ,uint8_t ,Position> t;
20812081
20822082 // Pawns present, only transf. 0 and 1 might be legal
20832083
@@ -2177,15 +2177,15 @@ Board2::get_retro_moves(bool allow_pawn_promotion, bool allow_castling,
21772177 BPAWN, BPAWN, BPAWN, BPAWN, BKNIGHT, BBISHOP, BROOK, BQUEEN, 0
21782178 };
21792179
2180- const uchar TRANSF[36 ] =
2180+ const uint8_t TRANSF[36 ] =
21812181 { 5 , 4 , 2 , 0 , 0 , 0 , 0 , 0 , 0 ,
21822182 5 , 4 , 2 , 0 , 0 , 0 , 0 , 0 , 0 ,
21832183 2 , 0 , 5 , 4 , 0 , 0 , 0 , 0 , 0 ,
21842184 2 , 0 , 5 , 4 , 0 , 0 , 0 , 0 , 0
21852185 };
21862186
21872187 // ALLOWED_T used when added castling puts demands on transformation
2188- const uchar ALLOWED_T[36 ] =
2188+ const uint8_t ALLOWED_T[36 ] =
21892189 { 0xA0 , 0x50 , 0x0C , 0x03 , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF ,
21902190 0xA0 , 0x50 , 0x0C , 0x03 , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF ,
21912191 0x0C , 0x03 , 0xA0 , 0x50 , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF ,
@@ -2226,7 +2226,7 @@ Board2::get_retro_moves(bool allow_pawn_promotion, bool allow_castling,
22262226 do {
22272227 ++ki;
22282228
2229- triple<int ,uchar ,Position> t = retro_move_count_checks (move.from , to, board[to], KILLED[ki]);
2229+ triple<int ,uint8_t ,Position> t = retro_move_count_checks (move.from , to, board[to], KILLED[ki]);
22302230
22312231 if (t.first == 0 ) {
22322232 // Undoing this move gives a position for which no move can capture the king.
@@ -2239,21 +2239,21 @@ Board2::get_retro_moves(bool allow_pawn_promotion, bool allow_castling,
22392239 // "own" and "opponent" are relative to the player undoing a move
22402240
22412241 // can't be moved out of do...while loop as it is dependent on ki
2242- uchar adding_own_castling = ADDED_CASTLING[move.from ] &&
2242+ uint8_t adding_own_castling = ADDED_CASTLING[move.from ] &&
22432243 ((1 << (ADDED_CASTLING[move.from ] & 0x0F )) & allowed_transformations & ALLOWED_T[ki]) &&
22442244 ((KING_CASTLING_POSITIONS[move.from ] && PIECE_KIND[board[to]]==KING) ||
22452245 (!KING_CASTLING_POSITIONS[move.from ] && PIECE_KIND[board[to]]==ROOK));
2246- uchar own_castling_transf = 0 ;
2246+ uint8_t own_castling_transf = 0 ;
22472247 if (adding_own_castling) {
22482248 adding_own_castling = ADDED_CASTLING[move.from ] & 0xF0 ;
22492249 // cerr << "adding_own_castling = " << adding_own_castling << "\n";
22502250 own_castling_transf = ADDED_CASTLING[move.from ] & 0x0F ;
22512251 }
22522252
2253- uchar adding_opponent_castling = ADDED_CASTLING[move.to ] &&
2253+ uint8_t adding_opponent_castling = ADDED_CASTLING[move.to ] &&
22542254 PIECE_KIND[KILLED[ki]]==ROOK &&
22552255 ((1 << (ADDED_CASTLING[move.to ] & 0x0F )) & allowed_transformations & ALLOWED_T[ki]);
2256- uchar opponent_castling_transf = 0 ;
2256+ uint8_t opponent_castling_transf = 0 ;
22572257 if (adding_opponent_castling) {
22582258 adding_opponent_castling = ADDED_CASTLING[move.to ] & 0xF0 ;
22592259 opponent_castling_transf = ADDED_CASTLING[move.to ] & 0x0F ;
@@ -2441,15 +2441,15 @@ Board2::get_retro_moves(bool allow_pawn_promotion, bool allow_castling,
24412441 if ((kill!=0 ) == diagonal_move) {
24422442
24432443 // Beware!, do not use move, but instead to,from
2444- uchar adding_opponent_castling = ADDED_CASTLING[to] &&
2444+ uint8_t adding_opponent_castling = ADDED_CASTLING[to] &&
24452445 PIECE_KIND[kill]==ROOK && (ADDED_CASTLING[to] & 0x0F ) == t;
24462446 if (adding_opponent_castling)
24472447 adding_opponent_castling = ADDED_CASTLING[to] & 0xF0 ;
24482448
24492449
24502450 Piece pawns[2 ][4 ] = {{BPAWN, WPAWN, FILE_H_TO_A_PAWN, FILE_A_TO_H_PAWN},
24512451 {WPAWN, BPAWN, FILE_A_TO_H_PAWN, FILE_H_TO_A_PAWN}};
2452- triple<int ,uchar ,Position> tr = retro_move_count_checks (from, to, pawns[player][r], kill);
2452+ triple<int ,uint8_t ,Position> tr = retro_move_count_checks (from, to, pawns[player][r], kill);
24532453 if (t && tr.third !=ILLEGAL_POS)
24542454 tr.third = reflect (tr.third , t);
24552455
@@ -2521,7 +2521,7 @@ Board2::get_retro_moves(bool allow_pawn_promotion, bool allow_castling,
25212521 0 ,58 ,0 ,0 ,0 ,0 ,61 ,0
25222522 }};
25232523
2524- const uchar UNDONE_CASTLING[64 ] =
2524+ const uint8_t UNDONE_CASTLING[64 ] =
25252525 { 0 ,BLACK_SHORT_CASTLING,BLACK_LONG_CASTLING,0 ,0 ,BLACK_LONG_CASTLING,BLACK_SHORT_CASTLING,0 ,
25262526 BLACK_SHORT_CASTLING,0 ,0 ,0 ,0 ,0 ,0 ,BLACK_SHORT_CASTLING,
25272527 BLACK_LONG_CASTLING,0 ,0 ,0 ,0 ,0 ,0 ,BLACK_LONG_CASTLING,
@@ -2562,7 +2562,7 @@ Board2::get_retro_moves(bool allow_pawn_promotion, bool allow_castling,
25622562
25632563 if (!king_checked) {
25642564 // Move rook
2565- triple<int ,uchar ,Position> t = retro_move_count_checks (rook_move.from , rook_move.to ,
2565+ triple<int ,uint8_t ,Position> t = retro_move_count_checks (rook_move.from , rook_move.to ,
25662566 board[rook_move.to ], 0 );
25672567
25682568 if (t.first == 0 ) {
@@ -2574,7 +2574,7 @@ Board2::get_retro_moves(bool allow_pawn_promotion, bool allow_castling,
25742574
25752575 int transf = KING_REFLECTIONS[player^1 ][king_move.from ];
25762576
2577- uchar adding_own_castling = ADDED_CASTLING[king_move.from ] & 0xF0 ;
2577+ uint8_t adding_own_castling = ADDED_CASTLING[king_move.from ] & 0xF0 ;
25782578
25792579 for (uint i=0 ; i<ep_possibilities.size (); i++) {
25802580 if (ep_possibilities[i].accepted (rook_move.from , rook_move.to , undo.en_passant , 0 )) {
0 commit comments