Ignore:
Timestamp:
Feb 19, 2015, 1:53:09 PM (5 years ago)
Author:
nmedfort
Message:

Added vector support for If defined vars back.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.cpp

    r4437 r4511  
    167167    }
    168168
    169     //Reduce the list so that all of the expressions are contained within a single expression.
    170     while (bit_terms.size() > 1)
    171     {
    172         std::vector<PabloAST*> new_terms;
    173         for (auto i = 0; i < (bit_terms.size()/2); i++)
    174         {
    175             new_terms.push_back(pb.createAnd(bit_terms[(2 * i) + 1], bit_terms[2 * i]));
    176         }
    177         if (bit_terms.size() % 2 == 1)
    178         {
    179             new_terms.push_back(bit_terms[bit_terms.size() -1]);
    180         }
    181         bit_terms.swap(new_terms);
     169    if (bit_terms.size() > 1) {
     170        //Reduce the list so that all of the expressions are contained within a single expression.
     171        std::vector<PabloAST*> new_terms(bit_terms.size() / 2);
     172        do
     173        {
     174            new_terms.clear();
     175            for (auto i = 0; i < (bit_terms.size() / 2); i++) {
     176                new_terms.push_back(pb.createAnd(bit_terms[(2 * i) + 1], bit_terms[2 * i]));
     177            }
     178            if (bit_terms.size() % 2 == 1) {
     179                new_terms.push_back(bit_terms[bit_terms.size() - 1]);
     180            }
     181            bit_terms.swap(new_terms);
     182        }
     183        while (bit_terms.size() > 1);
    182184    }
    183185    return bit_terms[0];
Note: See TracChangeset for help on using the changeset viewer.