I think there is something wrong (but harmless with the compilers we've
used) in these functions from positionid.c.
In PositionBearoff() for instance :
for( j = nPoints - 1, i = 0; i < nPoints; i++ )
j += anBoard[ i ];
fBits = 1u << j;
for( i = 0; i < nPoints; i++ ) {
j -= anBoard[ i ] + 1;
fBits |= ( 1u << j );
}
the last "1u << j" is always 1u << (-1) which is undefined (and apparently
happens to end as 1<<31) : start with nPoints - 1, count checkers on
the lower nPoints then substract (checkers+1) for each of nPoints.
I don't really understand what the index thus calculated means, but
setting the bit at the other end of fBits is probably not what is intended
and the way it is done is unsound anyway.
The code in PositionIndex() is almost identical.
Doing one less loop with
for( i = 0; i < nPoints - 1; i++ )
gives the same result in gnubg since apparently fBits is only used in some
masking with values smaller than 2^31. I didn't look at what happens with
the bearoff database building commands.
Could someone who understand this part of the code confirm that this is
the right thing to do or suggest a proper fix ?
_______________________________________________
Bug-gnubg mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-gnubg