EXPERIMENTAL: custom peer collector
[novacoin.git] / src / bignum.h
index 3570840..4bda99d 100644 (file)
@@ -188,7 +188,7 @@ public:
         pch[1] = (nSize >> 16) & 0xff;
         pch[2] = (nSize >> 8) & 0xff;
         pch[3] = (nSize) & 0xff;
-        BN_mpi2bn(pch, p - pch, this);
+        BN_mpi2bn(pch, (int)(p - pch), this);
     }
 
     uint64_t getuint64()
@@ -206,10 +206,13 @@ public:
         return n;
     }
 
+    //supress msvc C4127: conditional expression is constant
+    inline bool check(bool value) {return value;}
+
     void setuint64(uint64_t n)
     {
         // Use BN_set_word if word size is sufficient for uint64_t
-        if (sizeof(n) <= sizeof(BN_ULONG))
+        if (check(sizeof(n) <= sizeof(BN_ULONG)))
         {
             if (!BN_set_word(this, (BN_ULONG)n))
                 throw bignum_error("CBigNum conversion from uint64_t : BN_set_word failed");