Apply small optimizations.
[genetic.git] / src / fitness / wsti.h
index 1724936e83fb2e4121b5313ca672603480e4ab33..7021f590824665b9f22dcf963704240f7c22bf31 100644 (file)
@@ -34,7 +34,9 @@ namespace genetic {
         _Value fenotype() {
             int _fenotype = 0;
             int ratio = 1;
-            for (unsigned int i = 0; i < this->chromosome.size(); i++) {
+            unsigned int chromosomeSize = this->chromosome.size();
+
+            for (unsigned int i = 0; i < chromosomeSize; i++) {
                 _fenotype = _fenotype + this->chromosome[i].get() * ratio;
                 ratio = ratio * 2;
             }