Cleared C4242 warning uder Visual Studio

reviewable/pr7/r1
Jeffrey Walton 2015-07-13 23:59:01 -04:00
parent 01caf892e0
commit 828c550389
1 changed files with 6 additions and 7 deletions

13
misc.h
View File

@ -755,36 +755,35 @@ template<> inline word64 rotrMod<word64>(word64 x, unsigned int y)
template<> inline word16 rotlFixed<word16>(word16 x, unsigned int y) template<> inline word16 rotlFixed<word16>(word16 x, unsigned int y)
{ {
assert(y < 8*sizeof(x)); assert(y < 8*sizeof(x));
return y ? _rotl16(x, y) : x; return static_cast<word16>(y ? _rotl16(x, y) : x);
} }
template<> inline word16 rotrFixed<word16>(word16 x, unsigned int y) template<> inline word16 rotrFixed<word16>(word16 x, unsigned int y)
{ {
assert(y < 8*sizeof(x)); assert(y < 8*sizeof(x));
assert(y <= 255); return static_cast<word16>(y ? _rotr16(x, y) : x);
return y ? _rotr16(x, y) : x;
} }
template<> inline word16 rotlVariable<word16>(word16 x, unsigned int y) template<> inline word16 rotlVariable<word16>(word16 x, unsigned int y)
{ {
assert(y < 8*sizeof(x)); assert(y < 8*sizeof(x));
return _rotl16(x, y); return static_cast<word16>(_rotl16(x, y));
} }
template<> inline word16 rotrVariable<word16>(word16 x, unsigned int y) template<> inline word16 rotrVariable<word16>(word16 x, unsigned int y)
{ {
assert(y < 8*sizeof(x)); assert(y < 8*sizeof(x));
return _rotr16(x, y); return static_cast<word16>(_rotr16(x, y));
} }
template<> inline word16 rotlMod<word16>(word16 x, unsigned int y) template<> inline word16 rotlMod<word16>(word16 x, unsigned int y)
{ {
return _rotl16(x, y); return static_cast<word16>(_rotl16(x, y));
} }
template<> inline word16 rotrMod<word16>(word16 x, unsigned int y) template<> inline word16 rotrMod<word16>(word16 x, unsigned int y)
{ {
return _rotr16(x, y); return static_cast<word16>(_rotr16(x, y));
} }
template<> inline byte rotlFixed<byte>(byte x, unsigned int y) template<> inline byte rotlFixed<byte>(byte x, unsigned int y)