diff options
author | git <[email protected]> | 2015-04-08 04:04:55 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2015-04-08 04:04:55 +0000 |
commit | 62947773cedb0c9534c5df91271db9a9414e6e2a (patch) | |
tree | b1a891aca42784136ed58e0d0b90c81159caf0f6 | |
parent | 4eccc8f01e9ce6ce72b90731dc72cb30d383f0aa (diff) |
Fix code that triggers a strange MSVC 'performance warning'
Github pull 74 from Chris Desjardins
-rw-r--r-- | src/lib/cert/x509/x509cert.cpp | 2 | ||||
-rw-r--r-- | src/lib/mac/cmac/cmac.cpp | 2 | ||||
-rw-r--r-- | src/lib/modes/xts/xts.cpp | 4 | ||||
-rw-r--r-- | src/lib/utils/assert.h | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/cert/x509/x509cert.cpp b/src/lib/cert/x509/x509cert.cpp index b04e7c462..195af7730 100644 --- a/src/lib/cert/x509/x509cert.cpp +++ b/src/lib/cert/x509/x509cert.cpp @@ -232,7 +232,7 @@ bool X509_Certificate::allowed_usage(Key_Constraints usage) const { if(constraints() == NO_CONSTRAINTS) return true; - return (constraints() & usage); + return ((constraints() & usage) != 0); } bool X509_Certificate::allowed_usage(const std::string& usage) const diff --git a/src/lib/mac/cmac/cmac.cpp b/src/lib/mac/cmac/cmac.cpp index e56aa145b..bb9d1c367 100644 --- a/src/lib/mac/cmac/cmac.cpp +++ b/src/lib/mac/cmac/cmac.cpp @@ -27,7 +27,7 @@ BOTAN_REGISTER_NAMED_T(MessageAuthenticationCode, "CMAC", CMAC, CMAC::make); */ secure_vector<byte> CMAC::poly_double(const secure_vector<byte>& in) { - const bool top_carry = static_cast<bool>(in[0] & 0x80); + const bool top_carry = static_cast<bool>((in[0] & 0x80) != 0); secure_vector<byte> out = in; diff --git a/src/lib/modes/xts/xts.cpp b/src/lib/modes/xts/xts.cpp index 440d76ec2..b2b8386bb 100644 --- a/src/lib/modes/xts/xts.cpp +++ b/src/lib/modes/xts/xts.cpp @@ -19,7 +19,7 @@ void poly_double_128(byte out[], const byte in[]) u64bit X0 = load_le<u64bit>(in, 0); u64bit X1 = load_le<u64bit>(in, 1); - const bool carry = static_cast<bool>(X1 >> 63); + const bool carry = static_cast<bool>((X1 >> 63) != 0); X1 = (X1 << 1) | (X0 >> 63); X0 = (X0 << 1); @@ -33,7 +33,7 @@ void poly_double_128(byte out[], const byte in[]) void poly_double_64(byte out[], const byte in[]) { u64bit X = load_le<u64bit>(in, 0); - const bool carry = static_cast<bool>(X >> 63); + const bool carry = static_cast<bool>((X >> 63) != 0); X <<= 1; if(carry) X ^= 0x1B; diff --git a/src/lib/utils/assert.h b/src/lib/utils/assert.h index 60b9ba88a..97924174e 100644 --- a/src/lib/utils/assert.h +++ b/src/lib/utils/assert.h @@ -65,7 +65,7 @@ void BOTAN_DLL assertion_failure(const char* expr_str, */ #define BOTAN_ASSERT_NONNULL(ptr) \ do { \ - if(static_cast<bool>(ptr) == false) \ + if((ptr) == nullptr) \ Botan::assertion_failure(#ptr " is not null", \ "", \ BOTAN_CURRENT_FUNCTION, \ |