I'm afraid it's nowhere near as sophisticated.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 using plain old C (hoping its performance would be acceptable

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