position: use XOR in square clr/set, for castling flags to 8 bits

This commit is contained in:
2024-09-11 08:14:55 +02:00
parent 9dd7c7064d
commit 8bf4262e11
5 changed files with 39 additions and 23 deletions

View File

@@ -51,7 +51,7 @@
/* castle_t bits structure
*/
typedef enum {
enum {
CASTLE_NONE = 0,
CASTLE_WK = (1 << 0), /* 0001 */
CASTLE_WQ = (1 << 1), /* 0010 */
@@ -65,7 +65,9 @@ typedef enum {
CASTLE_K = (1 << 0), /* generic K/Q, bits 0 and 1 */
CASTLE_Q = (1 << 1),
CASTLE_KQ = (CASTLE_K |CASTLE_Q),
} castle_rights_t;
};
typedef u8 castle_rights_t;
/* determine is oo or ooo is possible with castle flags f and color c
*/