Fixed some visual studio warnings
authorClifford Wolf <clifford@clifford.at>
Sat, 13 Feb 2016 16:31:24 +0000 (17:31 +0100)
committerClifford Wolf <clifford@clifford.at>
Sat, 13 Feb 2016 16:31:24 +0000 (17:31 +0100)
frontends/ast/ast.cc
frontends/ast/genrtlil.cc
frontends/ast/simplify.cc
kernel/hashlib.h
kernel/modtools.h
kernel/yosys.cc
passes/memory/memory_dff.cc
passes/techmap/techmap.cc

index 3e163bae799ca649dfb3980fe2d09f2e9d81a741..834ee82ab7217cbefe10d9d3ff8b6ed4c64327ee 100644 (file)
@@ -820,7 +820,7 @@ uint64_t AstNode::asInt(bool is_signed)
        }
 
        if (type == AST_REALVALUE)
-               return realvalue;
+               return uint64_t(realvalue);
 
        log_abort();
 }
index 876bfbe3d656eb54b87c75871852e822dde318c6..9fc5903761bc6955686af06173f59323c4112dfa 100644 (file)
@@ -1257,7 +1257,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
                        if (type == AST_MEMINIT) {
                                if (children[2]->type != AST_CONSTANT)
                                        log_error("Memory init with non-constant word count at %s:%d!\n", filename.c_str(), linenum);
-                               num_words = children[2]->asInt(false);
+                               num_words = int(children[2]->asInt(false));
                                cell->parameters["\\WORDS"] = RTLIL::Const(num_words);
                        }
 
index 2264d896a06bff1c73d9c3bb989898b8a75a14ee..2621be4907cf06090c0822744938f3f2a8e3c2c8 100644 (file)
@@ -1705,7 +1705,7 @@ skip_dynamic_range_lvalue_expansion:;
                                        while (node_addr->simplify(true, false, false, stage, width_hint, sign_hint, false)) { }
                                        if (node_addr->type != AST_CONSTANT)
                                                log_error("Failed to evaluate system function `%s' with non-constant 3rd argument at %s:%d.\n", str.c_str(), filename.c_str(), linenum);
-                                       start_addr = node_addr->asInt(false);
+                                       start_addr = int(node_addr->asInt(false));
                                }
 
                                if (GetSize(children) > 3) {
@@ -1713,7 +1713,7 @@ skip_dynamic_range_lvalue_expansion:;
                                        while (node_addr->simplify(true, false, false, stage, width_hint, sign_hint, false)) { }
                                        if (node_addr->type != AST_CONSTANT)
                                                log_error("Failed to evaluate system function `%s' with non-constant 4th argument at %s:%d.\n", str.c_str(), filename.c_str(), linenum);
-                                       finish_addr = node_addr->asInt(false);
+                                       finish_addr = int(node_addr->asInt(false));
                                }
 
                                bool unconditional_init = false;
index a31c62e5661e167cf87387b244f386678510a3ab..972a8b8d827014026dd31cf837fd62d91a86476d 100644 (file)
@@ -74,7 +74,7 @@ template<> struct hash_ops<int32_t> : hash_int_ops
 template<> struct hash_ops<int64_t> : hash_int_ops
 {
        static inline unsigned int hash(int64_t a) {
-               return mkhash(a, a >> 32);
+               return mkhash((unsigned int)(a), (unsigned int)(a >> 32));
        }
 };
 
index 1480ec71fdef4391123f332b30c4dd0129e74ba6..ffcb48d441c87f71c70b84a7dc43bd898d8e91b9 100644 (file)
@@ -180,8 +180,8 @@ struct ModIndex : public RTLIL::Monitor
                {
                        RTLIL::SigBit lhs = sigmap(sigsig.first[i]);
                        RTLIL::SigBit rhs = sigmap(sigsig.second[i]);
-                       bool has_lhs = database.count(lhs);
-                       bool has_rhs = database.count(rhs);
+                       bool has_lhs = database.count(lhs) != 0;
+                       bool has_rhs = database.count(rhs) != 0;
 
                        if (!has_lhs && !has_rhs) {
                                sigmap.add(lhs, rhs);
index 4bfbe36140b914330e674c071d02781af949e397..8590242dcdec79354aff9647eb06db4518912dd7 100644 (file)
@@ -193,7 +193,7 @@ std::string vstringf(const char *fmt, va_list ap)
 
 int readsome(std::istream &f, char *s, int n)
 {
-       int rc = f.readsome(s, n);
+       int rc = int(f.readsome(s, n));
 
        // f.readsome() sometimes returns 0 on a non-empty stream..
        if (rc == 0) {
index 2eec0207b9315f99ea53120940e98f5a8d44a234..beb2016a9ab2d1914fe1061f146de3b24761109f 100644 (file)
@@ -164,7 +164,7 @@ struct MemoryDffWorker
 
                if (mux_cells_a.count(sig_data) || mux_cells_b.count(sig_data))
                {
-                       bool enable_invert = mux_cells_a.count(sig_data);
+                       bool enable_invert = mux_cells_a.count(sig_data) != 0;
                        Cell *mux = enable_invert ? mux_cells_a.at(sig_data) : mux_cells_b.at(sig_data);
                        SigSpec check_q = sigmap(mux->getPort(enable_invert ? "\\B" : "\\A"));
 
index 19b2bda9cbafa7426e945f4f8844c4e2f9e7ce5a..5334ebfaf9bd07cd91fce52eb0e8a290416cbdde 100644 (file)
@@ -313,7 +313,7 @@ struct TechmapWorker
 
                        if (c->type == "$memrd" || c->type == "$memwr" || c->type == "$meminit") {
                                IdString memid = c->getParam("\\MEMID").decode_string();
-                               log_assert(memory_renames.count(memid));
+                               log_assert(memory_renames.count(memid) != 0);
                                c->setParam("\\MEMID", Const(memory_renames[memid].str()));
                        }