Faster Movelist in Mailslot Engines?

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
leanchess
Posts: 181
Joined: Sun Dec 08, 2019 8:16 pm
Full name: Dmitry Shechtman

Re: Faster Movelist in Mailslot Engines?

Post by leanchess »

dangi12012 wrote: Sun Dec 05, 2021 5:46 pm Ahhh I may get it now. You are not using the bitfields inside if statements. You are using the 16 bit value table as a direct jumptable?
Thats nice.

There are so many possibilities there. You can write your code normally - but replace all if with constexpr if statements and then you have a template generate all 2^16 possibilities and put them into a function pointer table (i think a few bits are not needed)

That would make castling, enpessant, promotion an instant inlineable operation without branches.
I'm afraid it's nowhere near as sophisticated.

I'm using plain old C (hoping its performance would be acceptable :mrgreen:). make/unmake expect all the fields to be prepopulated, so if it's a castling move, its prim must already contain the king's from/to and sec the rook's from/to (or vice versa, as they are completely oblivious).

Edit: I believe I solved the capture/promotion collision. In the case of promotion sec.to must be swapped with prim.to.