i am testing bitboard generating methods.
The last work i did was experimenting with magic bitboards,
and now some tests on the Hyberbola-Q idea.
So if you look at the return value of the function below,
can someone explain to me why the factor can raise like
in the comments made to the function ?
Can i do something against ?
Code: Select all
#define BB(SQ64) ((BTB)1<<(SQ64))
#define LO64(SQ64) (BB(SQ64)-1)
#define HI64(SQ64) ((bH8-BB(SQ64))<<1)
BTB rook_trial(const BTB occ,const SQR_T sq64)
{
static const BTB cfle = (bR1|bR8);
static const BTB crnk = (bAF|bHF);
static BTB fle,rnk,lo,hi;
//FILE
(lo = LO64(sq64) & (occ|cfle) & msk.msk_file[sq64]) ? lo : lo = BB(sq64);
(hi = HI64(sq64) & (occ|cfle) & msk.msk_file[sq64]) ? hi : hi = BB(sq64);
hi &= -hi;
lo = BB(bsr64(lo));
fle = (((hi<<1)-lo) & msk.msk_file[sq64]);
//RANK
(lo = LO64(sq64) & (occ|crnk) & msk.msk_rank[sq64]) ? lo : lo = BB(sq64);
(hi = HI64(sq64) & (occ|crnk) & msk.msk_rank[sq64]) ? hi : hi = BB(sq64);
hi &= -hi;
lo = BB(bsr64(lo));
rnk = (((hi<<1)-lo) & msk.msk_rank[sq64]);
//return(rnk); //performs factor 1
//return(fle); //performs factor 1
return(fle|rnk); //performs about factor 20...? why not 2 or 3 ???
}
Anyway i would be happy if someone would made some interesting
annotations about the code, so we may discuss some ideas,pros,cons THX
I will also try to ask (edit: haha answer of course) any questions about the code.
(my goal at the moment is to have an acceptable direct computing method, without any lookups)
PS: of course i would be happy if someone tries out, and tells me if the performence is well or not(independent on the "performance problem" i ve descriped above)