aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-02-09 14:52:33 +0000
committerlloyd <[email protected]>2011-02-09 14:52:33 +0000
commita04f18f66c1e78b27dcb7c9c0e9b1897e41b88d1 (patch)
treeb28dc8101ead14654e31557099c3bec53f0aa2d0
parent3495b0bbe0779845800fe34ea93acffffc8c2785 (diff)
Some casts to avoid VC warnings
-rw-r--r--src/block/mars/mars.cpp8
-rw-r--r--src/utils/simd_32/simd_sse.h6
2 files changed, 7 insertions, 7 deletions
diff --git a/src/block/mars/mars.cpp b/src/block/mars/mars.cpp
index fa73e564f..5ee5b0f19 100644
--- a/src/block/mars/mars.cpp
+++ b/src/block/mars/mars.cpp
@@ -202,14 +202,14 @@ u32bit gen_mask(u32bit input)
{
u32bit mask = 0;
- for(size_t j = 2; j != 31; ++j)
+ for(u32bit j = 2; j != 31; ++j)
{
u32bit region = (input >> (j-1)) & 0x07;
if(region == 0x00 || region == 0x07)
{
- u32bit low = (j < 9) ? 0 : (j - 9);
- u32bit high = (j < 23) ? j : 23;
+ const u32bit low = (j < 9) ? 0 : (j - 9);
+ const u32bit high = (j < 23) ? j : 23;
for(u32bit k = low; k != high; ++k)
{
@@ -324,7 +324,7 @@ void MARS::key_schedule(const byte key[], size_t length)
for(size_t i = 0; i != length / 4; ++i)
T[i] = load_le<u32bit>(key, i);
- T[length / 4] = length / 4;
+ T[length / 4] = static_cast<u32bit>(length) / 4;
for(u32bit i = 0; i != 4; ++i)
{
diff --git a/src/utils/simd_32/simd_sse.h b/src/utils/simd_32/simd_sse.h
index 6a20b07d8..7b8fa1c67 100644
--- a/src/utils/simd_32/simd_sse.h
+++ b/src/utils/simd_32/simd_sse.h
@@ -57,8 +57,8 @@ class SIMD_SSE2
void rotate_left(size_t rot)
{
- reg = _mm_or_si128(_mm_slli_epi32(reg, rot),
- _mm_srli_epi32(reg, 32-rot));
+ reg = _mm_or_si128(_mm_slli_epi32(reg, static_cast<int>(rot)),
+ _mm_srli_epi32(reg, static_cast<int>(32-rot)));
}
void rotate_right(size_t rot)
@@ -113,7 +113,7 @@ class SIMD_SSE2
SIMD_SSE2 operator<<(size_t shift) const
{
- return _mm_slli_epi32(reg, shift);
+ return _mm_slli_epi32(reg, static_cast<int>(shift));
}
SIMD_SSE2 operator>>(size_t shift) const