I am making a chess engine, and for now I’m working on the move generation. I’m using bitboards, and so for example my magic bit boards file for a knight on d4 is
0000000000000000
00101000
01000100
000N0000
01000100
00101000
00000000
Which is represented by some unsigned long long integer.
I need this in a format where I can store the moves in a move list, and also make the move. E.g. {10,12,17,21,33,37,42,44}
What would be the fastest way to get the indices of the “1” bits in the bitboard during runtime? Currently I isolate the least significant 1 bit with x &= -x, and then XOR the position until I get 0. But is there a faster way to do this?