]> git.sesse.net Git - stockfish/commitdiff
Merge branch 'master' of git-Stockfish@free2.projectlocker.com:sf
authorMarco Costalba <mcostalba@gmail.com>
Sun, 23 Aug 2009 17:57:11 +0000 (18:57 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 23 Aug 2009 17:57:11 +0000 (18:57 +0100)
src/bitboard.cpp
src/material.cpp

index 9bd16d2f66a96e60be496258ea550fc6bcb6277a..04b46e5d3603f8275ad3643c4385ceab0d286074 100644 (file)
@@ -297,6 +297,7 @@ void init_bitboards() {
 
 #if defined(IS_64BIT) && !defined(USE_BSFQ)
 
+CACHE_LINE_ALIGNMENT
 static const int BitTable[64] = {
   0, 1, 2, 7, 3, 13, 8, 19, 4, 25, 14, 28, 9, 34, 20, 40, 5, 17, 26, 38, 15,
   46, 29, 48, 10, 31, 35, 54, 21, 50, 41, 57, 63, 6, 12, 18, 24, 27, 33, 39,
@@ -316,6 +317,7 @@ Square pop_1st_bit(Bitboard* b) {
 
 #elif !defined(USE_BSFQ)
 
+CACHE_LINE_ALIGNMENT
 static const int BitTable[64] = {
   63, 30, 3, 32, 25, 41, 22, 33, 15, 50, 42, 13, 11, 53, 19, 34, 61, 29, 2,
   51, 21, 43, 45, 10, 18, 47, 1, 54, 9, 57, 0, 35, 62, 31, 40, 4, 49, 5, 52,
@@ -343,23 +345,17 @@ union b_union {
 Square pop_1st_bit(Bitboard* bb) {
 
   b_union u;
-  uint32_t b;
 
   u.b = *bb;
 
   if (u.dw.l)
   {
-      b = u.dw.l;
-      *((uint32_t*)bb) = b & (b - 1);
-      b ^= (b - 1);
+      *((uint32_t*)bb) = u.dw.l & (u.dw.l - 1);
+      return Square(BitTable[((u.dw.l ^ (u.dw.l - 1)) * 0x783a9b23) >> 26]);
   }
-  else
-  {
-      b = u.dw.h;
-      *((uint32_t*)bb+1) = b & (b - 1); // Little endian only?
-      b = ~(b ^ (b - 1));
-  }
-  return Square(BitTable[(b * 0x783a9b23) >> 26]);
+
+  *((uint32_t*)bb+1) = u.dw.h & (u.dw.h - 1); // Little endian only?
+  return Square(BitTable[((~(u.dw.h ^ (u.dw.h - 1))) * 0x783a9b23) >> 26]);
 }
 
 #endif
index cc8e896a143b46c5cea28dcb893a69550451c64b..8532e361e81a3429e30609762b7011c7dde3b7fc 100644 (file)
@@ -40,15 +40,15 @@ namespace {
   // Polynomial material balance parameters
   const Value RedundantQueenPenalty = Value(320);
   const Value RedundantRookPenalty  = Value(554);
-  const int LinearCoefficients[6]   = { 1709, -137, -1185, -166, 141, 59 };
+  const int LinearCoefficients[6]   = { 1617, -162, -1172, -190, 105, 26 };
 
   const int QuadraticCoefficientsSameColor[][6] = {
-  { 0, 0, 0, 0, 0, 0 }, { 33, -6, 0, 0, 0, 0 }, { 29, 269, -12, 0, 0, 0 },
-  { 0, 19, -4, 0, 0, 0 }, { -35, -10, 40, 95, 50, 0 }, { 52, 23, 78, 144, -11, -33 } };
+  { 7, 7, 7, 7, 7, 7 }, { 39, 2, 7, 7, 7, 7 }, { 35, 271, -4, 7, 7, 7 },
+  { 7, 25, 4, 7, 7, 7 }, { -27, -2, 46, 100, 56, 7 }, { 58, 29, 83, 148, -3, -25 } };
 
   const int QuadraticCoefficientsOppositeColor[][6] = {
-  { 0, 0, 0, 0, 0, 0 }, { -5, 0, 0, 0, 0, 0 }, { -33, 23, 0, 0, 0, 0 },
-  { 17, 25, -3, 0, 0, 0 }, { 10, -2, -19, -67, 0, 0 }, { 69, 64, -41, 116, 137, 0 } };
+  { 0, 0, 0, 0, 0, 0 }, { -4, 0, 0, 0, 0, 0 }, { -31, 21, 0, 0, 0, 0 },
+  { 16, 23, -2, 0, 0, 0 }, { 9, -1, -18, -63, 0, 0 }, { 65, 60, -38, 110, 130, 0 } };
 
   // Named endgame evaluation and scaling functions, these
   // are accessed direcly and not through the function maps.