Fixed various VS warnings
authorClifford Wolf <clifford@clifford.at>
Sat, 18 Oct 2014 13:20:38 +0000 (15:20 +0200)
committerClifford Wolf <clifford@clifford.at>
Sat, 18 Oct 2014 13:20:38 +0000 (15:20 +0200)
frontends/ast/simplify.cc
kernel/log.cc
kernel/rtlil.cc
kernel/yosys.cc
libs/ezsat/ezsat.cc
passes/opt/opt_clean.cc
passes/opt/share.cc
passes/techmap/dfflibmap.cc

index 70976b68b02c9e72f4bf835e658b381fa1814844..e2d63de606325b94e00088eb9c1cb74f3b3e86eb 100644 (file)
@@ -2457,7 +2457,7 @@ AstNode *AstNode::eval_const_function(AstNode *fcall)
        }
 
        log_assert(block != NULL);
-       log_assert(variables.count(str));
+       log_assert(variables.count(str) != 0);
 
        while (!block->children.empty())
        {
index 19eb38c736db1f5002ad156cd1d31618e3d5ca92..807f58bf606d545ac1ea170cdb3dab5ff34a993d 100644 (file)
@@ -64,7 +64,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz)
        counter.QuadPart *= 1000000;
        counter.QuadPart /= freq.QuadPart;
 
-       tv->tv_sec = counter.QuadPart / 1000000;
+       tv->tv_sec = long(counter.QuadPart / 1000000);
        tv->tv_usec = counter.QuadPart % 1000000;
 
        return 0;
index 36443c5ac81944dffec0f9e06556badf180136b5..1a9eb4d14c0486b8a6d04343577c2d808f84cc79 100644 (file)
@@ -1778,7 +1778,7 @@ const std::map<RTLIL::IdString, RTLIL::SigSpec> &RTLIL::Cell::connections() cons
 
 bool RTLIL::Cell::hasParam(RTLIL::IdString paramname) const
 {
-       return parameters.count(paramname);
+       return parameters.count(paramname) != 0;
 }
 
 void RTLIL::Cell::unsetParam(RTLIL::IdString paramname)
@@ -3041,7 +3041,7 @@ bool RTLIL::SigSpec::parse_rhs(const RTLIL::SigSpec &lhs, RTLIL::SigSpec &sig, R
 
        if (lhs.chunks_.size() == 1) {
                char *p = (char*)str.c_str(), *endptr;
-               long long int val = strtoll(p, &endptr, 10);
+               long int val = strtol(p, &endptr, 10);
                if (endptr && endptr != p && *endptr == 0) {
                        sig = RTLIL::SigSpec(val, lhs.width_);
                        cover("kernel.rtlil.sigspec.parse.rhs_dec");
index 7d1d273cbf323af15afce54e8e0689f60d20a040..f314f546a68277dd98e02d6d26ea46e6e5c19ada 100644 (file)
@@ -231,7 +231,7 @@ std::string make_temp_file(std::string template_str)
        while (1) {
                for (int i = 0; i < 6; i++) {
                        static std::string y = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
-                       static uint32_t x = 314159265 ^ time(NULL);
+                       static uint32_t x = 314159265 ^ uint32_t(time(NULL));
                        x ^= x << 13, x ^= x >> 17, x ^= x << 5;
                        template_str[pos+i] = y[x % y.size()];
                }
index 657bed9d250c30ae99167e89a04b37af58b967df..b713c4c91e34180e4d8fd49fde866a6ef2a0a08f 100644 (file)
@@ -1118,7 +1118,7 @@ int64_t ezSAT::vec_model_get_signed(const std::vector<int> &modelExpressions, co
        for (int i = 0; i < 64; i++) {
                int j = i < int(vec1.size()) ? i : vec1.size()-1;
                if (modelMap.at(vec1[j]))
-                       value |= 1 << i;
+                       value |= int64_t(1) << i;
        }
        return value;
 }
@@ -1132,7 +1132,7 @@ uint64_t ezSAT::vec_model_get_unsigned(const std::vector<int> &modelExpressions,
                modelMap[modelExpressions[i]] = modelValues[i];
        for (int i = 0; i < int(vec1.size()); i++)
                if (modelMap.at(vec1[i]))
-                       value |= 1 << i;
+                       value |= uint64_t(1) << i;
        return value;
 }
 
index 4194f88c3d6d4c5118578b629bed539dc98d271a..8a20898cfb54ef2c0308cbe1b8a99977c4c1073d 100644 (file)
@@ -112,7 +112,7 @@ bool compare_signals(RTLIL::SigBit &s1, RTLIL::SigBit &s2, SigPool &regs, SigPoo
                if (regs.check_any(s1) != regs.check_any(s2))
                        return regs.check_any(s2);
                if (direct_wires.count(w1) != direct_wires.count(w2))
-                       return direct_wires.count(w2);
+                       return direct_wires.count(w2) != 0;
                if (conns.check_any(s1) != conns.check_any(s2))
                        return conns.check_any(s2);
        }
index 354586937123c530696607a7ec2c707a27eef82f..2496f15d32ab2389271adc90260143c19fe0ca1e 100644 (file)
@@ -747,7 +747,7 @@ struct ShareWorker
                                forbidden_controls_cache[cell].insert(bits.begin(), bits.end());
                        }
 
-               log_assert(recursion_state.count(cell));
+               log_assert(recursion_state.count(cell) != 0);
                recursion_state.erase(cell);
 
                return forbidden_controls_cache[cell];
@@ -862,7 +862,7 @@ struct ShareWorker
                        activation_patterns_cache[cell].insert(c_patterns.begin(), c_patterns.end());
                }
 
-               log_assert(recursion_state.count(cell));
+               log_assert(recursion_state.count(cell) != 0);
                recursion_state.erase(cell);
 
                optimize_activation_patterns(activation_patterns_cache[cell]);
index 510dcd60b38f89577a2508cdc44af0ec4b981805..a02eafb96ffc2fc8f4f0718498276b192ee2123d 100644 (file)
@@ -108,7 +108,7 @@ static void find_cell(LibertyAst *ast, std::string cell_type, bool clkpol, bool
        LibertyAst *best_cell = NULL;
        std::map<std::string, char> best_cell_ports;
        int best_cell_pins = 0;
-       float best_cell_area = 0;
+       double best_cell_area = 0;
 
        if (ast->id != "library")
                log_error("Format error in liberty file.\n");
@@ -144,7 +144,7 @@ static void find_cell(LibertyAst *ast, std::string cell_type, bool clkpol, bool
                        this_cell_ports[cell_rst_pin] = 'R';
                this_cell_ports[cell_next_pin] = 'D';
 
-               float area = 0;
+               double area = 0;
                LibertyAst *ar = cell->find("area");
                if (ar != NULL && !ar->value.empty())
                        area = atof(ar->value.c_str());
@@ -204,7 +204,7 @@ static void find_cell_sr(LibertyAst *ast, std::string cell_type, bool clkpol, bo
        LibertyAst *best_cell = NULL;
        std::map<std::string, char> best_cell_ports;
        int best_cell_pins = 0;
-       float best_cell_area = 0;
+       double best_cell_area = 0;
 
        if (ast->id != "library")
                log_error("Format error in liberty file.\n");
@@ -236,7 +236,7 @@ static void find_cell_sr(LibertyAst *ast, std::string cell_type, bool clkpol, bo
                this_cell_ports[cell_clr_pin] = 'R';
                this_cell_ports[cell_next_pin] = 'D';
 
-               float area = 0;
+               double area = 0;
                LibertyAst *ar = cell->find("area");
                if (ar != NULL && !ar->value.empty())
                        area = atof(ar->value.c_str());