More warning fixes in the STM32 drvier, STM32 test project and the library core

This commit is contained in:
Pavel Kirienko
2014-08-28 17:28:44 +04:00
parent acf45e3e6b
commit 8a8bb78d38
7 changed files with 186 additions and 184 deletions
+2 -2
View File
@@ -56,7 +56,7 @@ protected:
throw std::out_of_range("uavcan::Array");
#else
UAVCAN_ASSERT(0);
return Size - 1; // Ha ha
return SizeType(Size - 1U); // Ha ha
#endif
}
};
@@ -87,7 +87,7 @@ protected:
throw std::out_of_range("uavcan::Array");
#else
UAVCAN_ASSERT(0);
return (size_ == 0) ? 0 : (size_ - 1);
return SizeType((size_ == 0U) ? 0U : (size_ - 1U));
#endif
}
+3 -3
View File
@@ -42,16 +42,16 @@ public:
#if UAVCAN_TINY
void add(uint8_t byte)
{
value_ ^= static_cast<uint16_t>(byte) << 8;
value_ ^= uint16_t(uint16_t(byte) << 8);
for (uint8_t bit = 8; bit > 0; --bit)
{
if (value_ & 0x8000U)
{
value_ = (value_ << 1) ^ 0x1021U;
value_ = uint16_t(uint16_t(value_ << 1) ^ 0x1021U);
}
else
{
value_ = (value_ << 1);
value_ = uint16_t(value_ << 1);
}
}
}