aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-04-23 12:51:44 +0000
committerlloyd <[email protected]>2010-04-23 12:51:44 +0000
commit5285c91f975c319078f6de7ad4568ce7f925bd6b (patch)
treeb05374259d8fb3226ca8b5fabc6ff02273085af4
parent3bc6f213f911fb52fa9c412bb6af1a9ece60a086 (diff)
Remove some C-style casts
-rw-r--r--src/benchmark/benchmark.cpp2
-rw-r--r--src/cert/cvc/asn1_eac_tm.cpp4
-rw-r--r--src/hash/sha1_sse2/sha1_sse2.cpp2
-rw-r--r--src/utils/bswap.h4
4 files changed, 6 insertions, 6 deletions
diff --git a/src/benchmark/benchmark.cpp b/src/benchmark/benchmark.cpp
index 01f6b99da..a24a3fdaf 100644
--- a/src/benchmark/benchmark.cpp
+++ b/src/benchmark/benchmark.cpp
@@ -131,7 +131,7 @@ algorithm_benchmark(const std::string& name,
return all_results;
const u64bit ns_per_provider =
- ((u64bit)milliseconds * 1000 * 1000) / providers.size();
+ (static_cast<u64bit>(milliseconds) * 1000 * 1000) / providers.size();
std::vector<byte> buf(16 * 1024);
rng.randomize(&buf[0], buf.size());
diff --git a/src/cert/cvc/asn1_eac_tm.cpp b/src/cert/cvc/asn1_eac_tm.cpp
index 73a2843f7..51b9c7513 100644
--- a/src/cert/cvc/asn1_eac_tm.cpp
+++ b/src/cert/cvc/asn1_eac_tm.cpp
@@ -37,8 +37,8 @@ SecureVector<byte> enc_two_digit(u32bit in)
u32bit dec_two_digit(byte b1, byte b2)
{
- u32bit upper = (u32bit)b1;
- u32bit lower = (u32bit)b2;
+ u32bit upper = b1;
+ u32bit lower = b2;
if(upper > 9 || lower > 9)
throw Invalid_Argument("CVC dec_two_digit value too large");
diff --git a/src/hash/sha1_sse2/sha1_sse2.cpp b/src/hash/sha1_sse2/sha1_sse2.cpp
index 9267689e7..00a0752f6 100644
--- a/src/hash/sha1_sse2/sha1_sse2.cpp
+++ b/src/hash/sha1_sse2/sha1_sse2.cpp
@@ -159,7 +159,7 @@ void SHA_160_SSE2::compress_n(const byte input_bytes[], u32bit blocks)
u32bit A = digest[0], B = digest[1], C = digest[2],
D = digest[3], E = digest[4];
- const __m128i* input = (const __m128i *)input_bytes;
+ const __m128i* input = reinterpret_cast<const __m128i*>(input_bytes);
for(u32bit i = 0; i != blocks; ++i)
{
diff --git a/src/utils/bswap.h b/src/utils/bswap.h
index fcb0fa7ea..49962f076 100644
--- a/src/utils/bswap.h
+++ b/src/utils/bswap.h
@@ -83,14 +83,14 @@ inline void bswap_4(T x[4])
template<>
inline void bswap_4(u32bit x[4])
{
- __m128i T = _mm_loadu_si128((const __m128i*)x);
+ __m128i T = _mm_loadu_si128(reinterpret_cast<const __m128i*>(x));
T = _mm_shufflehi_epi16(T, _MM_SHUFFLE(2, 3, 0, 1));
T = _mm_shufflelo_epi16(T, _MM_SHUFFLE(2, 3, 0, 1));
T = _mm_or_si128(_mm_srli_epi16(T, 8), _mm_slli_epi16(T, 8));
- _mm_storeu_si128((__m128i*)x, T);
+ _mm_storeu_si128(reinterpret_cast<__m128i*>(x), T);
}
#endif