nodestack: make 'iter' signed
authorBrian Norris <banorris@uci.edu>
Thu, 13 Dec 2012 01:57:28 +0000 (17:57 -0800)
committerBrian Norris <banorris@uci.edu>
Thu, 13 Dec 2012 03:36:06 +0000 (19:36 -0800)
iter will need to be negative when we allow the NodeStack to be empty.

nodestack.cc
nodestack.h

index d81dd0c09682cc22b6c79582f1c0fade39938314..091a0f7ff05f173b4ffdf2cbe2cd307232644412 100644 (file)
@@ -513,7 +513,7 @@ void NodeStack::print() const
        model_print("............................................\n");
        model_print("NodeStack printing node_list:\n");
        for (unsigned int it = 0; it < node_list.size(); it++) {
-               if (it == this->iter)
+               if ((int)it == this->iter)
                        model_print("vvv following action is the current iterator vvv\n");
                node_list[it]->print();
        }
@@ -528,7 +528,7 @@ ModelAction * NodeStack::explore_action(ModelAction *act, enabled_type_t *is_ena
 
        ASSERT(!node_list.empty());
 
-       if ((iter + 1) < node_list.size()) {
+       if ((iter + 1) < (int)node_list.size()) {
                iter++;
                return node_list[iter]->get_action();
        }
@@ -536,7 +536,7 @@ ModelAction * NodeStack::explore_action(ModelAction *act, enabled_type_t *is_ena
        /* Record action */
        get_head()->explore_child(act, is_enabled);
        Node *prevfairness = NULL;
-       if (model->params.fairwindow != 0 && iter > model->params.fairwindow)
+       if (model->params.fairwindow != 0 && iter > (int)model->params.fairwindow)
                prevfairness = node_list[iter - model->params.fairwindow];
        node_list.push_back(new Node(act, get_head(), model->get_num_threads(), prevfairness));
        total_nodes++;
index 90d84bd6dea21da0ab677971acdb3893e9609780..4db15fc23706b34e06e75abc1ca7204e430b40dc 100644 (file)
@@ -166,7 +166,14 @@ public:
        MEMALLOC
 private:
        node_list_t node_list;
-       unsigned int iter;
+
+       /**
+        * @brief the index position of the current head Node
+        *
+        * This index is relative to node_list. The index should point to the
+        * current head Node.
+        */
+       int iter;
 
        int total_nodes;
 };