Rename PTR_PTR_UNMAKE

This commit is contained in:
Quinten Kock 2020-06-15 20:27:51 +02:00
parent 3797e28c5b
commit fa18fa6a98
1 changed files with 10 additions and 9 deletions

19
Board.h
View File

@ -42,7 +42,7 @@ class Board {
}; };
const byte PTR_SIDE_AND_CASTLERIGHT = 0x08; //byte (1=side, 2,4=white castle, 8,16=black) const byte PTR_SIDE_AND_CASTLERIGHT = 0x08; //byte (1=side, 2,4=white castle, 8,16=black)
const byte PTR_PTR_REVMOV = 0x09; //byte (points to index) const byte PTR_PTR_UNMAKE = 0x09; //byte (points to index)
const byte PTR_W_KING = 0x0A; // byte (points to index or maybe 64-arr index) const byte PTR_W_KING = 0x0A; // byte (points to index or maybe 64-arr index)
// const byte PTR_B_KING = 0x0B; (PTR_W_KING | COLOR or PTR_W_KING + COLOR) // const byte PTR_B_KING = 0x0B; (PTR_W_KING | COLOR or PTR_W_KING + COLOR)
const byte PTR_ZOBRIST = 0x0C; // 4 bytes const byte PTR_ZOBRIST = 0x0C; // 4 bytes
@ -51,31 +51,32 @@ class Board {
// 0x0F // 0x0F
const byte PTR_ENPASSANT = 0x18; const byte PTR_ENPASSANT = 0x18;
const byte PTR_REVMOV = 0x19;
const byte PTR_UNMAKE_START = 0x1A; const byte PTR_UNMAKE_START = 0x28;
const byte PTR_UNMAKE_LAST = 0x7F; const byte PTR_UNMAKE_LAST = 0x7F;
inline byte get_unmake() __attribute__((always_inline)) { inline byte get_unmake() __attribute__((always_inline)) {
return field[PTR_PTR_REVMOV]; return field[PTR_PTR_UNMAKE];
} }
byte next_unmake() { byte next_unmake() {
field[PTR_PTR_REVMOV]++; field[PTR_PTR_UNMAKE]++;
if(get_unmake() > PTR_UNMAKE_LAST) { if(get_unmake() > PTR_UNMAKE_LAST) {
field[PTR_PTR_REVMOV] = PTR_UNMAKE_START; field[PTR_PTR_UNMAKE] = PTR_UNMAKE_START;
return PTR_UNMAKE_START; return PTR_UNMAKE_START;
} }
if(!(get_unmake() & 0x8)) { if(!(get_unmake() & 0x8)) {
field[PTR_PTR_REVMOV] += 0x8; field[PTR_PTR_UNMAKE] += 0x8;
} }
return get_unmake(); return get_unmake();
} }
byte prev_unmake() { byte prev_unmake() {
field[PTR_PTR_REVMOV]--; field[PTR_PTR_UNMAKE]--;
if(get_unmake() < PTR_UNMAKE_START) { if(get_unmake() < PTR_UNMAKE_START) {
field[PTR_PTR_REVMOV] = PTR_UNMAKE_LAST; field[PTR_PTR_UNMAKE] = PTR_UNMAKE_LAST;
return PTR_UNMAKE_LAST; return PTR_UNMAKE_LAST;
} }
if(!(get_unmake() & 0x8)) { if(!(get_unmake() & 0x8)) {
field[PTR_PTR_REVMOV] -= 0x8; field[PTR_PTR_UNMAKE] -= 0x8;
} }
return get_unmake(); return get_unmake();
} }