init_eval: small cleanup
authorMarco Costalba <mcostalba@gmail.com>
Mon, 22 Sep 2008 11:22:36 +0000 (13:22 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 23 Sep 2008 06:07:50 +0000 (08:07 +0200)
Functionality not changed.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/evaluate.cpp

index bf02fc81f319025c3905da95f44d2266920c83be..12542af09f5b63cdb1f25c29344596a331a22f19 100644 (file)
@@ -501,27 +501,27 @@ Value quick_evaluate(const Position &pos) {
 /// init_eval() initializes various tables used by the evaluation function.
 
 void init_eval(int threads) {
+
   assert(threads <= THREAD_MAX);
-  
-  for(int i = 0; i < threads; i++) {
-    if(PawnTable[i] == NULL)
-      PawnTable[i] = new PawnInfoTable(PawnTableSize);
-    if(MaterialTable[i] == NULL)
-      MaterialTable[i] = new MaterialInfoTable(MaterialTableSize);
-  }
-  for(int i = threads; i < THREAD_MAX; i++) {
-    if(PawnTable[i] != NULL) {
-      delete PawnTable[i];
-      PawnTable[i] = NULL;
-    }
-    if(MaterialTable[i] != NULL) {
-      delete MaterialTable[i];
-      MaterialTable[i] = NULL;
+
+  for (int i = 0; i < THREAD_MAX; i++)
+  {
+    if (i >= threads)
+    {
+        delete PawnTable[i];
+        delete MaterialTable[i];
+        PawnTable[i] = NULL;
+        MaterialTable[i] = NULL;
+        continue;
     }
+    if (!PawnTable[i])
+        PawnTable[i] = new PawnInfoTable(PawnTableSize);
+    if (!MaterialTable[i])
+        MaterialTable[i] = new MaterialInfoTable(MaterialTableSize);
   }
 
-  for(Bitboard b = 0ULL; b < 256ULL; b++)
-    BitCount8Bit[b] = count_1s(b);
+  for (Bitboard b = 0ULL; b < 256ULL; b++)
+      BitCount8Bit[b] = count_1s(b);
 }