Code optimization in position module
Some constants were defined to avoid code repetition and to avoid to initialize new variables.
Also, some methods were renamed and encapsulated (static) to hide them to the rest of the app.
Performance gain is around 10%.
Code optimization in bitboard module
Bitboard arrays declared as static
There is no real performance gain to inline functions which access to bitboard arrays. So, let the compiler do its job.
Don't need to verify rook presence
Castling rights are already set if a rook moved
Remove position.last_double
change listAdd definition
from_square and to_square are now Square types instead of U64 in order to avoid to call too much bitboard_bitScanForward()
Remove the attacks lookup arrays
Init and reset operations on these arrays were time consuming. The performance gain is around 30%\!
Add SquareAttacked and position_inCheck functions
These function are more optimized than using directly position_attacksTo
Pawn attacks simplification
Create attacks / side arrays
genAttacks() optimization
Inlining listAdd
Move Code refactoring
- Introduce move flags to setup move in one short member.
- Remove unused struct members
- Adapt the size of the Move Struct to 16 Bytes (power of 2 optimization)
- Cleanup code in other modules.
Code cleanup
Clarifying king moves on the opposite attacking ray
Enpassant capture optimization in check evasion
Fix undo promotion move bug
Refactor move generation loop
Rewrite POS_MOVE_PIECE macro
Castling rights check optimization