Chess Engine
C++ chess engine with movegen, bitboards, and Arduino-friendly docs
Loading...
Searching...
No Matches
bitboard.h File Reference
#include "../defs.h"
Include dependency graph for bitboard.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define POP(b)
#define CNT(b)

Functions

int popLSB (U64 *bb)
 Pops the least significant 1-bit from a bitboard and returns its index (0–63).
int countSetBits (U64 b)
 Counts the number of 1-bits in a bitboard.
void printBitBoard (U64 bb)
 Prints a visual representation of a bitboard to stdout.

Variables

const int BitTable [64]
 Lookup table for bit index extraction.

Macro Definition Documentation

◆ CNT

#define CNT ( b)
Value:
int countSetBits(U64 b)
Counts the number of 1-bits in a bitboard.
Definition bitboards.cpp:21

Definition at line 6 of file bitboard.h.

Referenced by isBoardStateValid().

◆ POP

#define POP ( b)
Value:
int popLSB(U64 *bb)
Pops the least significant 1-bit from a bitboard and returns its index (0–63).
Definition bitboards.cpp:14

Definition at line 5 of file bitboard.h.

Referenced by isBoardStateValid().

Function Documentation

◆ countSetBits()

int countSetBits ( U64 b)
extern

Counts the number of 1-bits in a bitboard.

Parameters
bBitboard value.
Returns
Number of set bits.

Definition at line 21 of file bitboards.cpp.

◆ popLSB()

int popLSB ( U64 * bb)
extern

Pops the least significant 1-bit from a bitboard and returns its index (0–63).

Parameters
bbPointer to the bitboard to modify.
Returns
Index (0–63) of the popped bit.

Definition at line 14 of file bitboards.cpp.

References BitTable.

◆ printBitBoard()

void printBitBoard ( U64 bb)
extern

Prints a visual representation of a bitboard to stdout.

'X' marks set bits, '-' marks unset bits.

Parameters
bbBitboard to print.

Definition at line 27 of file bitboards.cpp.

References FILE_A, FILE_H, FR2SQ, RANK_1, RANK_8, and SQ64.

Variable Documentation

◆ BitTable

const int BitTable[64]
extern

Lookup table for bit index extraction.

Definition at line 7 of file bitboards.cpp.

Referenced by popLSB().