Signed-off-by: Marco Costalba <mcostalba@gmail.com>
+int bitScanReverse32(uint32_t b)
+{
+ int result = 0;
+
+ if (b > 0xFFFF) {
+ b >>= 16;
+ result += 16;
+ }
+ if (b > 0xFF) {
+ b >>= 8;
+ result += 8;
+ }
+ if (b > 0xF) {
+ b >>= 4;
+ result += 4;
+ }
+ if (b > 0x3) {
+ b >>= 2;
+ result += 2;
+ }
+ return result + (b > 0) + (b > 1);
+}
+
namespace {
// All functions below are used to precompute various bitboards during
namespace {
// All functions below are used to precompute various bitboards during
extern void print_bitboard(Bitboard b);
extern void init_bitboards();
extern void print_bitboard(Bitboard b);
extern void init_bitboards();
+extern int bitScanReverse32(uint32_t b);
#endif // !defined(BITBOARD_H_INCLUDED)
#endif // !defined(BITBOARD_H_INCLUDED)
{
//std::cout << std::endl;
//for (int d = 2; d < 14; d++)
{
//std::cout << std::endl;
//for (int d = 2; d < 14; d++)
- // std::cout << d << ", " << 300 + 2*(1 << (3*d/4)) << std::endl;
+ // std::cout << d << ", " << 64*(1+bitScanReverse32(d*d)) << std::endl;
//std::cout << std::endl;
/*
//std::cout << std::endl;
/*
+ 64*(1+bitScanReverse32(d*d))
+
+ 2 -> 256 - 256
+ 3 -> 288 - 320
+ 4 -> 512 - 384
+ 5 -> 544 - 384
+ 6 -> 592 - 448
+ 7 -> 624 - 448
+ 8 -> 672 - 512
+ 9 -> 704 - 512
+ 10 -> 832 - 512
+ 11 -> 864 - 512
+ 12 -> 928 - 576
+ 13 -> 960 - 576
+
300 + 2*(1 << (3*d/4))
2 -> 256 - 304
300 + 2*(1 << (3*d/4))
2 -> 256 - 304
{
if (futilityValue == VALUE_NONE)
futilityValue = evaluate(pos, ei, threadID)
{
if (futilityValue == VALUE_NONE)
futilityValue = evaluate(pos, ei, threadID)
- + (300 + 2 * (1 << (3 * int(depth) /4)))
+ + 64*(1+bitScanReverse32(int(depth) * int(depth)))
+ 4*IncrementalFutilityMargin;
futilityValueScaled = futilityValue - moveCount * IncrementalFutilityMargin;
+ 4*IncrementalFutilityMargin;
futilityValueScaled = futilityValue - moveCount * IncrementalFutilityMargin;