in the isAttacked(BitMap &targetBitmap, const unsigned char &fromSide) function, commenting
Code: Select all
//if (slidingAttackers)
Moderators: hgm, Rebel, chrisw
Code: Select all
//if (slidingAttackers)
I did verify this using macro's for the moves on my machine, without improvement. So I think my compiler (option /O2, max speed) is inlining. These functions are just 1 line of bitmasking & shifting.elcabesa wrote: besides that i'm playing with your code to make it run faster. With my compiler (gcc) i got a big boost modifying move.c and move.h, setting all the move.h function (e.g. setFrom etc..) to inline gave me a +50%boost.
the original code took on my pc 29 seconds to compute perft 6, while the modified one took only 20 seconds. (maybe your compiler already set them inline automatically and you'll got no boost at all)
A big problem for your code to be fast is the fact you use a lot of "if" and "switch", I still don't know how to solve the problem, ( i'll dig inside it next days) ,but for example Stockfish has not a bitmap for every piece ( whiteking, white rook, etc,) instead it has a bitmap array indexed by piece type, this should remove a lot of if in you code!
I'm very interested in you code, and i'm learning a lot from it, good luck[/code]