Fix compilation with -Wsign-conversion

For tests with GCC and Clang

Fixes https://github.com/ETLCPP/etl/issues/632
This commit is contained in:
Roland Reichwein 2026-03-27 10:37:28 +01:00
parent 2c2ce9a39f
commit 667d5bb328
192 changed files with 1128 additions and 1126 deletions

View File

@ -64,7 +64,7 @@ namespace etl
absolute(T value)
{
return (value == etl::integral_limits<T>::min) ? etl::private_absolute::signed_min_error<T>()
: (value < T(0)) ? -value : value;
: static_cast<T>((value < T(0)) ? -value : value);
}
template <typename T>

View File

@ -1973,7 +1973,7 @@ namespace etl
{
if (i == etl::find(begin1, i, *i))
{
size_t n = etl::count(begin2, end2, *i);
size_t n = static_cast<size_t>(etl::count(begin2, end2, *i));
if (n == 0 || size_t(etl::count(i, end1, *i)) != n)
{
@ -2010,7 +2010,7 @@ namespace etl
const typename etl::binder1st<TBinaryPredicate> predicate_is_i = etl::bind1st(predicate, *i);
if (i == etl::find_if(begin1, i, predicate_is_i))
{
size_t n = etl::count_if(begin2, end2, predicate_is_i);
size_t n = static_cast<size_t>(etl::count_if(begin2, end2, predicate_is_i));
if (n == 0 || size_t(etl::count_if(i, end1, predicate_is_i)) != n)
{
@ -2047,7 +2047,7 @@ namespace etl
{
if (i == etl::find(begin1, i, *i))
{
size_t n = etl::count(begin2, end2, *i);
size_t n = static_cast<size_t>(etl::count(begin2, end2, *i));
if (n == 0 || size_t(etl::count(i, end1, *i)) != n)
{
@ -2086,7 +2086,7 @@ namespace etl
const typename etl::binder1st<TBinaryPredicate> predicate_is_i = etl::bind1st(predicate, *i);
if (i == etl::find_if(begin1, i, predicate_is_i))
{
size_t n = etl::count_if(begin2, end2, predicate_is_i);
size_t n = static_cast<size_t>(etl::count_if(begin2, end2, predicate_is_i));
if (n == 0 || size_t(etl::count_if(i, end1, predicate_is_i)) != n)
{
@ -2497,7 +2497,7 @@ namespace etl
{
while (first != last)
{
sum = ETL_MOVE(sum) + *first;
sum = static_cast<T>(ETL_MOVE(sum) + static_cast<T>(*first));
++first;
}

View File

@ -496,13 +496,13 @@ namespace etl
iterator p = to_iterator(position);
iterator result(p);
size_t source_size = etl::distance(first, last);
size_t destination_space = etl::distance(position, cend());
size_t source_size = static_cast<size_t>(etl::distance(first, last));
size_t destination_space = static_cast<size_t>(etl::distance(position, cend()));
// Do we need to move anything?
if (source_size < destination_space)
{
size_t length = SIZE - (etl::distance(begin(), p) + source_size);
size_t length = SIZE - (static_cast<size_t>(etl::distance(begin(), p)) + source_size);
etl::move_backward(p, p + length, end());
}

View File

@ -474,23 +474,23 @@ namespace etl
// Add
T* operator +=(ptrdiff_t v)
{
return reinterpret_cast<T*>(__atomic_fetch_add(&value, v * sizeof(T), etl::memory_order_seq_cst));
return reinterpret_cast<T*>(__atomic_fetch_add(&value, static_cast<uintptr_t>(v * static_cast<ptrdiff_t>(sizeof(T))), etl::memory_order_seq_cst));
}
T* operator +=(ptrdiff_t v) volatile
{
return reinterpret_cast<T*>(__atomic_fetch_add(&value, v * sizeof(T), etl::memory_order_seq_cst));
return reinterpret_cast<T*>(__atomic_fetch_add(&value, static_cast<uintptr_t>(v * static_cast<ptrdiff_t>(sizeof(T))), etl::memory_order_seq_cst));
}
// Subtract
T* operator -=(ptrdiff_t v)
{
return reinterpret_cast<T*>(__atomic_fetch_sub(&value, v * sizeof(T), etl::memory_order_seq_cst));
return reinterpret_cast<T*>(__atomic_fetch_sub(&value, static_cast<uintptr_t>(v * static_cast<ptrdiff_t>(sizeof(T))), etl::memory_order_seq_cst));
}
T* operator -=(ptrdiff_t v) volatile
{
return reinterpret_cast<T*>(__atomic_fetch_sub(&value, v * sizeof(T), etl::memory_order_seq_cst));
return reinterpret_cast<T*>(__atomic_fetch_sub(&value, static_cast<uintptr_t>(v * static_cast<ptrdiff_t>(sizeof(T))), etl::memory_order_seq_cst));
}
// Conversion operator
@ -540,23 +540,23 @@ namespace etl
// Fetch add
T* fetch_add(ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst)
{
return reinterpret_cast<T*>(__atomic_fetch_add(&value, v, order));
return reinterpret_cast<T*>(__atomic_fetch_add(&value, static_cast<uintptr_t>(v), order));
}
T* fetch_add(ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst) volatile
{
return reinterpret_cast<T*>(__atomic_fetch_add(&value, v, order));
return reinterpret_cast<T*>(__atomic_fetch_add(&value, static_cast<uintptr_t>(v), order));
}
// Fetch subtract
T* fetch_sub(ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst)
{
return reinterpret_cast<T*>(__atomic_fetch_sub(&value, v, order));
return reinterpret_cast<T*>(__atomic_fetch_sub(&value, static_cast<uintptr_t>(v), order));
}
T* fetch_sub(ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst) volatile
{
return reinterpret_cast<T*>(__atomic_fetch_sub(&value, v, order));
return reinterpret_cast<T*>(__atomic_fetch_sub(&value, static_cast<uintptr_t>(v), order));
}
// Exchange

View File

@ -494,7 +494,7 @@ namespace etl
}
else
{
input_buffer[input_buffer_length++] = static_cast<uint8_t>(value);
input_buffer[input_buffer_length++] = static_cast<char>(value);
}
}
}

View File

@ -339,7 +339,7 @@ namespace etl
// Only triggered on call to flush().
case 2:
{
uint32_t octets = (input_buffer[0] << 8) | input_buffer[1];
uint32_t octets = (static_cast<uint32_t>(input_buffer[0]) << 8) | input_buffer[1];
octets <<= 2; // Adjust two octets (16 bits) for three sextets worth of data (18 bits)
// Write out three sextets + optional padding.
@ -357,7 +357,7 @@ namespace etl
// Only triggered on call to encode().
case 3:
{
uint32_t octets = (input_buffer[0] << 16) | (input_buffer[1] << 8) | input_buffer[2];
uint32_t octets = (static_cast<uint32_t>(input_buffer[0]) << 16) | (static_cast<uint32_t>(input_buffer[1]) << 8) | input_buffer[2];
// Write out four sextets
push_to_output_buffer(encoder_table[(octets >> 18) & 0x3F]);

View File

@ -1003,7 +1003,7 @@ namespace etl
// Quick hack, as iterators are pointers.
iterator insert_position = to_iterator(position);
const size_type start = etl::distance(cbegin(), position);
const size_type start = static_cast<size_type>(etl::distance(cbegin(), position));
// No effect.
if (start >= CAPACITY)
@ -1091,8 +1091,8 @@ namespace etl
return position_;
}
const size_type start = etl::distance(begin(), position_);
const size_type n = etl::distance(first, last);
const size_type start = static_cast<size_type>(etl::distance(begin(), position_));
const size_type n = static_cast<size_type>(etl::distance(first, last));
// No effect.
if (start >= CAPACITY)
@ -1123,7 +1123,7 @@ namespace etl
current_size = CAPACITY;
position_ = copy_characters(first, etl::distance(position_, end()), position_);
position_ = copy_characters(first, static_cast<size_t>(etl::distance(position_, end())), position_);
}
else
{
@ -1155,7 +1155,7 @@ namespace etl
etl::mem_move(position_, position_ + characters_to_shift, begin() + to_position);
//etl::copy_backward(position_, position_ + characters_to_shift, begin() + to_position + characters_to_shift);
position_ = copy_characters(first, etl::distance(first, last), position_);
position_ = copy_characters(first, static_cast<size_t>(etl::distance(first, last)), position_);
}
p_buffer[current_size] = 0;
@ -1383,7 +1383,7 @@ namespace etl
}
etl::mem_move(last_, end(), first_);
size_type n_delete = etl::distance(first_, last_);
size_type n_delete = static_cast<size_type>(etl::distance(first_, last_));
current_size -= n_delete;
p_buffer[current_size] = 0;
@ -1486,7 +1486,7 @@ namespace etl
if (i != end())
{
return etl::distance(begin(), i);
return static_cast<size_type>(etl::distance(begin(), i));
}
else
{
@ -1557,11 +1557,11 @@ namespace etl
position = size() - position;
const_reverse_iterator i = etl::find(rbegin() + position, rend(), c);
const_reverse_iterator i = etl::find(rbegin() + static_cast<difference_type>(position), rend(), c);
if (i != rend())
{
return size() - etl::distance(rbegin(), i) - 1;
return size() - static_cast<size_type>(etl::distance(rbegin(), i)) - 1;
}
else
{
@ -2133,7 +2133,7 @@ namespace etl
position = etl::min(position, size() - 1);
const_reverse_iterator it = rbegin() + size() - position - 1;
const_reverse_iterator it = rbegin() + static_cast<difference_type>(size() - position - 1);
while (it != rend())
{
@ -2166,7 +2166,7 @@ namespace etl
position = etl::min(position, size() - 1);
const_reverse_iterator it = rbegin() + size() - position - 1;
const_reverse_iterator it = rbegin() + static_cast<difference_type>(size() - position - 1);
while (it != rend())
{
@ -2312,7 +2312,7 @@ namespace etl
position = etl::min(position, size() - 1);
const_reverse_iterator it = rbegin() + size() - position - 1;
const_reverse_iterator it = rbegin() + static_cast<difference_type>(size() - position - 1);
while (it != rend())
{
@ -2350,7 +2350,7 @@ namespace etl
position = etl::min(position, size() - 1);
const_reverse_iterator it = rbegin() + size() - position - 1;
const_reverse_iterator it = rbegin() + static_cast<difference_type>(size() - position - 1);
while (it != rend())
{
@ -2749,7 +2749,7 @@ namespace etl
while (count != n)
{
*to++ = *from++;
*to++ = static_cast<value_type>(*from++);
++count;
}
@ -2881,7 +2881,7 @@ namespace etl
}
else
{
return etl::distance(begin(), iposition);
return static_cast<size_type>(etl::distance(begin(), iposition));
}
}
@ -2903,7 +2903,7 @@ namespace etl
pos = size() - pos;
const_reverse_iterator iposition = etl::search(rbegin() + pos, rend(), rfirst, rlast);
const_reverse_iterator iposition = etl::search(rbegin() + static_cast<difference_type>(pos), rend(), rfirst, rlast);
if (iposition == rend())
{
@ -2911,7 +2911,7 @@ namespace etl
}
else
{
return size() - sz - etl::distance(rbegin(), iposition);
return size() - sz - static_cast<size_type>(etl::distance(rbegin(), iposition));
}
}
@ -3216,7 +3216,7 @@ namespace etl
std::basic_ostream<T, std::char_traits<T> > &operator<<(std::basic_ostream<T, std::char_traits<T> > &os,
const etl::ibasic_string<T>& str)
{
os.write(str.data(), str.size());
os.write(str.data(), static_cast<std::streamsize>(str.size()));
return os;
}
#endif

View File

@ -253,12 +253,12 @@ namespace etl
// Keep shifting down and XORing the lower bits.
while (value >= etl::max_value_for_nbits<NBits>::value)
{
folded_value ^= value & mask;
folded_value ^= static_cast<TReturn>(value & mask);
value >>= shift;
}
// Fold the remaining bits.
folded_value ^= value & mask;
folded_value ^= static_cast<TReturn>(value & mask);
return folded_value;
}
@ -280,7 +280,7 @@ namespace etl
signed value : NBits;
} s = {0};
return (s.value = value);
return (s.value = static_cast<int>(static_cast<TReturn>(value)));
}
//***************************************************************************
@ -302,7 +302,7 @@ namespace etl
signed value : NBits;
} s = {0};
return (s.value = (value >> SHIFT));
return (s.value = static_cast<int>(static_cast<TReturn>(value >> SHIFT)));
}
//***************************************************************************
@ -321,7 +321,7 @@ namespace etl
TReturn mask = TReturn(1) << (NBits - 1);
value = value & TValue((TValue(1) << NBits) - 1);
return TReturn((value ^ mask) - mask);
return static_cast<TReturn>(static_cast<TReturn>(value ^ static_cast<TValue>(mask)) - mask);
}
//***************************************************************************
@ -341,7 +341,7 @@ namespace etl
TReturn mask = TReturn(1) << (NBits - 1);
value = (value >> SHIFT) & TValue((TValue(1) << NBits) - 1);
return TReturn((value ^ mask) - mask);
return static_cast<TReturn>(static_cast<TReturn>(value ^ static_cast<TValue>(mask)) - mask);
}
//***************************************************************************
@ -520,12 +520,12 @@ namespace etl
{
private:
static ETL_CONSTANT int8_t value1 = int8_t(((Value & 0xAAU) >> 1U) | ((Value & 0x55U) << 1U));
static ETL_CONSTANT int8_t value2 = int8_t(((value1 & 0xCCU) >> 2U) | ((value1 & 0x33U) << 2U));
static ETL_CONSTANT int8_t value1 = int8_t(((static_cast<uint8_t>(Value) & 0xAAU) >> 1U) | ((static_cast<uint8_t>(Value) & 0x55U) << 1U));
static ETL_CONSTANT int8_t value2 = int8_t(((static_cast<uint8_t>(value1) & 0xCCU) >> 2U) | ((static_cast<uint8_t>(value1) & 0x33U) << 2U));
public:
static ETL_CONSTANT int8_t value = int8_t((value2 >> 4U) | ((value2 & 0x0FU) << 4U));
static ETL_CONSTANT int8_t value = int8_t((static_cast<uint8_t>(value2) >> 4U) | ((static_cast<uint8_t>(value2) & 0x0FU) << 4U));
};
template <int8_t Value>
@ -573,13 +573,13 @@ namespace etl
{
private:
static ETL_CONSTANT int16_t value1 = int16_t(((Value & 0xAAAAU) >> 1U) | ((Value & 0x5555U) << 1U));
static ETL_CONSTANT int16_t value2 = int16_t(((value1 & 0xCCCCU) >> 2U) | ((value1 & 0x3333U) << 2U));
static ETL_CONSTANT int16_t value3 = int16_t(((value2 & 0xF0F0U) >> 4U) | ((value2 & 0x0F0FU) << 4U));
static ETL_CONSTANT int16_t value1 = int16_t(((static_cast<uint16_t>(Value) & 0xAAAAU) >> 1U) | ((static_cast<uint16_t>(Value) & 0x5555U) << 1U));
static ETL_CONSTANT int16_t value2 = int16_t(((static_cast<uint16_t>(value1) & 0xCCCCU) >> 2U) | ((static_cast<uint16_t>(value1) & 0x3333U) << 2U));
static ETL_CONSTANT int16_t value3 = int16_t(((static_cast<uint16_t>(value2) & 0xF0F0U) >> 4U) | ((static_cast<uint16_t>(value2) & 0x0F0FU) << 4U));
public:
static ETL_CONSTANT int16_t value = int16_t((value3 >> 8U) | ((value3 & 0xFFU) << 8U));
static ETL_CONSTANT int16_t value = int16_t((static_cast<uint16_t>(value3) >> 8U) | ((static_cast<uint16_t>(value3) & 0xFFU) << 8U));
};
template <int16_t Value>
@ -628,14 +628,14 @@ namespace etl
{
private:
static ETL_CONSTANT int32_t value1 = int32_t(((Value & 0xAAAAAAAAUL) >> 1U) | ((Value & 0x55555555UL) << 1U));
static ETL_CONSTANT int32_t value2 = int32_t(((value1 & 0xCCCCCCCCUL) >> 2U) | ((value1 & 0x33333333UL) << 2U));
static ETL_CONSTANT int32_t value3 = int32_t(((value2 & 0xF0F0F0F0UL) >> 4U) | ((value2 & 0x0F0F0F0FUL) << 4U));
static ETL_CONSTANT int32_t value4 = int32_t(((value3 & 0xFF00FF00UL) >> 8U) | ((value3 & 0x00FF00FFUL) << 8U));
static ETL_CONSTANT int32_t value1 = int32_t(((static_cast<uint32_t>(Value) & 0xAAAAAAAAUL) >> 1U) | ((static_cast<uint32_t>(Value) & 0x55555555UL) << 1U));
static ETL_CONSTANT int32_t value2 = int32_t(((static_cast<uint32_t>(value1) & 0xCCCCCCCCUL) >> 2U) | ((static_cast<uint32_t>(value1) & 0x33333333UL) << 2U));
static ETL_CONSTANT int32_t value3 = int32_t(((static_cast<uint32_t>(value2) & 0xF0F0F0F0UL) >> 4U) | ((static_cast<uint32_t>(value2) & 0x0F0F0F0FUL) << 4U));
static ETL_CONSTANT int32_t value4 = int32_t(((static_cast<uint32_t>(value3) & 0xFF00FF00UL) >> 8U) | ((static_cast<uint32_t>(value3) & 0x00FF00FFUL) << 8U));
public:
static ETL_CONSTANT int32_t value = int32_t((value4 >> 16U) | ((value4 & 0xFFFFUL) << 16U));
static ETL_CONSTANT int32_t value = int32_t((static_cast<uint32_t>(value4) >> 16U) | ((static_cast<uint32_t>(value4) & 0xFFFFUL) << 16U));
};
template <int32_t Value>
@ -687,15 +687,15 @@ namespace etl
{
private:
static ETL_CONSTANT int64_t value1 = int64_t(((Value & 0xAAAAAAAAAAAAAAAAULL) >> 1U) | ((Value & 0x5555555555555555ULL) << 1U));
static ETL_CONSTANT int64_t value2 = int64_t(((value1 & 0xCCCCCCCCCCCCCCCCULL) >> 2U) | ((value1 & 0x3333333333333333ULL) << 2U));
static ETL_CONSTANT int64_t value3 = int64_t(((value2 & 0xF0F0F0F0F0F0F0F0ULL) >> 4U) | ((value2 & 0x0F0F0F0F0F0F0F0FULL) << 4U));
static ETL_CONSTANT int64_t value4 = int64_t(((value3 & 0xFF00FF00FF00FF00ULL) >> 8U) | ((value3 & 0x00FF00FF00FF00FFULL) << 8U));
static ETL_CONSTANT int64_t value5 = int64_t(((value4 & 0xFFFF0000FFFF0000ULL) >> 16U) | ((value4 & 0x0000FFFF0000FFFFULL) << 16U));
static ETL_CONSTANT int64_t value1 = int64_t(((static_cast<uint64_t>(Value) & 0xAAAAAAAAAAAAAAAAULL) >> 1U) | ((static_cast<uint64_t>(Value) & 0x5555555555555555ULL) << 1U));
static ETL_CONSTANT int64_t value2 = int64_t(((static_cast<uint64_t>(value1) & 0xCCCCCCCCCCCCCCCCULL) >> 2U) | ((static_cast<uint64_t>(value1) & 0x3333333333333333ULL) << 2U));
static ETL_CONSTANT int64_t value3 = int64_t(((static_cast<uint64_t>(value2) & 0xF0F0F0F0F0F0F0F0ULL) >> 4U) | ((static_cast<uint64_t>(value2) & 0x0F0F0F0F0F0F0F0FULL) << 4U));
static ETL_CONSTANT int64_t value4 = int64_t(((static_cast<uint64_t>(value3) & 0xFF00FF00FF00FF00ULL) >> 8U) | ((static_cast<uint64_t>(value3) & 0x00FF00FF00FF00FFULL) << 8U));
static ETL_CONSTANT int64_t value5 = int64_t(((static_cast<uint64_t>(value4) & 0xFFFF0000FFFF0000ULL) >> 16U) | ((static_cast<uint64_t>(value4) & 0x0000FFFF0000FFFFULL) << 16U));
public:
static ETL_CONSTANT int64_t value = int64_t((value5 >> 32U) | ((value5 & 0xFFFFFFFFULL) << 32U));
static ETL_CONSTANT int64_t value = int64_t((static_cast<uint64_t>(value5) >> 32U) | ((static_cast<uint64_t>(value5) & 0xFFFFFFFFULL) << 32U));
};
template <int64_t Value>
@ -998,7 +998,7 @@ namespace etl
{
typedef typename etl::make_unsigned<T>::type unsigned_t;
return static_cast<T>(count_bits(static_cast<unsigned_t>(value)));
return static_cast<uint_least8_t>(count_bits(static_cast<unsigned_t>(value)));
}
#if ETL_USING_8BIT_TYPES
@ -1078,7 +1078,7 @@ namespace etl
{
typedef typename etl::make_unsigned<T>::type unsigned_t;
return static_cast<T>(parity(static_cast<unsigned_t>(value)));
return static_cast<uint_least8_t>(parity(static_cast<unsigned_t>(value)));
}
#if ETL_USING_8BIT_TYPES
@ -2111,13 +2111,13 @@ namespace etl
uint16_t f = uint16_t(first);
uint16_t s = uint16_t(second);
f = (f | (f << 4U)) & 0x0F0FU;
f = (f | (f << 2U)) & 0x3333U;
f = (f | (f << 1U)) & 0x5555U;
f = static_cast<uint16_t>((static_cast<uint32_t>(f) | (static_cast<uint32_t>(f) << 4U)) & 0x0F0FU);
f = static_cast<uint16_t>((static_cast<uint32_t>(f) | (static_cast<uint32_t>(f) << 2U)) & 0x3333U);
f = static_cast<uint16_t>((static_cast<uint32_t>(f) | (static_cast<uint32_t>(f) << 1U)) & 0x5555U);
s = (s | (s << 4U)) & 0x0F0FU;
s = (s | (s << 2U)) & 0x3333U;
s = (s | (s << 1U)) & 0x5555U;
s = static_cast<uint16_t>((static_cast<uint32_t>(s) | (static_cast<uint32_t>(s) << 4U)) & 0x0F0FU);
s = static_cast<uint16_t>((static_cast<uint32_t>(s) | (static_cast<uint32_t>(s) << 2U)) & 0x3333U);
s = static_cast<uint16_t>((static_cast<uint32_t>(s) | (static_cast<uint32_t>(s) << 1U)) & 0x5555U);
return (f | (s << 1U));
}

View File

@ -151,9 +151,9 @@ namespace etl
bit_width(T value) ETL_NOEXCEPT
{
#if ETL_USING_CPP20 && ETL_USING_STL
return std::bit_width(value);
return static_cast<T>(std::bit_width(value));
#else
return etl::integral_limits<T>::bits - etl::countl_zero(value);
return static_cast<T>(etl::integral_limits<T>::bits - etl::countl_zero(value));
#endif
}
@ -211,11 +211,11 @@ namespace etl
{
if (n < 0)
{
return etl::rotate_right(value, -n);
return etl::rotate_right(value, static_cast<size_t>(-n));
}
else
{
return etl::rotate_left(value, n);
return etl::rotate_left(value, static_cast<size_t>(n));
}
}
@ -229,11 +229,11 @@ namespace etl
{
if (n < 0)
{
return etl::rotate_left(value, -n);
return etl::rotate_left(value, static_cast<size_t>(-n));
}
else
{
return etl::rotate_right(value, n);
return etl::rotate_right(value, static_cast<size_t>(n));
}
}

View File

@ -73,7 +73,7 @@ namespace etl
//***************************************************************************
bit_stream(void* begin_, void* end_)
: pdata(reinterpret_cast<unsigned char*>(begin_))
, length_chars(etl::distance(reinterpret_cast<unsigned char*>(begin_), reinterpret_cast<unsigned char*>(end_)))
, length_chars(static_cast<size_t>(etl::distance(reinterpret_cast<unsigned char*>(begin_), reinterpret_cast<unsigned char*>(end_))))
{
restart();
}
@ -103,7 +103,7 @@ namespace etl
//***************************************************************************
void set_stream(void* begin_, void* end_)
{
set_stream(begin_, etl::distance(reinterpret_cast<unsigned char*>(begin_), reinterpret_cast<unsigned char*>(end_)));
set_stream(begin_, static_cast<size_t>(etl::distance(reinterpret_cast<unsigned char*>(begin_), reinterpret_cast<unsigned char*>(end_))));
}
//***************************************************************************
@ -252,7 +252,7 @@ namespace etl
if (etl::is_signed<T>::value && (bits != (CHAR_BIT * sizeof(T))))
{
typedef typename etl::make_signed<T>::type ST;
value = etl::sign_extend<ST, ST>(value, bits);
value = static_cast<T>(etl::sign_extend<ST, ST>(static_cast<ST>(value), bits));
}
return success;
@ -422,7 +422,7 @@ namespace etl
//***************************************************************************
unsigned char get_chunk(unsigned char nbits)
{
unsigned char value = pdata[char_index];
unsigned char value = static_cast<unsigned char>(pdata[char_index]);
value >>= (bits_available_in_char - nbits);
@ -434,7 +434,7 @@ namespace etl
}
else
{
mask = (1U << nbits) - 1;
mask = static_cast<unsigned char>((1U << nbits) - 1);
}
value &= mask;
@ -449,7 +449,7 @@ namespace etl
//***************************************************************************
bool get_bit()
{
bool result = (pdata[char_index] & (1U << (bits_available_in_char - 1U))) != 0U;
bool result = (static_cast<unsigned char>(pdata[char_index]) & (1U << (bits_available_in_char - 1U))) != 0U;
step(1U);
@ -467,11 +467,11 @@ namespace etl
// Network to host.
if (etl::endianness::value() == etl::endian::little)
{
etl::reverse_copy(data, data + sizeof(T), temp.raw);
etl::reverse_copy(data, data + sizeof(T), reinterpret_cast<unsigned char*>(temp.raw));
}
else
{
etl::copy(data, data + sizeof(T), temp.raw);
etl::copy(data, data + sizeof(T), reinterpret_cast<unsigned char*>(temp.raw));
}
value = *reinterpret_cast<T*>(temp.raw);
@ -564,7 +564,7 @@ namespace etl
//***************************************************************************
bit_stream_writer(void* begin_, void* end_, etl::endian stream_endianness_, callback_type callback_ = callback_type())
: pdata(reinterpret_cast<char*>(begin_))
, length_chars(etl::distance(reinterpret_cast<unsigned char*>(begin_), reinterpret_cast<unsigned char*>(end_)))
, length_chars(static_cast<size_t>(etl::distance(reinterpret_cast<unsigned char*>(begin_), reinterpret_cast<unsigned char*>(end_))))
, stream_endianness(stream_endianness_)
, callback(callback_)
{
@ -1086,7 +1086,7 @@ namespace etl
//***************************************************************************
bit_stream_reader(const void* begin_, const void* end_, etl::endian stream_endianness_)
: pdata(reinterpret_cast<const char*>(begin_))
, length_chars(etl::distance(reinterpret_cast<const char*>(begin_), reinterpret_cast<const char*>(end_)))
, length_chars(static_cast<size_t>(etl::distance(reinterpret_cast<const char*>(begin_), reinterpret_cast<const char*>(end_))))
, stream_endianness(stream_endianness_)
{
restart();
@ -1149,7 +1149,7 @@ namespace etl
{
typedef typename etl::unsigned_type<T>::type unsigned_t;
T value = read_value<unsigned_t>(nbits, etl::is_signed<T>::value);
T value = static_cast<T>(read_value<unsigned_t>(nbits, etl::is_signed<T>::value));
return static_cast<T>(value);
}
@ -1299,7 +1299,7 @@ namespace etl
//***************************************************************************
unsigned char get_chunk(unsigned char nbits)
{
unsigned char value = pdata[char_index];
unsigned char value = static_cast<unsigned char>(pdata[char_index]);
value >>= (bits_available_in_char - nbits);
unsigned char mask;
@ -1310,7 +1310,7 @@ namespace etl
}
else
{
mask = (1U << nbits) - 1;
mask = static_cast<unsigned char>((1U << nbits) - 1);
}
value &= mask;
@ -1325,7 +1325,7 @@ namespace etl
//***************************************************************************
bool get_bit()
{
bool result = (pdata[char_index] & (1U << (bits_available_in_char - 1U))) != 0U;
bool result = (static_cast<unsigned char>(pdata[char_index]) & (1U << (bits_available_in_char - 1U))) != 0U;
step(1U);

View File

@ -240,11 +240,11 @@ namespace etl
{
if (y_is_major_axis())
{
return (dy / 2) + 1;
return static_cast<size_t>((dy / 2) + 1);
}
else
{
return (dx / 2) + 1;
return static_cast<size_t>((dx / 2) + 1);
}
}

View File

@ -93,7 +93,7 @@ namespace etl
byte_stream_writer(void* begin_, void* end_, etl::endian stream_endianness_, callback_type callback_ = callback_type())
: pdata(reinterpret_cast<char*>(begin_))
, pcurrent(reinterpret_cast<char*>(begin_))
, stream_length(etl::distance(reinterpret_cast<char*>(begin_), reinterpret_cast<char*>(end_)))
, stream_length(static_cast<size_t>(etl::distance(reinterpret_cast<char*>(begin_), reinterpret_cast<char*>(end_))))
, stream_endianness(stream_endianness_)
, callback(callback_)
{
@ -381,7 +381,7 @@ namespace etl
//***************************************************************************
size_t size_bytes() const
{
return etl::distance(pdata, pcurrent);
return static_cast<size_t>(etl::distance(pdata, pcurrent));
}
//***************************************************************************
@ -525,7 +525,7 @@ namespace etl
byte_stream_reader(const void* begin_, const void* end_, etl::endian stream_endianness_)
: pdata(reinterpret_cast<const char*>(begin_))
, pcurrent(reinterpret_cast<const char*>(begin_))
, stream_length(etl::distance(reinterpret_cast<const char*>(begin_), reinterpret_cast<const char*>(end_)))
, stream_length(static_cast<size_t>(etl::distance(reinterpret_cast<const char*>(begin_), reinterpret_cast<const char*>(end_))))
, stream_endianness(stream_endianness_)
{
}
@ -799,7 +799,7 @@ namespace etl
template <typename T>
size_t available() const
{
size_t used = etl::distance(pdata, pcurrent);
size_t used = static_cast<size_t>(etl::distance(pdata, pcurrent));
return (stream_length - used) / sizeof(T);
}

View File

@ -270,7 +270,7 @@ namespace etl
//*************************************************************************
static ETL_CONSTEXPR int_type eof() ETL_NOEXCEPT
{
return -1;
return static_cast<int_type>(-1);
}
//*************************************************************************

View File

@ -325,7 +325,7 @@ namespace etl
//*************************************************************************
iterator& operator +=(int n)
{
current += size_type(picb->buffer_size + n);
current += size_type(static_cast<int>(picb->buffer_size) + n);
current %= picb->buffer_size;
return (*this);
@ -397,7 +397,7 @@ namespace etl
const difference_type lhs_index = lhs.get_index();
const difference_type rhs_index = rhs.get_index();
const difference_type reference_index = lhs.container().begin().get_index();
const size_t buffer_size = lhs.container().max_size() + 1UL;
const difference_type buffer_size = static_cast<difference_type>(lhs.container().max_size() + 1UL);
const difference_type lhs_distance = (lhs_index < reference_index) ? buffer_size + lhs_index - reference_index : lhs_index - reference_index;
const difference_type rhs_distance = (rhs_index < reference_index) ? buffer_size + rhs_index - reference_index : rhs_index - reference_index;
@ -426,7 +426,7 @@ namespace etl
//***************************************************
difference_type get_index() const
{
return current;
return static_cast<difference_type>(current);
}
//***************************************************
@ -616,7 +616,7 @@ namespace etl
//*************************************************************************
const_iterator& operator +=(int n)
{
current += size_type(picb->buffer_size + n);
current += size_type(static_cast<int>(picb->buffer_size) + n);
current %= picb->buffer_size;
return (*this);
@ -676,7 +676,7 @@ namespace etl
const difference_type lhs_index = lhs.get_index();
const difference_type rhs_index = rhs.get_index();
const difference_type reference_index = lhs.container().begin().get_index();
const size_t buffer_size = lhs.container().max_size() + 1UL;
const difference_type buffer_size = static_cast<difference_type>(lhs.container().max_size() + 1UL);
const difference_type lhs_distance = (lhs_index < reference_index) ? buffer_size + lhs_index - reference_index : lhs_index - reference_index;
const difference_type rhs_distance = (rhs_index < reference_index) ? buffer_size + rhs_index - reference_index : rhs_index - reference_index;
@ -705,7 +705,7 @@ namespace etl
//***************************************************
difference_type get_index() const
{
return current;
return static_cast<difference_type>(current);
}
//***************************************************
@ -1065,7 +1065,7 @@ namespace etl
{
const difference_type index = other.get_index();
const difference_type reference_index = static_cast<difference_type>(other.container().out);
const size_t buffer_size = other.container().buffer_size;
const difference_type buffer_size = static_cast<difference_type>(other.container().buffer_size);
if (index < reference_index)
{

View File

@ -119,7 +119,7 @@ namespace etl
//***************************************************************************
ETL_CONSTEXPR14 size_t size() const
{
return etl::distance(itr_begin, itr_end);
return static_cast<size_t>(etl::distance(itr_begin, itr_end));
}
//***************************************************************************

View File

@ -58,10 +58,10 @@ namespace etl
if (sample != ((flags & Sample) != 0))
{
count = 0;
flags = (flags & ~Sample) | (sample ? Sample : 0);
flags = static_cast<flags_t>((flags & static_cast<flags_t>(~Sample)) | (sample ? Sample : 0));
}
flags &= ~Change;
flags &= static_cast<flags_t>(~Change);
}
//*************************************************************************
@ -139,7 +139,7 @@ namespace etl
flags_t next = flags;
next &= ~State;
next &= static_cast<flags_t>(~State);
next |= state_table[index1][index2];
if (next != flags)
@ -148,7 +148,7 @@ namespace etl
}
else
{
next &= ~Change;
next &= static_cast<flags_t>(~Change);
}
flags = next;

View File

@ -296,7 +296,7 @@ namespace etl
if (offset > 0)
{
index += offset;
index = (static_cast<size_t>(index) > p_deque->Buffer_Size - 1) ? index - p_deque->Buffer_Size : index;
index = (static_cast<size_t>(index) > p_deque->Buffer_Size - 1) ? index - static_cast<difference_type>(p_deque->Buffer_Size) : index;
}
else if (offset < 0)
{
@ -312,7 +312,7 @@ namespace etl
if (offset > 0)
{
index -= offset;
index = (index < 0) ? index + p_deque->Buffer_Size : index;
index = (index < 0) ? index + static_cast<difference_type>(p_deque->Buffer_Size) : index;
}
else if (offset < 0)
{
@ -325,7 +325,7 @@ namespace etl
//***************************************************
iterator& operator --()
{
index = (index == 0) ? p_deque->Buffer_Size - 1 : index - 1;
index = (index == 0) ? static_cast<difference_type>(p_deque->Buffer_Size) - 1 : index - 1;
return *this;
}
@ -334,7 +334,7 @@ namespace etl
iterator operator --(int)
{
iterator previous(*this);
index = (index == 0) ? p_deque->Buffer_Size - 1 : index - 1;
index = (index == 0) ? static_cast<difference_type>(p_deque->Buffer_Size) - 1 : index - 1;
return previous;
}
@ -411,7 +411,7 @@ namespace etl
const difference_type lhs_index = lhs.get_index();
const difference_type rhs_index = rhs.get_index();
const difference_type reference_index = lhs.container().begin().get_index();
const size_t buffer_size = lhs.container().max_size() + 1;
const difference_type buffer_size = static_cast<difference_type>(lhs.container().max_size() + 1);
const difference_type lhs_distance = (lhs_index < reference_index) ? buffer_size + lhs_index - reference_index : lhs_index - reference_index;
const difference_type rhs_distance = (rhs_index < reference_index) ? buffer_size + rhs_index - reference_index : rhs_index - reference_index;
@ -470,7 +470,7 @@ namespace etl
{
if (index_ < firstIndex)
{
return p_deque->Buffer_Size + index_ - firstIndex;
return static_cast<difference_type>(p_deque->Buffer_Size) + index_ - firstIndex;
}
else
{
@ -566,7 +566,7 @@ namespace etl
if (offset > 0)
{
index += offset;
index = (static_cast<size_t>(index) > p_deque->Buffer_Size - 1) ? index - p_deque->Buffer_Size : index;
index = (static_cast<size_t>(index) > p_deque->Buffer_Size - 1) ? index - static_cast<difference_type>(p_deque->Buffer_Size) : index;
}
else if (offset < 0)
{
@ -582,7 +582,7 @@ namespace etl
if (offset > 0)
{
index -= offset;
index = (index < 0) ? static_cast<size_t>(index) + p_deque->Buffer_Size : index;
index = (index < 0) ? index + static_cast<difference_type>(p_deque->Buffer_Size) : index;
}
else if (offset < 0)
{
@ -595,7 +595,7 @@ namespace etl
//***************************************************
const_iterator& operator --()
{
index = (index == 0) ? p_deque->Buffer_Size - 1 : index - 1;
index = (index == 0) ? static_cast<difference_type>(p_deque->Buffer_Size) - 1 : index - 1;
return *this;
}
@ -604,7 +604,7 @@ namespace etl
const_iterator operator --(int)
{
const_iterator previous(*this);
index = (index == 0) ? p_deque->Buffer_Size - 1 : index - 1;
index = (index == 0) ? static_cast<difference_type>(p_deque->Buffer_Size) - 1 : index - 1;
return previous;
}
@ -672,7 +672,7 @@ namespace etl
const difference_type lhs_index = lhs.get_index();
const difference_type rhs_index = rhs.get_index();
const difference_type reference_index = lhs.container().begin().get_index();
const size_t buffer_size = lhs.container().max_size() + 1UL;
const difference_type buffer_size = static_cast<difference_type>(lhs.container().max_size() + 1UL);
const difference_type lhs_distance = (lhs_index < reference_index) ? buffer_size + lhs_index - reference_index : lhs_index - reference_index;
const difference_type rhs_distance = (rhs_index < reference_index) ? buffer_size + rhs_index - reference_index : rhs_index - reference_index;
@ -729,7 +729,7 @@ namespace etl
{
if (index_ < firstIndex)
{
return p_deque->Buffer_Size + index_ - firstIndex;
return static_cast<difference_type>(p_deque->Buffer_Size) + index_ - firstIndex;
}
else
{
@ -798,7 +798,7 @@ namespace etl
ETL_ASSERT(index < current_size, ETL_ERROR(deque_out_of_bounds));
iterator result(_begin);
result += index;
result += static_cast<difference_type>(index);
return *result;
}
@ -813,7 +813,7 @@ namespace etl
ETL_ASSERT(index < current_size, ETL_ERROR(deque_out_of_bounds));
iterator result(_begin);
result += index;
result += static_cast<difference_type>(index);
return *result;
}
@ -825,7 +825,7 @@ namespace etl
reference operator [](size_t index)
{
iterator result(_begin);
result += index;
result += static_cast<difference_type>(index);
return *result;
}
@ -837,7 +837,7 @@ namespace etl
const_reference operator [](size_t index) const
{
iterator result(_begin);
result += index;
result += static_cast<difference_type>(index);
return *result;
}
@ -1462,7 +1462,7 @@ namespace etl
create_element_back(value);
}
position = _end - n;
position = _end - static_cast<difference_type>(n);
}
else
{
@ -1473,14 +1473,14 @@ namespace etl
if (distance(_begin, insert_position) <= difference_type(current_size / 2))
{
size_t n_insert = n;
size_t n_move = etl::distance(begin(), position);
size_t n_move = static_cast<size_t>(etl::distance(begin(), position));
size_t n_create_copy = etl::min(n_insert, n_move);
size_t n_create_new = (n_insert > n_create_copy) ? n_insert - n_create_copy : 0;
size_t n_copy_new = (n_insert > n_create_new) ? n_insert - n_create_new : 0;
size_t n_copy_old = n_move - n_create_copy;
// Remember the original start.
iterator from = _begin + n_create_copy - 1;
iterator from = _begin + static_cast<difference_type>(n_create_copy) - 1;
iterator to;
// Create new.
@ -1497,20 +1497,20 @@ namespace etl
}
// Move old.
from = position - n_copy_old;
to = _begin + n_create_copy;
etl::move(from, from + n_copy_old, to);
from = position - static_cast<difference_type>(n_copy_old);
to = _begin + static_cast<difference_type>(n_create_copy);
etl::move(from, from + static_cast<difference_type>(n_copy_old), to);
// Copy new.
to = position - n_create_copy;
to = position - static_cast<difference_type>(n_create_copy);
etl::fill_n(to, n_copy_new, value);
position = _begin + n_move;
position = _begin + static_cast<difference_type>(n_move);
}
else
{
size_t n_insert = n;
size_t n_move = etl::distance(position, end());
size_t n_move = static_cast<size_t>(etl::distance(position, end()));
size_t n_create_copy = etl::min(n_insert, n_move);
size_t n_create_new = (n_insert > n_create_copy) ? n_insert - n_create_copy : 0;
size_t n_copy_new = (n_insert > n_create_new) ? n_insert - n_create_new : 0;
@ -1523,7 +1523,7 @@ namespace etl
}
// Create copy.
const_iterator from = position + n_copy_old;
const_iterator from = position + static_cast<difference_type>(n_copy_old);
for (size_t i = 0UL; i < n_create_copy; ++i)
{
@ -1532,7 +1532,7 @@ namespace etl
}
// Move old.
etl::move_backward(position, position + n_copy_old, position + n_insert + n_copy_old);
etl::move_backward(position, position + static_cast<difference_type>(n_copy_old), position + static_cast<difference_type>(n_insert + n_copy_old));
// Copy new.
etl::fill_n(position, n_copy_new, value);
@ -1557,11 +1557,11 @@ namespace etl
difference_type n = etl::distance(range_begin, range_end);
ETL_ASSERT((current_size + n) <= CAPACITY, ETL_ERROR(deque_full));
ETL_ASSERT((current_size + static_cast<size_t>(n)) <= CAPACITY, ETL_ERROR(deque_full));
if (insert_position == begin())
{
create_element_front(n, range_begin);
create_element_front(static_cast<size_t>(n), range_begin);
position = _begin;
}
@ -1583,8 +1583,8 @@ namespace etl
// Are we closer to the front?
if (distance(_begin, insert_position) < difference_type(current_size / 2))
{
size_t n_insert = n;
size_t n_move = etl::distance(begin(), position);
size_t n_insert = static_cast<size_t>(n);
size_t n_move = static_cast<size_t>(etl::distance(begin(), position));
size_t n_create_copy = etl::min(n_insert, n_move);
size_t n_create_new = (n_insert > n_create_copy) ? n_insert - n_create_copy : 0;
size_t n_copy_new = (n_insert > n_create_new) ? n_insert - n_create_new : 0;
@ -1598,31 +1598,31 @@ namespace etl
create_element_front(n_create_new, range_begin);
// Create copy.
create_element_front(n_create_copy, _begin + n_create_new);
create_element_front(n_create_copy, _begin + static_cast<difference_type>(n_create_new));
// Move old.
from = position - n_copy_old;
to = _begin + n_create_copy;
etl::move(from, from + n_copy_old, to);
from = position - static_cast<difference_type>(n_copy_old);
to = _begin + static_cast<difference_type>(n_create_copy);
etl::move(from, from + static_cast<difference_type>(n_copy_old), to);
// Copy new.
to = position - n_create_copy;
range_begin += n_create_new;
etl::copy(range_begin, range_begin + n_copy_new, to);
to = position - static_cast<difference_type>(n_create_copy);
range_begin += static_cast<difference_type>(n_create_new);
etl::copy(range_begin, range_begin + static_cast<difference_type>(n_copy_new), to);
position = _begin + n_move;
position = _begin + static_cast<difference_type>(n_move);
}
else
{
size_t n_insert = n;
size_t n_move = etl::distance(position, end());
size_t n_insert = static_cast<size_t>(n);
size_t n_move = static_cast<size_t>(etl::distance(position, end()));
size_t n_create_copy = etl::min(n_insert, n_move);
size_t n_create_new = (n_insert > n_create_copy) ? n_insert - n_create_copy : 0;
size_t n_copy_new = (n_insert > n_create_new) ? n_insert - n_create_new : 0;
size_t n_copy_old = n_move - n_create_copy;
// Create new.
TIterator item = range_begin + (n - n_create_new);
TIterator item = range_begin + static_cast<difference_type>(n_insert - n_create_new);
for (size_t i = 0UL; i < n_create_new; ++i)
{
create_element_back(*item);
@ -1630,7 +1630,7 @@ namespace etl
}
// Create copy.
const_iterator from = position + n_copy_old;
const_iterator from = position + static_cast<difference_type>(n_copy_old);
for (size_t i = 0UL; i < n_create_copy; ++i)
{
@ -1639,11 +1639,11 @@ namespace etl
}
// Move old.
etl::move_backward(position, position + n_copy_old, position + n_insert + n_copy_old);
etl::move_backward(position, position + static_cast<difference_type>(n_copy_old), position + static_cast<difference_type>(n_insert + n_copy_old));
// Copy new.
item = range_begin;
etl::copy(item, item + n_copy_new, position);
etl::copy(item, item + static_cast<difference_type>(n_copy_new), position);
}
}
@ -1704,7 +1704,7 @@ namespace etl
ETL_ASSERT((distance(range_begin) <= difference_type(current_size)) && (distance(range_end) <= difference_type(current_size)), ETL_ERROR(deque_out_of_bounds));
// How many to erase?
size_t length = etl::distance(range_begin, range_end);
size_t length = static_cast<size_t>(etl::distance(range_begin, range_end));
// At the beginning?
if (position == _begin)
@ -1717,7 +1717,7 @@ namespace etl
position = begin();
}
// At the end?
else if (position == _end - length)
else if (position == _end - static_cast<difference_type>(length))
{
for (size_t i = 0UL; i < length; ++i)
{
@ -1733,20 +1733,20 @@ namespace etl
if (distance(_begin, position) < difference_type(current_size / 2))
{
// Move the items.
etl::move_backward(_begin, position, position + length);
etl::move_backward(_begin, position, position + static_cast<difference_type>(length));
for (size_t i = 0UL; i < length; ++i)
{
destroy_element_front();
}
position += length;
position += static_cast<difference_type>(length);
}
else
// Must be closer to the back.
{
// Move the items.
etl::move(position + length, _end, position);
etl::move(position + static_cast<difference_type>(length), _end, position);
for (size_t i = 0UL; i < length; ++i)
{
@ -2189,7 +2189,7 @@ namespace etl
return;
}
_begin -= n;
_begin -= static_cast<difference_type>(n);
iterator item = _begin;
@ -2302,7 +2302,7 @@ namespace etl
{
const difference_type index = other.get_index();
const difference_type reference_index = other.container()._begin.index;
const size_t buffer_size = other.container().Buffer_Size;
const difference_type buffer_size = static_cast<difference_type>(other.container().Buffer_Size);
if (index < reference_index)
{

View File

@ -101,7 +101,7 @@ namespace etl
template <value_type pattern, bool value>
ETL_CONSTEXPR14 flags<T, MASK>& set() ETL_NOEXCEPT
{
value ? data |= (pattern & MASK) : data &= (~pattern & MASK);
value ? data |= (pattern & MASK) : data &= static_cast<value_type>(~pattern & MASK);
return *this;
}
@ -110,7 +110,7 @@ namespace etl
template <value_type pattern>
ETL_CONSTEXPR14 flags<T, MASK>& set(bool value) ETL_NOEXCEPT
{
value ? data |= (pattern & MASK) : data &= (~pattern & MASK);
value ? data |= (pattern & MASK) : data &= static_cast<value_type>(~pattern & MASK);
return *this;
}
@ -135,13 +135,11 @@ namespace etl
//*******************************************
ETL_CONSTEXPR14 flags<T, MASK>& set(value_type pattern, bool value) ETL_NOEXCEPT
{
value ? data |= (pattern & MASK) : data &= (~pattern & MASK);
value ? data |= (pattern & MASK) : data &= static_cast<value_type>(~pattern & MASK);
return *this;
}
//*************************************************************************
/// Clear all of the flags.
//*************************************************************************
ETL_CONSTEXPR14 flags<T, MASK>& clear() ETL_NOEXCEPT
{
@ -156,7 +154,7 @@ namespace etl
template <value_type pattern>
ETL_CONSTEXPR14 flags<T, MASK>& reset() ETL_NOEXCEPT
{
data &= ~pattern;
data &= static_cast<value_type>(~pattern);
return *this;
}
@ -164,7 +162,7 @@ namespace etl
//*******************************************
ETL_CONSTEXPR14 flags<T, MASK>& reset(value_type pattern) ETL_NOEXCEPT
{
data &= ~pattern;
data &= static_cast<value_type>(~pattern);
return *this;
}
@ -174,7 +172,7 @@ namespace etl
//*************************************************************************
ETL_CONSTEXPR14 flags<T, MASK>& flip() ETL_NOEXCEPT
{
data = (~data & MASK);
data = static_cast<value_type>(~data & MASK);
return *this;
}

View File

@ -471,7 +471,7 @@ namespace etl
}
else
{
size_t d = etl::distance(range.first, range.second);
size_t d = static_cast<size_t>(etl::distance(range.first, range.second));
erase(range.first, range.second);
return d;
}
@ -490,7 +490,7 @@ namespace etl
}
else
{
size_t d = etl::distance(range.first, range.second);
size_t d = static_cast<size_t>(etl::distance(range.first, range.second));
erase(range.first, range.second);
return d;
}

View File

@ -440,7 +440,7 @@ namespace etl
}
else
{
size_t d = etl::distance(range.first, range.second);
size_t d = static_cast<size_t>(etl::distance(range.first, range.second));
erase(range.first, range.second);
return d;
}
@ -459,7 +459,7 @@ namespace etl
}
else
{
size_t d = etl::distance(range.first, range.second);
size_t d = static_cast<size_t>(etl::distance(range.first, range.second));
erase(range.first, range.second);
return d;
}

View File

@ -2280,7 +2280,7 @@ namespace etl
etl::istring::iterator format_to(etl::istring& out, format_string<Args...> fmt, Args&&... args)
{
etl::istring::iterator result = format_to_n(out.begin(), out.max_size(), fmt, etl::forward<Args>(args)...);
out.uninitialized_resize(result - out.begin());
out.uninitialized_resize(static_cast<size_t>(result - out.begin()));
return result;
}

View File

@ -1015,7 +1015,7 @@ namespace etl
{
#if ETL_IS_DEBUG_BUILD
difference_type d = etl::distance(first, last);
ETL_ASSERT((d + size()) <= MAX_SIZE, ETL_ERROR(forward_list_full));
ETL_ASSERT((static_cast<size_type>(d) + size()) <= MAX_SIZE, ETL_ERROR(forward_list_full));
#endif
while (first != last)

View File

@ -147,7 +147,7 @@ namespace etl
while (begin != end)
{
frame_check = policy.add(frame_check, *begin);
frame_check = policy.add(frame_check, static_cast<uint8_t>(*begin));
++begin;
}
}

View File

@ -211,7 +211,7 @@ namespace etl
//*********************************
void add(key_type key)
{
++this->accumulator[key - Start_Index];
++this->accumulator[static_cast<size_t>(key - Start_Index)];
}
//*********************************
@ -249,7 +249,7 @@ namespace etl
//*********************************
value_type operator [](key_type key) const
{
return this->accumulator[key - Start_Index];
return this->accumulator[static_cast<size_t>(key - Start_Index)];
}
};
@ -335,7 +335,7 @@ namespace etl
//*********************************
void add(key_type key)
{
++this->accumulator[key - start_index];
++this->accumulator[static_cast<size_t>(key - start_index)];
}
//*********************************
@ -373,7 +373,7 @@ namespace etl
//*********************************
value_type operator [](key_type key) const
{
return this->accumulator[key - start_index];
return this->accumulator[static_cast<size_t>(key - start_index)];
}
private:
@ -588,7 +588,7 @@ namespace etl
++itr;
}
return sum;
return static_cast<size_t>(sum);
}
private:

View File

@ -221,13 +221,13 @@ namespace etl
return *this;
}
iterator operator +=(size_type n)
iterator operator +=(difference_type n)
{
lookup_itr += n;
return *this;
}
iterator operator -=(size_type n)
iterator operator -=(difference_type n)
{
lookup_itr -= n;
return *this;
@ -357,13 +357,13 @@ namespace etl
return temp;
}
const_iterator operator +=(size_type n)
const_iterator operator +=(difference_type n)
{
lookup_itr += n;
return *this;
}
const_iterator operator -=(size_type n)
const_iterator operator -=(difference_type n)
{
lookup_itr -= n;
return *this;

View File

@ -387,8 +387,8 @@ namespace etl
{
typedef char8_t value_type;
static ETL_CONSTANT char8_t min = (etl::is_signed<char8_t>::value) ? SCHAR_MIN : 0;
static ETL_CONSTANT char8_t max = (etl::is_signed<char8_t>::value) ? SCHAR_MAX : static_cast<char8_t>(UCHAR_MAX);
static ETL_CONSTANT char8_t min = static_cast<char8_t>((etl::is_signed<char8_t>::value) ? SCHAR_MIN : 0);
static ETL_CONSTANT char8_t max = (etl::is_signed<char8_t>::value) ? static_cast<char8_t>(SCHAR_MAX) : static_cast<char8_t>(UCHAR_MAX);
static ETL_CONSTANT int bits = CHAR_BIT;
static ETL_CONSTANT bool is_signed = etl::is_signed<char8_t>::value;
};

View File

@ -800,7 +800,7 @@ namespace etl
{
if (first != end() && (first != last))
{
this->current_size -= etl::distance(first, last) - 1;
this->current_size -= static_cast<size_t>(etl::distance(first, last) - 1);
link_type* p_first = first.p_value;
link_type* p_last = last.p_value;
@ -1120,7 +1120,7 @@ namespace etl
{
if (&other != this)
{
size_t n = etl::distance(begin_, end_) - 1;
size_t n = static_cast<size_t>(etl::distance(begin_, end_) - 1);
this->current_size += n;
other.current_size -= n;
}

View File

@ -869,7 +869,7 @@ namespace etl
link_type* p_first = const_cast<link_type*>(cp_first);
link_type* p_last = const_cast<link_type*>(cp_last);
this->current_size -= etl::distance(first, last);
this->current_size -= static_cast<size_t>(etl::distance(first, last));
p_last = this->remove_link_range(p_first, p_last);
@ -1166,7 +1166,7 @@ namespace etl
{
if (&other != this)
{
size_t n = etl::distance(begin_, end_);
size_t n = static_cast<size_t>(etl::distance(begin_, end_));
this->current_size += n;
other.current_size -= n;
}

View File

@ -142,7 +142,8 @@ namespace etl
template <typename TIterator, typename TDistance>
ETL_CONSTEXPR14 void advance_helper(TIterator& itr, TDistance n, ETL_OR_STD::random_access_iterator_tag)
{
itr += n;
typedef typename etl::iterator_traits<TIterator>::difference_type diff_t;
itr += static_cast<diff_t>(n);
}
template <typename TIterator, typename TDistance>

View File

@ -260,10 +260,10 @@ namespace etl
TEncoded encoded = decoded;
encoded = (encoded | (encoded << 4U)) & 0x0F0FU;
encoded = (encoded | (encoded << 2U)) & 0x3333U;
encoded = (encoded | (encoded << 1U)) & 0x5555U;
encoded = (encoded | (encoded << 1U)) ^ (0xAAAAU ^ static_cast<TEncoded>(TManchesterType::inversion_mask));
encoded = static_cast<TEncoded>((static_cast<unsigned int>(encoded) | (static_cast<unsigned int>(encoded) << 4U)) & 0x0F0FU);
encoded = static_cast<TEncoded>((static_cast<unsigned int>(encoded) | (static_cast<unsigned int>(encoded) << 2U)) & 0x3333U);
encoded = static_cast<TEncoded>((static_cast<unsigned int>(encoded) | (static_cast<unsigned int>(encoded) << 1U)) & 0x5555U);
encoded = static_cast<TEncoded>((static_cast<unsigned int>(encoded) | (static_cast<unsigned int>(encoded) << 1U)) ^ (0xAAAAU ^ static_cast<unsigned int>(TManchesterType::inversion_mask)));
return encoded;
}
#endif
@ -357,10 +357,10 @@ namespace etl
{
typedef typename private_manchester::decoded<TEncoded>::type TDecoded;
encoded = (encoded ^ (0xAAAAU ^ static_cast<TEncoded>(TManchesterType::inversion_mask))) & 0x5555U;
encoded = (encoded | (encoded >> 1)) & 0x3333U;
encoded = (encoded | (encoded >> 2)) & 0x0F0FU;
return static_cast<TDecoded>(encoded | (encoded >> 4U));
encoded = static_cast<TEncoded>((static_cast<unsigned int>(encoded) ^ (0xAAAAU ^ static_cast<unsigned int>(TManchesterType::inversion_mask))) & 0x5555U);
encoded = static_cast<TEncoded>((static_cast<unsigned int>(encoded) | (static_cast<unsigned int>(encoded) >> 1)) & 0x3333U);
encoded = static_cast<TEncoded>((static_cast<unsigned int>(encoded) | (static_cast<unsigned int>(encoded) >> 2)) & 0x0F0FU);
return static_cast<TDecoded>(static_cast<unsigned int>(encoded) | (static_cast<unsigned int>(encoded) >> 4U));
}
#endif

View File

@ -99,7 +99,7 @@ namespace etl
template <typename TOutputIterator, typename T, typename TCounter>
TOutputIterator uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value, TCounter& count)
{
count += int32_t(etl::distance(o_begin, o_end));
count += static_cast<TCounter>(etl::distance(o_begin, o_end));
std::uninitialized_fill(o_begin, o_end, value);
@ -150,7 +150,7 @@ namespace etl
typename etl::enable_if<etl::is_trivially_constructible<typename etl::iterator_traits<TOutputIterator>::value_type>::value, TOutputIterator>::type
uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value, TCounter& count)
{
count += int32_t(etl::distance(o_begin, o_end));
count += static_cast<TCounter>(etl::distance(o_begin, o_end));
etl::fill(o_begin, o_end, value);
@ -167,7 +167,7 @@ namespace etl
typename etl::enable_if<!etl::is_trivially_constructible<typename etl::iterator_traits<TOutputIterator>::value_type>::value, TOutputIterator>::type
uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value, TCounter& count)
{
count += int32_t(etl::distance(o_begin, o_end));
count += static_cast<TCounter>(etl::distance(o_begin, o_end));
etl::uninitialized_fill(o_begin, o_end, value);
@ -248,7 +248,7 @@ namespace etl
template <typename TInputIterator, typename TOutputIterator, typename TCounter>
TOutputIterator uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TCounter& count)
{
count += int32_t(etl::distance(i_begin, i_end));
count += static_cast<TCounter>(etl::distance(i_begin, i_end));
return std::uninitialized_copy(i_begin, i_end, o_begin);
}
@ -299,7 +299,7 @@ namespace etl
uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TCounter& count)
{
TOutputIterator o_end = etl::copy(i_begin, i_end, o_begin);
count += int32_t(etl::distance(i_begin, i_end));
count += static_cast<TCounter>(etl::distance(i_begin, i_end));
return o_end;
}
@ -316,7 +316,7 @@ namespace etl
{
TOutputIterator o_end = etl::uninitialized_copy(i_begin, i_end, o_begin);
count += int32_t(etl::distance(i_begin, i_end));
count += static_cast<TCounter>(etl::distance(i_begin, i_end));
return o_end;
}
@ -584,7 +584,7 @@ namespace ranges {
template <typename TInputIterator, typename TOutputIterator, typename TCounter>
TOutputIterator uninitialized_move(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TCounter& count)
{
count += int32_t(etl::distance(i_begin, i_end));
count += static_cast<TCounter>(etl::distance(i_begin, i_end));
#include "etl/private/diagnostic_array_bounds_push.h"
return std::uninitialized_move(i_begin, i_end, o_begin);
@ -637,7 +637,7 @@ namespace ranges {
uninitialized_move(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TCounter& count)
{
TOutputIterator o_end = etl::move(i_begin, i_end, o_begin);
count += int32_t(etl::distance(i_begin, i_end));
count += static_cast<TCounter>(etl::distance(i_begin, i_end));
return o_end;
}
@ -654,7 +654,7 @@ namespace ranges {
{
TOutputIterator o_end = etl::uninitialized_move(i_begin, i_end, o_begin);
count += int32_t(etl::distance(i_begin, i_end));
count += static_cast<TCounter>(etl::distance(i_begin, i_end));
return o_end;
}
@ -682,7 +682,7 @@ namespace ranges {
template <typename TInputIterator, typename TOutputIterator, typename TCounter>
TOutputIterator uninitialized_move(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TCounter& count)
{
count += int32_t(etl::distance(i_begin, i_end));
count += static_cast<TCounter>(etl::distance(i_begin, i_end));
// Move not supported. Defer to copy.
return ETL_OR_STD::uninitialized_copy(i_begin, i_end, o_begin);
@ -941,7 +941,7 @@ namespace ranges {
typename etl::enable_if<etl::is_trivially_constructible<typename etl::iterator_traits<TOutputIterator>::value_type>::value, void>::type
uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count)
{
count = int32_t(etl::distance(o_begin, o_end));
count = static_cast<TCounter>(etl::distance(o_begin, o_end));
std::uninitialized_default_construct(o_begin, o_end);
}
@ -987,7 +987,7 @@ namespace ranges {
typename etl::enable_if<etl::is_trivially_constructible<typename etl::iterator_traits<TOutputIterator>::value_type>::value, void>::type
uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count)
{
count = int32_t(etl::distance(o_begin, o_end));
count = static_cast<TCounter>(etl::distance(o_begin, o_end));
}
//*****************************************************************************
@ -1000,7 +1000,7 @@ namespace ranges {
typename etl::enable_if<!etl::is_trivially_constructible<typename etl::iterator_traits<TOutputIterator>::value_type>::value, void>::type
uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count)
{
count += int32_t(etl::distance(o_begin, o_end));
count += static_cast<TCounter>(etl::distance(o_begin, o_end));
etl::uninitialized_default_construct(o_begin, o_end);
}
@ -1211,7 +1211,7 @@ namespace ranges {
template <typename TOutputIterator, typename TCounter>
void uninitialized_value_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count)
{
count += int32_t(etl::distance(o_begin, o_end));
count += static_cast<TCounter>(etl::distance(o_begin, o_end));
std::uninitialized_value_construct(o_begin, o_end);
}
@ -1257,7 +1257,7 @@ namespace ranges {
template <typename TOutputIterator, typename TCounter>
void uninitialized_value_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count)
{
count += int32_t(etl::distance(o_begin, o_end));
count += static_cast<TCounter>(etl::distance(o_begin, o_end));
etl::uninitialized_value_construct(o_begin, o_end);
}
@ -1579,7 +1579,7 @@ namespace ranges {
template <typename TIterator, typename TCounter>
void destroy(TIterator i_begin, TIterator i_end, TCounter& count)
{
count -= int32_t(etl::distance(i_begin, i_end));
count -= static_cast<TCounter>(etl::distance(i_begin, i_end));
std::destroy(i_begin, i_end);
}
@ -1621,7 +1621,7 @@ namespace ranges {
typename etl::enable_if<etl::is_trivially_destructible<typename etl::iterator_traits<TIterator>::value_type>::value, void>::type
destroy(TIterator i_begin, TIterator i_end, TCounter& count)
{
count -= int32_t(etl::distance(i_begin, i_end));
count -= static_cast<TCounter>(etl::distance(i_begin, i_end));
}
//*****************************************************************************
@ -1634,7 +1634,7 @@ namespace ranges {
typename etl::enable_if<!etl::is_trivially_destructible<typename etl::iterator_traits<TIterator>::value_type>::value, void>::type
destroy(TIterator i_begin, TIterator i_end, TCounter& count)
{
count -= int32_t(etl::distance(i_begin, i_end));
count -= static_cast<TCounter>(etl::distance(i_begin, i_end));
while (i_begin != i_end)
{

View File

@ -91,7 +91,7 @@ namespace etl
reset();
while (begin != end)
{
block |= (*begin) << (block_fill_count * 8U);
block |= static_cast<value_type>(static_cast<value_type>(*begin) << (block_fill_count * 8U));
++begin;
if (++block_fill_count == FULL_BLOCK)
@ -130,7 +130,7 @@ namespace etl
while (begin != end)
{
block |= (*begin) << (block_fill_count * 8U);
block |= static_cast<value_type>(static_cast<value_type>(*begin) << (block_fill_count * 8U));
++begin;
if (++block_fill_count == FULL_BLOCK)
@ -154,7 +154,7 @@ namespace etl
// We can't add to a finalised hash!
ETL_ASSERT(!is_finalised, ETL_ERROR(hash_finalised));
block |= value_ << (block_fill_count * 8U);
block |= static_cast<value_type>(static_cast<value_type>(value_) << (block_fill_count * 8U));
if (++block_fill_count == FULL_BLOCK)
{

View File

@ -107,7 +107,7 @@ namespace etl
while (begin != end)
{
add(*begin);
add(static_cast<uint8_t>(*begin));
++begin;
}
}

View File

@ -479,7 +479,7 @@ namespace etl
if ((length != etl::integral_limits<T>::bits) && etl::integral_limits<T>::is_signed)
{
value = etl::sign_extend<T>(value, length);
value = static_cast<unsigned_t>(etl::sign_extend<T>(static_cast<T>(value), length));
}
return static_cast<T>(value);
@ -506,7 +506,7 @@ namespace etl
if ((Length != etl::integral_limits<T>::bits) && etl::integral_limits<T>::is_signed)
{
value = etl::sign_extend<T>(value, Length);
value = static_cast<unsigned_t>(etl::sign_extend<T>(static_cast<T>(value), Length));
}
return static_cast<T>(value);
@ -1344,7 +1344,7 @@ namespace etl
else
{
// Get the number of active bits in the msb element
size_t active_bits_in_msb = (position + length) - (Msb_Element_Index * Bits_Per_Element);
size_t active_bits_in_msb = (position + length) - (static_cast<size_t>(Msb_Element_Index) * Bits_Per_Element);
// Start with index of the element containing the msb.
int element_index = Msb_Element_Index;
@ -1409,7 +1409,7 @@ namespace etl
if ((length != etl::integral_limits<T>::bits) && etl::integral_limits<T>::is_signed)
{
value = etl::sign_extend<T>(value, length);
value = static_cast<unsigned_t>(etl::sign_extend<T>(static_cast<T>(value), length));
}
return static_cast<T>(value);
@ -1429,7 +1429,7 @@ namespace etl
if ((Length != etl::integral_limits<T>::bits) && etl::integral_limits<T>::is_signed)
{
value = etl::sign_extend<T>(value, Length);
value = static_cast<unsigned_t>(etl::sign_extend<T>(static_cast<T>(value), Length));
}
return static_cast<T>(value);
@ -2059,7 +2059,7 @@ namespace etl
ETL_CONSTEXPR14 bitset(TValue value, typename etl::enable_if<is_integral<TValue>::value>::type* = 0) ETL_NOEXCEPT
: buffer()
{
implementation::template initialise<element_type>(buffer, Number_Of_Elements, value);
implementation::template initialise<element_type>(buffer, Number_Of_Elements, static_cast<unsigned long long>(value));
}
//*************************************************************************
@ -3018,7 +3018,7 @@ namespace etl
ETL_CONSTEXPR14 bitset_ext(TValue value, buffer_type& buffer, typename etl::enable_if<is_integral<TValue>::value>::type* = 0) ETL_NOEXCEPT
: pbuffer(buffer.data())
{
implementation::template initialise<element_type>(pbuffer, Number_Of_Elements, value);
implementation::template initialise<element_type>(pbuffer, Number_Of_Elements, static_cast<unsigned long long>(value));
}
//*************************************************************************

View File

@ -100,7 +100,7 @@ namespace etl
/// The return type for to_duration.
//***********************************************************************
using precision = etl::chrono::duration<common_type_t<typename TDuration::rep, etl::chrono::seconds::rep>,
ratio<1, etl::power<10, fractional_width>::value>>;
ratio<1, etl::power<10, size_t(fractional_width)>::value>>;
//***********************************************************************
/// Default constructor.

View File

@ -250,7 +250,7 @@ namespace etl
// Adjust to allow a limited +-11 month delta
value += 11U;
value += delta;
value += static_cast<unsigned int>(delta);
value %= 12U;
++value;

View File

@ -48,14 +48,14 @@ namespace etl
inline ETL_CONSTEXPR14 etl::chrono::month_day operator /(const etl::chrono::month& m,
int d) ETL_NOEXCEPT
{
return etl::chrono::month_day(m, etl::chrono::day(d));
return etl::chrono::month_day(m, etl::chrono::day(static_cast<unsigned>(d)));
}
// month_day
inline ETL_CONSTEXPR14 etl::chrono::month_day operator /(int m,
const etl::chrono::day& d) ETL_NOEXCEPT
{
return etl::chrono::month_day(etl::chrono::month(m), d);
return etl::chrono::month_day(etl::chrono::month(static_cast<unsigned>(m)), d);
}
// month_day
@ -69,7 +69,7 @@ namespace etl
inline ETL_CONSTEXPR14 etl::chrono::month_day operator /(const etl::chrono::day& d,
int m) ETL_NOEXCEPT
{
return etl::chrono::month_day(etl::chrono::month(m), d);
return etl::chrono::month_day(etl::chrono::month(static_cast<unsigned>(m)), d);
}
//*************************************************************************
@ -84,7 +84,7 @@ namespace etl
inline ETL_CONSTEXPR14 etl::chrono::month_day_last operator /(int m,
etl::chrono::last_spec) ETL_NOEXCEPT
{
return etl::chrono::month_day_last(etl::chrono::month(m));
return etl::chrono::month_day_last(etl::chrono::month(static_cast<unsigned>(m)));
}
// month_day_last
@ -98,7 +98,7 @@ namespace etl
inline ETL_CONSTEXPR14 etl::chrono::month_day_last operator/(etl::chrono::last_spec,
int m) ETL_NOEXCEPT
{
return etl::chrono::month_day_last(etl::chrono::month(m));
return etl::chrono::month_day_last(etl::chrono::month(static_cast<unsigned>(m)));
}
//*************************************************************************
@ -113,7 +113,7 @@ namespace etl
inline ETL_CONSTEXPR14 etl::chrono::month_weekday operator /(int m,
const etl::chrono::weekday_indexed& wdi) ETL_NOEXCEPT
{
return etl::chrono::month_weekday(etl::chrono::month(m), wdi);
return etl::chrono::month_weekday(etl::chrono::month(static_cast<unsigned>(m)), wdi);
}
// month_weekday
@ -127,7 +127,7 @@ namespace etl
inline ETL_CONSTEXPR14 etl::chrono::month_weekday operator /(const etl::chrono::weekday_indexed& wdi,
int m) ETL_NOEXCEPT
{
return etl::chrono::month_weekday(etl::chrono::month(m), wdi);
return etl::chrono::month_weekday(etl::chrono::month(static_cast<unsigned>(m)), wdi);
}
//*************************************************************************
@ -142,7 +142,7 @@ namespace etl
inline ETL_CONSTEXPR14 etl::chrono::month_weekday_last operator /(int m,
const etl::chrono::weekday_last& wdl) ETL_NOEXCEPT
{
return etl::chrono::month_weekday_last(etl::chrono::month(m), wdl);
return etl::chrono::month_weekday_last(etl::chrono::month(static_cast<unsigned>(m)), wdl);
}
// month_weekday_last
@ -156,7 +156,7 @@ namespace etl
inline ETL_CONSTEXPR14 etl::chrono::month_weekday_last operator /(const etl::chrono::weekday_last& wdl,
int m) ETL_NOEXCEPT
{
return etl::chrono::month_weekday_last(etl::chrono::month(m), wdl);
return etl::chrono::month_weekday_last(etl::chrono::month(static_cast<unsigned>(m)), wdl);
}
//*************************************************************************
@ -171,7 +171,7 @@ namespace etl
inline ETL_CONSTEXPR14 etl::chrono::year_month operator /(const etl::chrono::year& y,
int m) ETL_NOEXCEPT
{
return etl::chrono::year_month(y, etl::chrono::month(m));
return etl::chrono::year_month(y, etl::chrono::month(static_cast<unsigned>(m)));
}
////*************************************************************************
@ -186,7 +186,7 @@ namespace etl
inline ETL_CONSTEXPR14 etl::chrono::year_month_day operator /(const etl::chrono::year_month& ym,
int d ) ETL_NOEXCEPT
{
return etl::chrono::year_month_day(ym.year(), ym.month(), etl::chrono::day(d));
return etl::chrono::year_month_day(ym.year(), ym.month(), etl::chrono::day(static_cast<unsigned>(d)));
}
// year_month_day

View File

@ -80,7 +80,7 @@ namespace etl
etl::chrono::days days_since_epoch = sd.time_since_epoch();
// Convert to weekday. Beginning of the epoch was a Thursday (4).
value = (days_since_epoch.count() + 4) % 7;
value = static_cast<unsigned char>((days_since_epoch.count() + 4) % 7);
}
//*************************************************************************
@ -279,7 +279,7 @@ namespace etl
// Adjust to allow a limited +-7 weekday delta
value %= 7U;
value += 7U;
value += delta;
value += static_cast<unsigned int>(delta);
value %= 7U;
return etl::chrono::weekday(value);

View File

@ -269,7 +269,7 @@ namespace etl
}
// Add days for the current month
day_count += static_cast<unsigned>(this->day()) - 1;
day_count += static_cast<int>(static_cast<unsigned>(this->day()) - 1);
return sys_days(etl::chrono::days(day_count));
}

View File

@ -182,11 +182,11 @@ namespace etl
unsigned int target_wd = ymwd.weekday().c_encoding();
unsigned int target_index = ymwd.index();
etl::chrono::weekday first_weekday(static_cast<int>(sd.time_since_epoch().count()));
etl::chrono::weekday first_weekday(static_cast<unsigned>(sd.time_since_epoch().count()));
int first_wd = first_weekday.c_encoding();
int offset = (target_wd - first_wd + 7) % 7;
int day_of_month = offset + static_cast<int>(target_index - 1) * 7;
unsigned int first_wd = first_weekday.c_encoding();
unsigned int offset = (target_wd - first_wd + 7U) % 7U;
unsigned int day_of_month = offset + (target_index - 1U) * 7U;
etl::chrono::year_month_day result(year(), month(), etl::chrono::day(day_of_month));
@ -400,7 +400,7 @@ namespace etl
{
etl::chrono::year_month_day ymd(year(), month(), etl::chrono::day(d));
etl::chrono::sys_days ymd_sys_days = static_cast<etl::chrono::sys_days>(ymd);
etl::chrono::weekday wd(static_cast<int>(ymd_sys_days.time_since_epoch().count()));
etl::chrono::weekday wd(static_cast<unsigned>(ymd_sys_days.time_since_epoch().count()));
if (wd == weekday())
{

View File

@ -485,7 +485,7 @@ namespace etl
etl::swap_ranges(smaller.begin(), smaller.end(), larger.begin());
typename ivector<T*>::iterator larger_itr = etl::next(larger.begin(), smaller.size());
typename ivector<T*>::iterator larger_itr = etl::next(larger.begin(), static_cast<ptrdiff_t>(smaller.size()));
etl::move(larger_itr, larger.end(), etl::back_inserter(smaller));
@ -933,7 +933,7 @@ namespace etl
etl::swap_ranges(smaller.begin(), smaller.end(), larger.begin());
typename ivector<const T*>::iterator larger_itr = etl::next(larger.begin(), smaller.size());
typename ivector<const T*>::iterator larger_itr = etl::next(larger.begin(), static_cast<ptrdiff_t>(smaller.size()));
etl::move(larger_itr, larger.end(), etl::back_inserter(smaller));

View File

@ -570,7 +570,7 @@ namespace etl
typename etl::enable_if<!etl::is_pointer<TIterator>::value, void>::type
insert(const_iterator position, TIterator first, TIterator last)
{
size_t count = etl::distance(first, last);
size_t count = static_cast<size_t>(etl::distance(first, last));
iterator position_ = to_iterator(position);
@ -594,7 +594,7 @@ namespace etl
typename etl::enable_if<etl::is_pointer<TIterator>::value, void>::type
insert(const_iterator position, TIterator first, TIterator last)
{
size_t count = etl::distance(first, last);
size_t count = static_cast<size_t>(etl::distance(first, last));
iterator position_ = to_iterator(position);

View File

@ -120,7 +120,7 @@ namespace etl
size_t size() const
{
return etl::distance(cbegin(), cend());
return static_cast<size_t>(etl::distance(cbegin(), cend()));
}
constexpr decltype(auto) front()
@ -512,7 +512,7 @@ namespace etl
{
return etl::numeric_limits<T>::max();
}
return _bound - _value;
return static_cast<size_t>(_bound - _value);
}
constexpr bool empty() const noexcept
@ -588,20 +588,20 @@ namespace etl
return tmp;
}
repeat_iterator& operator+=(size_t n)
repeat_iterator& operator+=(difference_type n)
{
_i -= n;
_i -= static_cast<B>(n);
return *this;
}
repeat_iterator operator+(size_t n) const
repeat_iterator operator+(difference_type n) const
{
return repeat_iterator{_value, static_cast<B>(_i - n)};
return repeat_iterator{_value, static_cast<B>(_i - static_cast<B>(n))};
}
repeat_iterator operator-(size_t n) const
repeat_iterator operator-(difference_type n) const
{
return repeat_iterator{_value, static_cast<B>(_i + n)};
return repeat_iterator{_value, static_cast<B>(_i + static_cast<B>(n))};
}
difference_type operator-(repeat_iterator other) const
@ -666,7 +666,7 @@ namespace etl
constexpr size_t size() const noexcept
{
return _bound;
return static_cast<size_t>(_bound);
}
constexpr bool empty() const noexcept
@ -738,7 +738,7 @@ namespace etl
constexpr size_t size() const
{
return etl::distance(begin(), end());
return static_cast<size_t>(etl::distance(begin(), end()));
}
constexpr pointer data() const
@ -835,7 +835,7 @@ namespace etl
constexpr size_t size() const
{
return etl::distance(begin(), end());
return static_cast<size_t>(etl::distance(begin(), end()));
}
constexpr pointer data()
@ -1238,7 +1238,7 @@ namespace etl
constexpr size_t size() const
{
return etl::distance(ETL_OR_STD::cbegin(_r), ETL_OR_STD::cend(_r));
return static_cast<size_t>(etl::distance(ETL_OR_STD::cbegin(_r), ETL_OR_STD::cend(_r)));
}
private:
const Fun _fun;
@ -1320,7 +1320,7 @@ namespace etl
constexpr size_t size() const
{
return etl::distance(ETL_OR_STD::cbegin(_r), ETL_OR_STD::cend(_r));
return static_cast<size_t>(etl::distance(ETL_OR_STD::cbegin(_r), ETL_OR_STD::cend(_r)));
}
private:
@ -1397,7 +1397,7 @@ namespace etl
constexpr size_t size() const
{
return etl::distance(ETL_OR_STD::cbegin(_r), ETL_OR_STD::cend(_r));
return static_cast<size_t>(etl::distance(ETL_OR_STD::cbegin(_r), ETL_OR_STD::cend(_r)));
}
private:
@ -1605,7 +1605,7 @@ namespace etl
constexpr size_t size() const
{
return etl::distance(ETL_OR_STD::cbegin(_r), ETL_OR_STD::cend(_r));
return static_cast<size_t>(etl::distance(ETL_OR_STD::cbegin(_r), ETL_OR_STD::cend(_r)));
}
private:
@ -1683,7 +1683,7 @@ namespace etl
constexpr size_t size() const
{
return etl::distance(ETL_OR_STD::begin(_r), ETL_OR_STD::end(_r));
return static_cast<size_t>(etl::distance(ETL_OR_STD::begin(_r), ETL_OR_STD::end(_r)));
}
private:
@ -1769,7 +1769,7 @@ namespace etl
_begin_cache = drop_begin();
_begin_cache_valid = true;
}
return etl::distance(_begin_cache, ETL_OR_STD::end(_r));
return static_cast<size_t>(etl::distance(_begin_cache, ETL_OR_STD::end(_r)));
}
private:
@ -1996,7 +1996,7 @@ namespace etl
template<typename Range>
constexpr auto operator()(Range&& r) const
{
return take_view(views::all(etl::forward<Range>(r)), _take_n);
return take_view(views::all(etl::forward<Range>(r)), static_cast<ranges::range_difference_t<Range>>(_take_n));
}
const size_t _take_n;
@ -4002,7 +4002,7 @@ namespace etl
constexpr size_t size() const
{
return etl::distance(ETL_OR_STD::begin(_r), ETL_OR_STD::end(_r));
return static_cast<size_t>(etl::distance(ETL_OR_STD::begin(_r), ETL_OR_STD::end(_r)));
}
private:
@ -4184,12 +4184,12 @@ namespace etl
constexpr const_iterator end() const
{
return const_iterator(ETL_OR_STD::end(_r), etl::distance(ETL_OR_STD::cbegin(_r), ETL_OR_STD::cend(_r)));
return const_iterator(ETL_OR_STD::end(_r), static_cast<size_t>(etl::distance(ETL_OR_STD::cbegin(_r), ETL_OR_STD::cend(_r))));
}
constexpr size_t size() const
{
return etl::distance(ETL_OR_STD::cbegin(_r), ETL_OR_STD::cend(_r));
return static_cast<size_t>(etl::distance(ETL_OR_STD::cbegin(_r), ETL_OR_STD::cend(_r)));
}
private:
@ -4337,7 +4337,7 @@ namespace etl
constexpr size_t size() const
{
return etl::distance(ETL_OR_STD::cbegin(_r), ETL_OR_STD::cend(_r));
return static_cast<size_t>(etl::distance(ETL_OR_STD::cbegin(_r), ETL_OR_STD::cend(_r)));
}
private:
@ -4939,7 +4939,7 @@ namespace etl
template<typename Range>
constexpr auto operator()(Range&& r) const
{
return chunk_view(views::all(etl::forward<Range>(r)), _chunk_size);
return chunk_view(views::all(etl::forward<Range>(r)), static_cast<typename chunk_view<views::all_t<Range>>::difference_type>(_chunk_size));
}
const size_t _chunk_size;
@ -5107,7 +5107,7 @@ namespace etl
template<typename Range>
constexpr auto operator()(Range&& r) const
{
return slide_view(views::all(etl::forward<Range>(r)), _window_size);
return slide_view(views::all(etl::forward<Range>(r)), static_cast<typename slide_view<views::all_t<Range>>::difference_type>(_window_size));
}
const size_t _window_size;
@ -5447,7 +5447,7 @@ namespace etl
template<typename Range>
constexpr auto operator()(Range&& r) const
{
return stride_view(views::all(etl::forward<Range>(r)), _stride_n);
return stride_view(views::all(etl::forward<Range>(r)), static_cast<typename stride_view<views::all_t<Range>>::difference_type>(_stride_n));
}
const size_t _stride_n;
@ -5799,7 +5799,7 @@ namespace etl
constexpr size_t size() const
{
return etl::distance(ETL_OR_STD::cbegin(_r), ETL_OR_STD::cend(_r));
return static_cast<size_t>(etl::distance(ETL_OR_STD::cbegin(_r), ETL_OR_STD::cend(_r)));
}
private:

View File

@ -517,7 +517,7 @@ namespace etl
}
else
{
size_t d = etl::distance(range.first, range.second);
size_t d = static_cast<size_t>(etl::distance(range.first, range.second));
erase(range.first, range.second);
return d;
}
@ -536,7 +536,7 @@ namespace etl
}
else
{
size_t d = etl::distance(range.first, range.second);
size_t d = static_cast<size_t>(etl::distance(range.first, range.second));
erase(range.first, range.second);
return d;
}
@ -684,7 +684,7 @@ namespace etl
{
ETL_OR_STD::pair<const_iterator, const_iterator> range = equal_range(key);
return etl::distance(range.first, range.second);
return static_cast<size_t>(etl::distance(range.first, range.second));
}
#if ETL_USING_CPP11
@ -694,7 +694,7 @@ namespace etl
{
ETL_OR_STD::pair<const_iterator, const_iterator> range = equal_range(key);
return etl::distance(range.first, range.second);
return static_cast<size_t>(etl::distance(range.first, range.second));
}
#endif

View File

@ -509,7 +509,7 @@ namespace etl
}
else
{
size_t d = etl::distance(range.first, range.second);
size_t d = static_cast<size_t>(etl::distance(range.first, range.second));
erase(range.first, range.second);
return d;
}
@ -528,7 +528,7 @@ namespace etl
}
else
{
size_t d = etl::distance(range.first, range.second);
size_t d = static_cast<size_t>(etl::distance(range.first, range.second));
erase(range.first, range.second);
return d;
}
@ -676,7 +676,7 @@ namespace etl
{
ETL_OR_STD::pair<const_iterator, const_iterator> range = equal_range(key);
return etl::distance(range.first, range.second);
return static_cast<size_t>(etl::distance(range.first, range.second));
}
#if ETL_USING_CPP11
@ -686,7 +686,7 @@ namespace etl
{
ETL_OR_STD::pair<const_iterator, const_iterator> range = equal_range(key);
return etl::distance(range.first, range.second);
return static_cast<size_t>(etl::distance(range.first, range.second));
}
#endif

View File

@ -816,7 +816,7 @@ namespace etl
{
const T quotient = numerator / denominator;
const T remainder = numerator % denominator;
const T direction = ((numerator >= 0U) == (denominator >= 0U)) ? 1 : -1;
const T direction = ((numerator >= 0U) == (denominator >= 0U)) ? T(1) : T(-1);
if ((remainder * 2U) < denominator)
{

View File

@ -326,7 +326,7 @@ namespace etl
if ((etl::absolute(value) % scale_t(Scaling)) == scale_t(Scaling / 2U))
{
// Odd?
if ((value / scale_t(Scaling)) & 1U)
if (static_cast<unsigned int>(value / scale_t(Scaling)) & 1U)
{
return T(round_half_up_unscaled<Scaling>(value));
}
@ -381,7 +381,7 @@ namespace etl
if ((etl::absolute(value) % scale_t(Scaling)) == scale_t(Scaling / 2U))
{
// Odd?
if ((value / scale_t(Scaling)) & 1U)
if (static_cast<unsigned int>(value / scale_t(Scaling)) & 1U)
{
return T(round_half_down_unscaled<Scaling>(value));
}

View File

@ -204,7 +204,7 @@ namespace etl
//*************************************************************************
ETL_NODISCARD uint32_t get_reference_count() const
{
return p_rcmessage->get_reference_counter().get_reference_count();
return static_cast<uint32_t>(p_rcmessage->get_reference_counter().get_reference_count());
}
//*************************************************************************

View File

@ -274,7 +274,7 @@ namespace etl
//*************************************************************************
ETL_CONSTEXPR14 size_type size() const ETL_NOEXCEPT
{
return etl::distance(begin(), end());
return static_cast<size_type>(etl::distance(begin(), end()));
}
//*************************************************************************

View File

@ -46,7 +46,7 @@ namespace etl
struct sqrt
{
typedef typename etl::conditional<((Root * Root) > Value),
etl::constant<intmax_t, Root - 1>,
etl::constant<intmax_t, static_cast<intmax_t>(Root - 1)>,
etl::sqrt<Value, Root + 1> >::type type;
#if ETL_USING_CPP11

View File

@ -593,7 +593,7 @@ namespace etl
{
if (this->is_within_buffer(etl::addressof(*first)))
{
this->current_size = etl::distance(first, last);
this->current_size = static_cast<size_type>(etl::distance(first, last));
}
else
{
@ -614,7 +614,7 @@ namespace etl
{
if (this->is_within_buffer(etl::addressof(*first)))
{
this->current_size = etl::distance(first, last);
this->current_size = static_cast<size_type>(etl::distance(first, last));
}
else
{

View File

@ -159,7 +159,7 @@ namespace etl
pbegin = view.data() + first;
}
return TStringView(pbegin, etl::distance(pbegin, view.data() + view.size()));
return TStringView(pbegin, static_cast<size_t>(etl::distance(pbegin, view.data() + view.size())));
}
//***************************************************************************
@ -249,7 +249,7 @@ namespace etl
pend += last;
}
return TStringView(view.data(), etl::distance(view.data(), pend));
return TStringView(view.data(), static_cast<size_t>(etl::distance(view.data(), pend)));
}
//***************************************************************************
@ -298,7 +298,7 @@ namespace etl
if (last != TStringView::npos)
{
pend += last;
return TStringView(view.data(), etl::distance(view.data(), pend));
return TStringView(view.data(), static_cast<size_t>(etl::distance(view.data(), pend)));
}
else
{
@ -350,7 +350,7 @@ namespace etl
pend += last;
}
return TStringView(pbegin, etl::distance(pbegin, pend));
return TStringView(pbegin, static_cast<size_t>(etl::distance(pbegin, pend)));
}
//***************************************************************************
@ -397,7 +397,7 @@ namespace etl
pend += last;
}
return TStringView(pbegin, etl::distance(pbegin, pend));
return TStringView(pbegin, static_cast<size_t>(etl::distance(pbegin, pend)));
}
//***************************************************************************
@ -408,7 +408,7 @@ namespace etl
{
n = (n > s.size()) ? s.size() : n;
s.erase(s.begin() + n, s.end());
s.erase(s.begin() + static_cast<typename TIString::difference_type>(n), s.end());
}
//***************************************************************************
@ -430,7 +430,7 @@ namespace etl
{
n = (n > s.size()) ? s.size() : n;
s.erase(s.begin(), s.end() - n);
s.erase(s.begin(), s.end() - static_cast<typename TIString::difference_type>(n));
}
//***************************************************************************
@ -736,7 +736,7 @@ namespace etl
// Does the last view have valid data?
if (view.data() != ETL_NULLPTR)
{
position = etl::distance(begin_ptr, view.data() + view.size() + 1U);
position = static_cast<typename TStringView::size_type>(etl::distance(begin_ptr, view.data() + view.size() + 1U));
// Have we reached the end of the string?
if (position > input.size())
@ -749,7 +749,7 @@ namespace etl
const_pointer first_ptr = begin_ptr + position;
const_pointer last_ptr = find_first_of(first_ptr, end_ptr, delimiters);
view = TStringView(first_ptr, etl::distance(first_ptr, last_ptr));
view = TStringView(first_ptr, static_cast<size_t>(etl::distance(first_ptr, last_ptr)));
token_found = ((view.size() != 0U) || !ignore_empty_tokens);
}

View File

@ -562,7 +562,7 @@ namespace etl
}
else
{
return etl::distance(begin(), iposition);
return static_cast<size_type>(etl::distance(begin(), iposition));
}
}
@ -604,7 +604,7 @@ namespace etl
}
else
{
return etl::distance(begin(), iposition);
return static_cast<size_type>(etl::distance(begin(), iposition));
}
}
@ -676,7 +676,7 @@ namespace etl
position = etl::min(position, size() - 1);
const_reverse_iterator it = rbegin() + size() - position - 1;
const_reverse_iterator it = rbegin() + static_cast<ptrdiff_t>(size() - position - 1);
while (it != rend())
{
@ -773,7 +773,7 @@ namespace etl
position = etl::min(position, size() - 1);
const_reverse_iterator it = rbegin() + size() - position - 1;
const_reverse_iterator it = rbegin() + static_cast<ptrdiff_t>(size() - position - 1);
while (it != rend())
{
@ -1018,7 +1018,7 @@ template <typename T>
std::basic_ostream<T, std::char_traits<T> > &operator<<(std::basic_ostream<T, std::char_traits<T> > &os,
etl::basic_string_view<T, etl::char_traits<T> > text)
{
os.write(text.data(), text.size());
os.write(text.data(), static_cast<std::streamsize>(text.size()));
return os;
}
#endif

View File

@ -397,11 +397,11 @@ namespace etl
const char digit = digit_value(c, radix);
// No addition overflow?
is_not_overflow = ((maximum - digit) >= integral_value);
is_not_overflow = ((maximum - static_cast<TValue>(digit)) >= integral_value);
if ((maximum - digit) >= integral_value)
if ((maximum - static_cast<TValue>(digit)) >= integral_value)
{
integral_value += digit;
integral_value += static_cast<TValue>(digit);
is_success = true;
}
}
@ -762,7 +762,7 @@ namespace etl
const uvalue_t uvalue = static_cast<uvalue_t>(accumulator_result.value());
// Convert from the accumulator type to the desired type.
result = (is_negative ? static_cast<TValue>(0) - uvalue : etl::bit_cast<TValue>(uvalue));
result = (is_negative ? static_cast<TValue>(static_cast<TValue>(0) - static_cast<TValue>(uvalue)) : etl::bit_cast<TValue>(uvalue));
}
}
}

View File

@ -75,7 +75,7 @@ namespace etl
template <typename T>
#endif
ETL_CONSTEXPR type_def(T value_) ETL_NOEXCEPT
: value(value_)
: value(static_cast<TValue>(value_))
{
}
@ -130,7 +130,7 @@ namespace etl
#endif
operator +=(T rhs) ETL_NOEXCEPT
{
value += rhs;
value += static_cast<TValue>(rhs);
return *this;
}
@ -152,7 +152,7 @@ namespace etl
#endif
operator -=(T rhs) ETL_NOEXCEPT
{
value -= rhs;
value -= static_cast<TValue>(rhs);
return *this;
}
@ -173,7 +173,7 @@ namespace etl
#endif
operator *=(T rhs) ETL_NOEXCEPT
{
value *= rhs;
value *= static_cast<TValue>(rhs);
return *this;
}
@ -194,7 +194,7 @@ namespace etl
#endif
operator /=(T rhs) ETL_NOEXCEPT
{
value /= rhs;
value /= static_cast<TValue>(rhs);
return *this;
}
@ -215,7 +215,7 @@ namespace etl
#endif
operator %=(T rhs) ETL_NOEXCEPT
{
value %= rhs;
value %= static_cast<TValue>(rhs);
return *this;
}
@ -236,7 +236,7 @@ namespace etl
#endif
operator &=(T rhs) ETL_NOEXCEPT
{
value &= rhs;
value &= static_cast<TValue>(rhs);
return *this;
}
@ -257,7 +257,7 @@ namespace etl
#endif
operator |=(T rhs) ETL_NOEXCEPT
{
value |= rhs;
value |= static_cast<TValue>(rhs);
return *this;
}
@ -278,7 +278,7 @@ namespace etl
#endif
operator ^=(T rhs) ETL_NOEXCEPT
{
value ^= rhs;
value ^= static_cast<TValue>(rhs);
return *this;
}
@ -294,7 +294,7 @@ namespace etl
ETL_CONSTEXPR14 typename etl::enable_if<etl::is_integral<T>::value, type_def&>::type
operator <<=(T rhs) ETL_NOEXCEPT
{
value <<= rhs;
value <<= static_cast<TValue>(rhs);
return *this;
}
@ -303,7 +303,7 @@ namespace etl
ETL_CONSTEXPR14 typename etl::enable_if<etl::is_integral<T>::value, type_def&>::type
operator >>=(T rhs) ETL_NOEXCEPT
{
value >>= rhs;
value >>= static_cast<TValue>(rhs);
return *this;
}
@ -336,14 +336,14 @@ namespace etl
#endif
operator +(const type_def& lhs, T rhs) ETL_NOEXCEPT
{
return type_def(lhs.value + rhs);
return type_def(lhs.value + static_cast<TValue>(rhs));
}
//*********************************************************************
template <typename T>
friend ETL_CONSTEXPR type_def operator +(T lhs, const type_def& rhs) ETL_NOEXCEPT
{
return type_def(lhs + rhs.value);
return type_def(static_cast<TValue>(lhs) + rhs.value);
}
//*********************************************************************
@ -364,7 +364,7 @@ namespace etl
#endif
operator -(const type_def& lhs, T rhs) ETL_NOEXCEPT
{
return type_def(lhs.value - rhs);
return type_def(lhs.value - static_cast<TValue>(rhs));
}
//*********************************************************************
@ -377,7 +377,7 @@ namespace etl
#endif
operator -(T lhs, const type_def& rhs) ETL_NOEXCEPT
{
return type_def(lhs - rhs.value);
return type_def(static_cast<TValue>(lhs) - rhs.value);
}
//*********************************************************************
@ -398,7 +398,7 @@ namespace etl
#endif
operator *(const type_def& lhs, T rhs) ETL_NOEXCEPT
{
return type_def(lhs.value * rhs);
return type_def(lhs.value * static_cast<TValue>(rhs));
}
//*********************************************************************
@ -411,7 +411,7 @@ namespace etl
#endif
operator *(T lhs, const type_def& rhs) ETL_NOEXCEPT
{
return type_def(lhs * rhs.value);
return type_def(static_cast<TValue>(lhs) * rhs.value);
}
//*********************************************************************
@ -432,7 +432,7 @@ namespace etl
#endif
operator /(const type_def& lhs, T rhs) ETL_NOEXCEPT
{
return type_def(lhs.value / rhs);
return type_def(lhs.value / static_cast<TValue>(rhs));
}
//*********************************************************************
@ -445,7 +445,7 @@ namespace etl
#endif
operator /(T lhs, const type_def& rhs) ETL_NOEXCEPT
{
return type_def(lhs / rhs.value);
return type_def(static_cast<TValue>(lhs) / rhs.value);
}
//*********************************************************************
@ -464,7 +464,7 @@ namespace etl
#endif
operator %(const type_def& lhs, T rhs) ETL_NOEXCEPT
{
return type_def(lhs.value % rhs);
return type_def(lhs.value % static_cast<TValue>(rhs));
}
//*********************************************************************
@ -479,7 +479,7 @@ namespace etl
#endif
operator %(T lhs, const type_def& rhs) ETL_NOEXCEPT
{
return type_def(lhs % rhs.value);
return type_def(static_cast<TValue>(lhs) % rhs.value);
}
//*********************************************************************
@ -500,7 +500,7 @@ namespace etl
#endif
operator &(const type_def& lhs, T rhs) ETL_NOEXCEPT
{
return type_def(lhs.value & rhs);
return type_def(lhs.value & static_cast<TValue>(rhs));
}
//*********************************************************************
@ -513,7 +513,7 @@ namespace etl
#endif
operator &(T lhs, const type_def& rhs) ETL_NOEXCEPT
{
return type_def(lhs & rhs.value);
return type_def(static_cast<TValue>(lhs) & rhs.value);
}
//*********************************************************************
@ -534,7 +534,7 @@ namespace etl
#endif
operator |(const type_def& lhs, T rhs) ETL_NOEXCEPT
{
return type_def(lhs.value | rhs);
return type_def(lhs.value | static_cast<TValue>(rhs));
}
//*********************************************************************
@ -547,7 +547,7 @@ namespace etl
#endif
operator |(T lhs, const type_def& rhs) ETL_NOEXCEPT
{
return type_def(lhs | rhs.value);
return type_def(static_cast<TValue>(lhs) | rhs.value);
}
//*********************************************************************
@ -568,7 +568,7 @@ namespace etl
#endif
operator ^(const type_def& lhs, T rhs) ETL_NOEXCEPT
{
return type_def(lhs.value ^ rhs);
return type_def(lhs.value ^ static_cast<TValue>(rhs));
}
//*********************************************************************
@ -581,7 +581,7 @@ namespace etl
#endif
operator ^(T lhs, const type_def& rhs) ETL_NOEXCEPT
{
return type_def(lhs ^ rhs.value);
return type_def(static_cast<TValue>(lhs) ^ rhs.value);
}
//*********************************************************************
@ -597,7 +597,7 @@ namespace etl
friend ETL_CONSTEXPR typename etl::enable_if<etl::is_integral<T>::value, type_def>::type
operator <<(const type_def& lhs, T rhs) ETL_NOEXCEPT
{
return type_def(lhs.value << rhs);
return type_def(lhs.value << static_cast<TValue>(rhs));
}
//*********************************************************************
@ -615,7 +615,7 @@ namespace etl
friend ETL_CONSTEXPR typename etl::enable_if<etl::is_integral<T>::value, type_def>::type
operator >>(const type_def& lhs, T rhs) ETL_NOEXCEPT
{
return type_def(lhs.value >> rhs);
return type_def(lhs.value >> static_cast<TValue>(rhs));
}
//*********************************************************************

View File

@ -109,7 +109,7 @@ namespace etl
template <int Id>
struct type_from_id
{
using type = typename type_from_id_helper<Id, TTypes...>::type;
using type = typename type_from_id_helper<size_t(Id), TTypes...>::type;
static_assert(!(etl::is_same<nulltype, type>::value), "Invalid id");
};

View File

@ -573,7 +573,7 @@ namespace etl
{
if (this->is_within_buffer(reinterpret_cast<const_iterator>(etl::addressof(*first))))
{
this->current_size = etl::distance(first, last);
this->current_size = static_cast<size_type>(etl::distance(first, last));
}
else
{
@ -594,7 +594,7 @@ namespace etl
{
if (this->is_within_buffer(reinterpret_cast<const_iterator>(etl::addressof(*first))))
{
this->current_size = etl::distance(first, last);
this->current_size = static_cast<size_type>(etl::distance(first, last));
}
else
{

View File

@ -573,7 +573,7 @@ namespace etl
{
if (this->is_within_buffer(reinterpret_cast<const_iterator>(etl::addressof(*first))))
{
this->current_size = etl::distance(first, last);
this->current_size = static_cast<size_type>(etl::distance(first, last));
}
else
{
@ -594,7 +594,7 @@ namespace etl
{
if (this->is_within_buffer(reinterpret_cast<const_iterator>(etl::addressof(*first))))
{
this->current_size = etl::distance(first, last);
this->current_size = static_cast<size_type>(etl::distance(first, last));
}
else
{

View File

@ -593,7 +593,7 @@ namespace etl
{
if (this->is_within_buffer(etl::addressof(*first)))
{
this->current_size = etl::distance(first, last);
this->current_size = static_cast<size_type>(etl::distance(first, last));
}
else
{
@ -614,7 +614,7 @@ namespace etl
{
if (this->is_within_buffer(etl::addressof(*first)))
{
this->current_size = etl::distance(first, last);
this->current_size = static_cast<size_type>(etl::distance(first, last));
}
else
{

View File

@ -489,7 +489,7 @@ namespace etl
//*************************************************************************
unaligned_type(const void* address)
{
etl::copy_n(reinterpret_cast<const char*>(address), sizeof(T), this->storage);
etl::copy_n(reinterpret_cast<const unsigned char*>(address), sizeof(T), this->storage);
}
//*************************************************************************
@ -499,7 +499,7 @@ namespace etl
{
ETL_ASSERT(sizeof(T) <= buffer_size, ETL_ERROR(etl::unaligned_type_buffer_size));
etl::copy_n(reinterpret_cast<const char*>(address), sizeof(T), this->storage);
etl::copy_n(reinterpret_cast<const unsigned char*>(address), sizeof(T), this->storage);
}
//*************************************************************************

View File

@ -783,7 +783,7 @@ namespace etl
iterator position_ = to_iterator(position);
size_t insert_n = n;
size_t insert_begin = etl::distance(begin(), position_);
size_t insert_begin = static_cast<size_t>(etl::distance(begin(), position_));
size_t insert_end = insert_begin + insert_n;
// Copy old data.
@ -835,13 +835,13 @@ namespace etl
template <class TIterator>
void insert(const_iterator position, TIterator first, TIterator last, typename etl::enable_if<!etl::is_integral<TIterator>::value, int>::type = 0)
{
size_t count = etl::distance(first, last);
size_t count = static_cast<size_t>(etl::distance(first, last));
ETL_ASSERT_OR_RETURN((size() + count) <= CAPACITY, ETL_ERROR(vector_full));
ETL_ASSERT_CHECK_EXTRA(cbegin() <= position && position <= cend(), ETL_ERROR(vector_out_of_bounds));
size_t insert_n = count;
size_t insert_begin = etl::distance(cbegin(), position);
size_t insert_begin = static_cast<size_t>(etl::distance(cbegin(), position));
size_t insert_end = insert_begin + insert_n;
// Move old data.
@ -873,11 +873,12 @@ namespace etl
etl::move_backward(p_buffer + insert_begin, p_buffer + insert_begin + copy_old_n, p_buffer + insert_end + copy_old_n);
// Copy construct new.
etl::uninitialized_copy(first + copy_new_n, first + copy_new_n + construct_new_n, p_end);
typedef typename etl::iterator_traits<TIterator>::difference_type diff_t;
etl::uninitialized_copy(first + static_cast<diff_t>(copy_new_n), first + static_cast<diff_t>(copy_new_n + construct_new_n), p_end);
ETL_ADD_DEBUG_COUNT(construct_new_n);
// Copy new.
etl::copy(first, first + copy_new_n, p_buffer + insert_begin);
etl::copy(first, first + static_cast<diff_t>(copy_new_n), p_buffer + insert_begin);
p_end += count;
}
@ -936,7 +937,7 @@ namespace etl
else
{
etl::move(last_, end(), first_);
size_t n_delete = etl::distance(first_, last_);
size_t n_delete = static_cast<size_t>(etl::distance(first_, last_));
// Destroy the elements left over at the end.
etl::destroy(p_end - n_delete, p_end);
@ -965,7 +966,7 @@ namespace etl
etl::swap_ranges(smaller.begin(), smaller.end(), larger.begin());
typename ivector<T>::iterator larger_itr = etl::next(larger.begin(), smaller.size());
typename ivector<T>::iterator larger_itr = etl::next(larger.begin(), static_cast<typename etl::iterator_traits<typename ivector<T>::iterator>::difference_type>(smaller.size()));
etl::move(larger_itr, larger.end(), etl::back_inserter(smaller));
@ -1086,7 +1087,7 @@ namespace etl
//*************************************************************************
void repair_buffer(T* p_buffer_)
{
uintptr_t length = p_end - p_buffer;
uintptr_t length = static_cast<uintptr_t>(p_end - p_buffer);
p_buffer = p_buffer_;
p_end = p_buffer_ + length;
}

View File

@ -573,7 +573,7 @@ namespace etl
{
if (this->is_within_buffer(reinterpret_cast<const_iterator>(etl::addressof(*first))))
{
this->current_size = etl::distance(first, last);
this->current_size = static_cast<size_type>(etl::distance(first, last));
}
else
{
@ -594,7 +594,7 @@ namespace etl
{
if (this->is_within_buffer(reinterpret_cast<const_iterator>(etl::addressof(*first))))
{
this->current_size = etl::distance(first, last);
this->current_size = static_cast<size_type>(etl::distance(first, last));
}
else
{

View File

@ -480,6 +480,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
-Wfloat-equal
-Wshadow
-Wnull-dereference
-Wsign-conversion
-Wextra-semi
-g
${EXTRA_COMPILE_OPTIONS}
@ -499,6 +500,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-Wfloat-equal
-Wshadow
-Wnull-dereference
-Wsign-conversion
-Wextra-semi
-Wextra-semi-stmt
-Wc++11-extra-semi

View File

@ -206,8 +206,8 @@ namespace UnitTest
{
UnitTest::MemoryOutStream stream;
stream << std::hex << std::uppercase << std::setfill('0')
<< "Expected 0x" << std::setw(2 * sizeof(Expected)) << (expected & ~(typename std::make_unsigned<Expected>::type(0)))
<< " but was 0x" << std::setw(2 * sizeof(Actual)) << (actual & ~(typename std::make_unsigned<Actual>::type(0)));
<< "Expected 0x" << std::setw(2 * sizeof(Expected)) << (static_cast<typename std::make_unsigned<Expected>::type>(expected) & ~(typename std::make_unsigned<Expected>::type(0)))
<< " but was 0x" << std::setw(2 * sizeof(Actual)) << (static_cast<typename std::make_unsigned<Actual>::type>(actual) & ~(typename std::make_unsigned<Actual>::type(0)));
results.OnTestFailure(details, stream.GetText());
}

View File

@ -39,12 +39,12 @@
#define FORCE_INLINE inline __attribute__((always_inline))
inline uint32_t rotl32(uint32_t x, int8_t r)
inline uint32_t rotl32(uint32_t x, uint8_t r)
{
return (x << r) | (x >> (32U - r));
}
inline uint64_t rotl64(uint64_t x, int8_t r)
inline uint64_t rotl64(uint64_t x, uint8_t r)
{
return (x << r) | (x >> (64U - r));
}
@ -117,10 +117,10 @@ FORCE_INLINE uint64_t fmix64(uint64_t k)
//-----------------------------------------------------------------------------
void MurmurHash3_x86_32(const void * key, int len, uint32_t seed, void * out)
void MurmurHash3_x86_32(const void * key, uint32_t len, uint32_t seed, void * out)
{
const uint8_t * data = (const uint8_t*)key;
const int nblocks = len / 4;
const int nblocks = static_cast<int>(len / 4);
uint32_t h1 = seed;
@ -154,8 +154,8 @@ void MurmurHash3_x86_32(const void * key, int len, uint32_t seed, void * out)
switch (len & 3)
{
case 3: k1 ^= tail[2] << 16U;
case 2: k1 ^= tail[1] << 8U;
case 3: k1 ^= static_cast<uint32_t>(tail[2]) << 16U;
case 2: k1 ^= static_cast<uint32_t>(tail[1]) << 8U;
case 1: k1 ^= tail[0];
k1 *= c1; k1 = ROTL32(k1, 15); k1 *= c2; h1 ^= k1;
}
@ -172,11 +172,11 @@ void MurmurHash3_x86_32(const void * key, int len, uint32_t seed, void * out)
//-----------------------------------------------------------------------------
void MurmurHash3_x86_128(const void * key, const int len,
void MurmurHash3_x86_128(const void * key, const uint32_t len,
uint32_t seed, void * out)
{
const uint8_t * data = (const uint8_t*)key;
const int nblocks = len / 16;
const int nblocks = static_cast<int>(len / 16);
uint32_t h1 = seed;
uint32_t h2 = seed;
@ -229,27 +229,27 @@ void MurmurHash3_x86_128(const void * key, const int len,
switch (len & 15)
{
case 15: k4 ^= tail[14] << 16U;
case 14: k4 ^= tail[13] << 8U;
case 13: k4 ^= tail[12] << 0U;
case 15: k4 ^= static_cast<uint32_t>(tail[14]) << 16U;
case 14: k4 ^= static_cast<uint32_t>(tail[13]) << 8U;
case 13: k4 ^= static_cast<uint32_t>(tail[12]) << 0U;
k4 *= c4; k4 = ROTL32(k4, 18); k4 *= c1; h4 ^= k4;
case 12: k3 ^= tail[11] << 24U;
case 11: k3 ^= tail[10] << 16U;
case 10: k3 ^= tail[9] << 8U;
case 9: k3 ^= tail[8] << 0U;
case 12: k3 ^= static_cast<uint32_t>(tail[11]) << 24U;
case 11: k3 ^= static_cast<uint32_t>(tail[10]) << 16U;
case 10: k3 ^= static_cast<uint32_t>(tail[9]) << 8U;
case 9: k3 ^= static_cast<uint32_t>(tail[8]) << 0U;
k3 *= c3; k3 = ROTL32(k3, 17); k3 *= c4; h3 ^= k3;
case 8: k2 ^= tail[7] << 24U;
case 7: k2 ^= tail[6] << 16U;
case 6: k2 ^= tail[5] << 8U;
case 5: k2 ^= tail[4] << 0U;
case 8: k2 ^= static_cast<uint32_t>(tail[7]) << 24U;
case 7: k2 ^= static_cast<uint32_t>(tail[6]) << 16U;
case 6: k2 ^= static_cast<uint32_t>(tail[5]) << 8U;
case 5: k2 ^= static_cast<uint32_t>(tail[4]) << 0U;
k2 *= c2; k2 = ROTL32(k2, 16); k2 *= c3; h2 ^= k2;
case 4: k1 ^= tail[3] << 24U;
case 3: k1 ^= tail[2] << 16U;
case 2: k1 ^= tail[1] << 8U;
case 1: k1 ^= tail[0] << 0U;
case 4: k1 ^= static_cast<uint32_t>(tail[3]) << 24U;
case 3: k1 ^= static_cast<uint32_t>(tail[2]) << 16U;
case 2: k1 ^= static_cast<uint32_t>(tail[1]) << 8U;
case 1: k1 ^= static_cast<uint32_t>(tail[0]) << 0U;
k1 *= c1; k1 = ROTL32(k1, 15); k1 *= c2; h1 ^= k1;
}
@ -278,11 +278,11 @@ void MurmurHash3_x86_128(const void * key, const int len,
//-----------------------------------------------------------------------------
#if ETL_USING_64BIT_TYPES
void MurmurHash3_x64_128(const void * key, const int len,
void MurmurHash3_x64_128(const void * key, const uint32_t len,
const uint32_t seed, void * out)
{
const uint8_t * data = (const uint8_t*)key;
const int nblocks = len / 16;
const int nblocks = static_cast<int>(len / 16);
uint64_t h1 = seed;
uint64_t h2 = seed;

View File

@ -30,11 +30,11 @@ typedef unsigned __int64 uint64_t;
//-----------------------------------------------------------------------------
void MurmurHash3_x86_32(const void * key, int len, uint32_t seed, void * out);
void MurmurHash3_x86_32(const void * key, uint32_t len, uint32_t seed, void * out);
void MurmurHash3_x86_128(const void * key, int len, uint32_t seed, void * out);
void MurmurHash3_x86_128(const void * key, uint32_t len, uint32_t seed, void * out);
void MurmurHash3_x64_128(const void * key, int len, uint32_t seed, void * out);
void MurmurHash3_x64_128(const void * key, uint32_t len, uint32_t seed, void * out);
//-----------------------------------------------------------------------------

View File

@ -830,8 +830,8 @@ namespace
unsigned char data1[10];
unsigned char data2[10];
std::fill(std::begin(data1), std::end(data1), char(0x12U));
etl::fill(std::begin(data2), std::end(data2), char(0x12U));
std::fill(std::begin(data1), std::end(data1), static_cast<unsigned char>(0x12U));
etl::fill(std::begin(data2), std::end(data2), static_cast<unsigned char>(0x12U));
bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2));
CHECK(isEqual);
@ -2217,8 +2217,8 @@ namespace
//*************************************************************************
TEST(count)
{
size_t c1 = std::count(std::begin(dataEQ), std::end(dataEQ), 5);
size_t c2 = etl::count(std::begin(dataEQ), std::end(dataEQ), 5);
size_t c1 = static_cast<size_t>(std::count(std::begin(dataEQ), std::end(dataEQ), 5));
size_t c2 = static_cast<size_t>(etl::count(std::begin(dataEQ), std::end(dataEQ), 5));
CHECK(c1 == c2);
}
@ -2234,8 +2234,8 @@ namespace
}
};
size_t c1 = std::count_if(std::begin(dataEQ), std::end(dataEQ), predicate());
size_t c2 = etl::count_if(std::begin(dataEQ), std::end(dataEQ), predicate());
size_t c1 = static_cast<size_t>(std::count_if(std::begin(dataEQ), std::end(dataEQ), predicate()));
size_t c2 = static_cast<size_t>(etl::count_if(std::begin(dataEQ), std::end(dataEQ), predicate()));
CHECK(c1 == c2);
}
@ -4049,8 +4049,8 @@ namespace
auto std_end = std::unique(data1.begin(), data1.end());
auto etl_end = etl::unique(data2.begin(), data2.end());
size_t std_size = std::distance(data1.begin(), std_end);
size_t etl_size = std::distance(data2.begin(), etl_end);
size_t std_size = static_cast<size_t>(std::distance(data1.begin(), std_end));
size_t etl_size = static_cast<size_t>(std::distance(data2.begin(), etl_end));
CHECK_EQUAL(std_size, etl_size);
bool is_same = std::equal(data1.begin(), std_end, data2.begin());
@ -4066,8 +4066,8 @@ namespace
auto std_end = std::unique(data1.begin(), data1.end(), std::equal_to<int>());
auto etl_end = etl::unique(data2.begin(), data2.end(), std::equal_to<int>());
size_t std_size = std::distance(data1.begin(), std_end);
size_t etl_size = std::distance(data2.begin(), etl_end);
size_t std_size = static_cast<size_t>(std::distance(data1.begin(), std_end));
size_t etl_size = static_cast<size_t>(std::distance(data2.begin(), etl_end));
CHECK_EQUAL(std_size, etl_size);
bool is_same = std::equal(data1.begin(), std_end, data2.begin());
@ -4194,8 +4194,8 @@ namespace
auto std_end = std::unique_copy(data.begin(), data.end(), std_result.begin());
auto etl_end = etl::unique_copy(data.begin(), data.end(), etl_result.begin());
size_t std_size = std::distance(std_result.begin(), std_end);
size_t etl_size = std::distance(etl_result.begin(), etl_end);
size_t std_size = static_cast<size_t>(std::distance(std_result.begin(), std_end));
size_t etl_size = static_cast<size_t>(std::distance(etl_result.begin(), etl_end));
CHECK_EQUAL(std_size, etl_size);
bool is_same = std::equal(std_result.begin(), std_end, etl_result.begin());
@ -4212,8 +4212,8 @@ namespace
auto std_end = std::unique_copy(data.begin(), data.end(), std_result.begin(), std::equal_to<int>());
auto etl_end = etl::unique_copy(data.begin(), data.end(), etl_result.begin(), std::equal_to<int>());
size_t std_size = std::distance(std_result.begin(), std_end);
size_t etl_size = std::distance(etl_result.begin(), etl_end);
size_t std_size = static_cast<size_t>(std::distance(std_result.begin(), std_end));
size_t etl_size = static_cast<size_t>(std::distance(etl_result.begin(), etl_end));
CHECK_EQUAL(std_size, etl_size);
bool is_same = std::equal(std_result.begin(), std_end, etl_result.begin());
@ -4362,7 +4362,7 @@ namespace
etl::nth_element(data.begin(), data.begin() + nth_index, data.end());
return data[nth_index];
return data[static_cast<size_t>(nth_index)];
}
TEST(constexpr_nth_element_with_default_less_than_comparison)
@ -12470,13 +12470,13 @@ namespace
CHECK_EQUAL(3, vec[2]);
// All elements before nth should be <= vec[2]
for (int i = 0; i < 2; ++i)
for (size_t i = 0; i < 2; ++i)
{
CHECK(vec[i] <= vec[2]);
}
// All elements after nth should be >= vec[2]
for (int i = 3; i < 5; ++i)
for (size_t i = 3; i < 5; ++i)
{
CHECK(vec[i] >= vec[2]);
}
@ -12492,12 +12492,12 @@ namespace
CHECK(result == vec.end());
CHECK_EQUAL(3, vec[2]);
for (int i = 0; i < 2; ++i)
for (size_t i = 0; i < 2; ++i)
{
CHECK(vec[i] <= vec[2]);
}
for (int i = 3; i < 5; ++i)
for (size_t i = 3; i < 5; ++i)
{
CHECK(vec[i] >= vec[2]);
}
@ -12513,12 +12513,12 @@ namespace
CHECK(result == vec.end());
CHECK_EQUAL(3, vec[2]);
for (int i = 0; i < 2; ++i)
for (size_t i = 0; i < 2; ++i)
{
CHECK(vec[i] >= vec[2]);
}
for (int i = 3; i < 5; ++i)
for (size_t i = 3; i < 5; ++i)
{
CHECK(vec[i] <= vec[2]);
}
@ -12534,12 +12534,12 @@ namespace
CHECK(result == vec.end());
CHECK_EQUAL(3, vec[2]);
for (int i = 0; i < 2; ++i)
for (size_t i = 0; i < 2; ++i)
{
CHECK(vec[i] >= vec[2]);
}
for (int i = 3; i < 5; ++i)
for (size_t i = 3; i < 5; ++i)
{
CHECK(vec[i] <= vec[2]);
}
@ -12556,12 +12556,12 @@ namespace
CHECK_EQUAL(3, vec[2].key);
CHECK_EQUAL(30, vec[2].value);
for (int i = 0; i < 2; ++i)
for (size_t i = 0; i < 2; ++i)
{
CHECK(vec[i].key <= vec[2].key);
}
for (int i = 3; i < 5; ++i)
for (size_t i = 3; i < 5; ++i)
{
CHECK(vec[i].key >= vec[2].key);
}
@ -12578,12 +12578,12 @@ namespace
CHECK_EQUAL(3, vec[2].key);
CHECK_EQUAL(30, vec[2].value);
for (int i = 0; i < 2; ++i)
for (size_t i = 0; i < 2; ++i)
{
CHECK(vec[i].key <= vec[2].key);
}
for (int i = 3; i < 5; ++i)
for (size_t i = 3; i < 5; ++i)
{
CHECK(vec[i].key >= vec[2].key);
}
@ -12635,7 +12635,7 @@ namespace
CHECK_EQUAL(5, vec[4]);
for (int i = 0; i < 4; ++i)
for (size_t i = 0; i < 4; ++i)
{
CHECK(vec[i] <= vec[4]);
}

View File

@ -213,20 +213,20 @@ namespace
CHECK_FALSE(a.has_value());
// Construct in place.
etl::typed_storage<A_t> b(789, 10);
etl::typed_storage<A_t> b(789U, 10U);
CHECK_TRUE(b.has_value());
CHECK_EQUAL(b->x, 789);
CHECK_EQUAL(b->y, 10);
// Create in place.
auto& ref = a.create(123, 4);
auto& ref = a.create(123U, 4U);
CHECK_TRUE(a.has_value());
CHECK_EQUAL(a->x, 123);
CHECK_EQUAL(a->y, 4);
CHECK_EQUAL(a->x, 123U);
CHECK_EQUAL(a->y, 4U);
CHECK_EQUAL(ref.x, 123);
CHECK_EQUAL(ref.y, 4);
CHECK_EQUAL(ref.x, 123U);
CHECK_EQUAL(ref.y, 4U);
CHECK_TRUE(*a == ref);
@ -247,19 +247,19 @@ namespace
CHECK_FALSE(a.has_value());
// Construct in place.
etl::typed_storage_ext<A_t> b(buffer2, 789, 10);
etl::typed_storage_ext<A_t> b(buffer2, 789U, 10U);
CHECK_TRUE(b.has_value());
CHECK_EQUAL(b->x, 789);
CHECK_EQUAL(b->y, 10);
// Create in place.
auto& ref = a.create(123, 4);
CHECK_EQUAL(ref.x, 123);
CHECK_EQUAL(ref.y, 4);
auto& ref = a.create(123U, 4U);
CHECK_EQUAL(ref.x, 123U);
CHECK_EQUAL(ref.y, 4U);
CHECK_TRUE(a.has_value());
CHECK_EQUAL(a->x, 123);
CHECK_EQUAL(a->y, 4);
CHECK_EQUAL(a->x, 123U);
CHECK_EQUAL(a->y, 4U);
CHECK_TRUE(*a == ref);
// Swap

View File

@ -386,7 +386,7 @@ namespace
b64.decode_final(encoded[i].data(), encoded[i].size());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -410,7 +410,7 @@ namespace
b64.decode_final(encoded[i].data(), encoded[i].size());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -451,7 +451,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -492,7 +492,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -516,7 +516,7 @@ namespace
b64.decode_final(encoded[i].begin(), encoded[i].end());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -540,7 +540,7 @@ namespace
b64.decode_final(encoded[i].begin(), encoded[i].end());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -581,7 +581,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -656,7 +656,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -690,7 +690,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -728,7 +728,7 @@ namespace
b64.flush();
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(b64.begin(), b64.end());
#include "etl/private/diagnostic_pop.h"
@ -743,7 +743,7 @@ namespace
template <size_t Size>
constexpr auto GetConstexprBase64(const etl::array<char, Size> input) noexcept
{
etl::array<char, 10> output{ 0 };
etl::array<unsigned char, 10> output{ 0 };
using codec = etl::base64_rfc2152_decoder<codec::safe_output_buffer_size(Size)>;

View File

@ -384,7 +384,7 @@ namespace
b64.decode_final(encoded[i].data(), encoded[i].size());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -408,7 +408,7 @@ namespace
b64.decode_final(encoded[i].data(), encoded[i].size());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -449,7 +449,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -490,7 +490,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -514,7 +514,7 @@ namespace
b64.decode_final(encoded[i].begin(), encoded[i].end());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -538,7 +538,7 @@ namespace
b64.decode_final(encoded[i].begin(), encoded[i].end());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -579,7 +579,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -620,7 +620,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -654,7 +654,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -727,7 +727,7 @@ namespace
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(b64.begin(), b64.end());
#include "etl/private/diagnostic_pop.h"
@ -742,7 +742,7 @@ namespace
template <size_t Size>
constexpr auto GetConstexprBase64(const etl::array<char, Size> input) noexcept
{
etl::array<char, 10> output{ 0 };
etl::array<unsigned char, 10> output{ 0 };
using codec = etl::base64_rfc3501_decoder<codec::safe_output_buffer_size(Size)>;

View File

@ -384,7 +384,7 @@ namespace
b64.decode_final(encoded[i].data(), encoded[i].size());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -408,7 +408,7 @@ namespace
b64.decode_final(encoded[i].data(), encoded[i].size());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -449,7 +449,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -490,7 +490,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -514,7 +514,7 @@ namespace
b64.decode_final(encoded[i].begin(), encoded[i].end());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -538,7 +538,7 @@ namespace
b64.decode_final(encoded[i].begin(), encoded[i].end());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -579,7 +579,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -620,7 +620,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -654,7 +654,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -688,7 +688,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -726,7 +726,7 @@ namespace
b64.flush();
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(b64.begin(), b64.end());
#include "etl/private/diagnostic_pop.h"
@ -741,7 +741,7 @@ namespace
template <size_t Size>
constexpr auto GetConstexprBase64(const etl::array<char, Size> input) noexcept
{
etl::array<char, 10> output{ 0 };
etl::array<unsigned char, 10> output{ 0 };
using codec = etl::base64_rfc4648_url_decoder<codec::safe_output_buffer_size(Size)>;

View File

@ -384,7 +384,7 @@ namespace
b64.decode_final(encoded[i].data(), encoded[i].size());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -408,7 +408,7 @@ namespace
b64.decode_final(encoded[i].data(), encoded[i].size());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -449,7 +449,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -490,7 +490,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -514,7 +514,7 @@ namespace
b64.decode_final(encoded[i].begin(), encoded[i].end());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -579,7 +579,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -620,7 +620,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -688,7 +688,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -726,7 +726,7 @@ namespace
b64.flush();
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(b64.begin(), b64.end());
#include "etl/private/diagnostic_pop.h"
@ -741,7 +741,7 @@ namespace
template <size_t Size>
constexpr auto GetConstexprBase64(const etl::array<char, Size> input) noexcept
{
etl::array<char, 10> output{ 0 };
etl::array<unsigned char, 10> output{ 0 };
using codec = etl::base64_rfc4648_url_padding_decoder<codec::safe_output_buffer_size(Size)>;

View File

@ -384,7 +384,7 @@ namespace
b64.decode_final(encoded[i].data(), encoded[i].size());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -408,7 +408,7 @@ namespace
b64.decode_final(encoded[i].data(), encoded[i].size());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -449,7 +449,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -490,7 +490,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -514,7 +514,7 @@ namespace
b64.decode_final(encoded[i].begin(), encoded[i].end());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -538,7 +538,7 @@ namespace
b64.decode_final(encoded[i].begin(), encoded[i].end());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -579,7 +579,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -620,7 +620,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -654,7 +654,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -688,7 +688,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -726,7 +726,7 @@ namespace
b64.flush();
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(b64.begin(), b64.end());
#include "etl/private/diagnostic_pop.h"
@ -741,7 +741,7 @@ namespace
template <size_t Size>
constexpr auto GetConstexprBase64(const etl::array<char, Size> input) noexcept
{
etl::array<char, 10> output{ 0 };
etl::array<unsigned char, 10> output{ 0 };
using codec = etl::base64_rfc4648_decoder<codec::safe_output_buffer_size(Size)>;

View File

@ -384,7 +384,7 @@ namespace
b64.decode_final(encoded[i].data(), encoded[i].size());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -408,7 +408,7 @@ namespace
b64.decode_final(encoded[i].data(), encoded[i].size());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -449,7 +449,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -490,7 +490,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -514,7 +514,7 @@ namespace
b64.decode_final(encoded[i].begin(), encoded[i].end());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -538,7 +538,7 @@ namespace
b64.decode_final(encoded[i].begin(), encoded[i].end());
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -579,7 +579,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -620,7 +620,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -688,7 +688,7 @@ namespace
CHECK_TRUE(received_final_block);
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(decoded_output);
#include "etl/private/diagnostic_pop.h"
@ -726,7 +726,7 @@ namespace
b64.flush();
#include "etl/private/diagnostic_null_dereference_push.h"
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), i));
std::vector<unsigned char> expected(input_data.begin(), std::next(input_data.begin(), static_cast<ptrdiff_t>(i)));
std::vector<unsigned char> actual(b64.begin(), b64.end());
#include "etl/private/diagnostic_pop.h"
@ -741,7 +741,7 @@ namespace
template <size_t Size>
constexpr auto GetConstexprBase64(const etl::array<char, Size> input) noexcept
{
etl::array<char, 10> output{ 0 };
etl::array<unsigned char, 10> output{ 0 };
using codec = etl::base64_rfc4648_padding_decoder<codec::safe_output_buffer_size(Size)>;

View File

@ -191,13 +191,13 @@ namespace
type value = type(value_);
T mask;
type mask;
for (mask = value >> 1U; mask != 0; mask = mask >> 1U)
{
value = value ^ mask;
}
return value;
return static_cast<T>(value);
}
SUITE(test_binary)
@ -1482,40 +1482,40 @@ namespace
// Shift 0
value = value_initial;
value &= ~value8mask;
value |= value8;
value &= ~static_cast<uint32_t>(value8mask);
value |= static_cast<uint32_t>(value8);
CHECK_EQUAL(-22, (etl::sign_extend<int32_t, 6, 0>(value)));
CHECK_EQUAL(-22, (etl::sign_extend<int64_t, 6, 0>(value)));
// Shift 3
value = value_initial;
value &= ~(value8mask << 3);
value |= (value8 << 3);
value &= ~(static_cast<uint32_t>(value8mask) << 3);
value |= (static_cast<uint32_t>(value8) << 3);
CHECK_EQUAL(-22, (etl::sign_extend<int32_t, 6, 3>(value)));
CHECK_EQUAL(-22, (etl::sign_extend<int64_t, 6, 3>(value)));
// Shift 6
value = value_initial;
value &= ~(value8mask << 6);
value |= (value8 << 6);
value &= ~(static_cast<uint32_t>(value8mask) << 6);
value |= (static_cast<uint32_t>(value8) << 6);
CHECK_EQUAL(-22, (etl::sign_extend<int32_t, 6, 6>(value)));
CHECK_EQUAL(-22, (etl::sign_extend<int64_t, 6, 6>(value)));
// Shift 12
value = value_initial;
value &= ~(value8mask << 12);
value |= (value8 << 12);
value &= ~(static_cast<uint32_t>(value8mask) << 12);
value |= (static_cast<uint32_t>(value8) << 12);
CHECK_EQUAL(-22, (etl::sign_extend<int32_t, 6, 12>(value)));
CHECK_EQUAL(-22, (etl::sign_extend<int64_t, 6, 12>(value)));
// Shift 26
value = value_initial;
value &= ~(value8mask << 26);
value |= (value8 << 26);
value &= ~(static_cast<uint32_t>(value8mask) << 26);
value |= (static_cast<uint32_t>(value8) << 26);
CHECK_EQUAL(-22, (etl::sign_extend<int32_t, 6, 26>(value)));
CHECK_EQUAL(-22, (etl::sign_extend<int64_t, 6, 26>(value)));
@ -1601,40 +1601,40 @@ namespace
// Shift 0
value = value_initial;
value &= ~value8mask;
value |= value8;
value &= ~static_cast<uint32_t>(value8mask);
value |= static_cast<uint32_t>(value8);
CHECK_EQUAL(-22, (etl::sign_extend<int32_t>(value, 6, 0)));
CHECK_EQUAL(-22, (etl::sign_extend<int64_t>(value, 6, 0)));
// Shift 3
value = value_initial;
value &= ~(value8mask << 3);
value |= (value8 << 3);
value &= ~(static_cast<uint32_t>(value8mask) << 3);
value |= (static_cast<uint32_t>(value8) << 3);
CHECK_EQUAL(-22, (etl::sign_extend<int32_t>(value, 6, 3)));
CHECK_EQUAL(-22, (etl::sign_extend<int64_t>(value, 6, 3)));
// Shift 6
value = value_initial;
value &= ~(value8mask << 6);
value |= (value8 << 6);
value &= ~(static_cast<uint32_t>(value8mask) << 6);
value |= (static_cast<uint32_t>(value8) << 6);
CHECK_EQUAL(-22, (etl::sign_extend<int32_t>(value, 6, 6)));
CHECK_EQUAL(-22, (etl::sign_extend<int64_t>(value, 6, 6)));
// Shift 12
value = value_initial;
value &= ~(value8mask << 12);
value |= (value8 << 12);
value &= ~(static_cast<uint32_t>(value8mask) << 12);
value |= (static_cast<uint32_t>(value8) << 12);
CHECK_EQUAL(-22, (etl::sign_extend<int32_t>(value, 6, 12)));
CHECK_EQUAL(-22, (etl::sign_extend<int64_t>(value, 6, 12)));
// Shift 26
value = value_initial;
value &= ~(value8mask << 26);
value |= (value8 << 26);
value &= ~(static_cast<uint32_t>(value8mask) << 26);
value |= (static_cast<uint32_t>(value8) << 26);
CHECK_EQUAL(-22, (etl::sign_extend<int32_t>(value, 6, 26)));
CHECK_EQUAL(-22, (etl::sign_extend<int64_t>(value, 6, 26)));

View File

@ -628,8 +628,8 @@ namespace
char c2 = -91; // 0xA5
unsigned short s1 = 4660; // 0x1234
unsigned short s2 = 22136; // 0x5678
int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF
int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98
int32_t i1 = static_cast<int32_t>(0x89ABCDEFU); // 0x89ABCDEF
int32_t i2 = static_cast<int32_t>(0xFEDCBA98U); // 0xFEDCBA98
std::array<char, 14> storage;
std::array<char, 14> expected = { char(0x5A),
@ -678,8 +678,8 @@ namespace
char c2 = -91; // 0xA5 7 bits
unsigned short s1 = 4660; // 0x1234 13 bits
unsigned short s2 = 22136; // 0x5678 11 bits
int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF 23 bits
int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 25 bits
int32_t i1 = static_cast<int32_t>(0x89ABCDEFU); // 0x89ABCDEF 23 bits
int32_t i2 = static_cast<int32_t>(0xFEDCBA98U); // 0xFEDCBA98 25 bits
std::array<char, 14> storage;
std::array<char, 14> expected = { char(0x6A), char(0x46), char(0x8A), char(0xF3),
@ -724,8 +724,8 @@ namespace
char c2 = -91; // 0xA5 7 bits
unsigned short s1 = 4660U; // 0x1234 13 bits
unsigned short s2 = 22136U; // 0x5678 11 bits
int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF 23 bits
int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 25 bits
int32_t i1 = static_cast<int32_t>(0x89ABCDEFU); // 0x89ABCDEF 23 bits
int32_t i2 = static_cast<int32_t>(0xFEDCBA98U); // 0xFEDCBA98 25 bits
std::array<char, 14> storage;
storage.fill(0);

View File

@ -717,8 +717,8 @@ namespace
char c2 = -91; // 0xA5
unsigned short s1 = 4660; // 0x1234
unsigned short s2 = 22136; // 0x5678
int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF
int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98
int32_t i1 = static_cast<int32_t>(0x89ABCDEFU); // 0x89ABCDEF
int32_t i2 = static_cast<int32_t>(0xFEDCBA98U); // 0xFEDCBA98
std::array<char, 14> storage;
std::array<char, 14> expected = { char(0x5A),
@ -767,8 +767,8 @@ namespace
char c2 = -91; // 0xA5 7 bits
unsigned short s1 = 4660; // 0x1234 13 bits
unsigned short s2 = 22136; // 0x5678 11 bits
int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF 23 bits
int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 25 bits
int32_t i1 = static_cast<int32_t>(0x89ABCDEFU); // 0x89ABCDEF 23 bits
int32_t i2 = static_cast<int32_t>(0xFEDCBA98U); // 0xFEDCBA98 25 bits
std::array<char, 14> storage;
std::array<char, 14> expected = { char(0x58), char(0xB1), char(0x3E), char(0xF6),
@ -811,8 +811,8 @@ namespace
char c2 = -91; // 0xA5 7 bits
unsigned short s1 = 4660; // 0x1234 13 bits
unsigned short s2 = 22136; // 0x5678 11 bits
int32_t i1 = 0x89ABCDEF; // 0x89ABCDEF 23 bits
int32_t i2 = 0xFEDCBA98; // 0xFEDCBA98 25 bits
int32_t i1 = static_cast<int32_t>(0x89ABCDEFU); // 0x89ABCDEF 23 bits
int32_t i2 = static_cast<int32_t>(0xFEDCBA98U); // 0xFEDCBA98 25 bits
std::array<char, 14> storage;
std::array<char, 14> expected = { char(0x58), char(0xB1), char(0x3E), char(0xF6),

View File

@ -1073,7 +1073,7 @@ namespace
{
etl::bitset<64> data(value);
CHECK_EQUAL_HEX((value << shift), (data << shift).value<uint64_t>());
CHECK_EQUAL_HEX((value << shift), (data << static_cast<size_t>(shift)).value<uint64_t>());
}
etl::bitset<64> data(value);
@ -1090,7 +1090,7 @@ namespace
{
etl::bitset<60> data(value);
CHECK_EQUAL_HEX(((value << shift) & mask), (data << shift).value<uint64_t>());
CHECK_EQUAL_HEX(((value << shift) & mask), (data << static_cast<size_t>(shift)).value<uint64_t>());
}
etl::bitset<64> data(value);
@ -1128,7 +1128,7 @@ namespace
{
etl::bitset<64> data(value);
CHECK_EQUAL_HEX((value >> shift), (data >> shift).value<uint64_t>());
CHECK_EQUAL_HEX((value >> shift), (data >> static_cast<size_t>(shift)).value<uint64_t>());
}
etl::bitset<64> data(value);
@ -1145,7 +1145,7 @@ namespace
{
etl::bitset<60> data(value);
CHECK_EQUAL_HEX(((value >> shift) & mask), (data >> shift).value<uint64_t>());
CHECK_EQUAL_HEX(((value >> shift) & mask), (data >> static_cast<size_t>(shift)).value<uint64_t>());
}
etl::bitset<64> data(value);

View File

@ -1125,7 +1125,7 @@ namespace
TEST(test_value_u64_min)
{
ETL_CONSTEXPR14 etl::bitset<64> data((unsigned long long)etl::integral_limits<int64_t>::min);
ETL_CONSTEXPR14 uint64_t value = data.value<int64_t>();
ETL_CONSTEXPR14 uint64_t value = static_cast<uint64_t>(data.value<int64_t>());
CHECK_EQUAL(std::numeric_limits<int64_t>::min(), value);
}
@ -1134,7 +1134,7 @@ namespace
TEST(test_value_u64_max)
{
ETL_CONSTEXPR14 etl::bitset<64> data((unsigned long long)etl::integral_limits<int64_t>::max);
ETL_CONSTEXPR14 uint64_t value = data.value<int64_t>();
ETL_CONSTEXPR14 uint64_t value = static_cast<uint64_t>(data.value<int64_t>());
CHECK_EQUAL(std::numeric_limits<int64_t>::max(), value);
}
@ -1143,7 +1143,7 @@ namespace
TEST(test_value_s64_min)
{
ETL_CONSTEXPR14 etl::bitset<64> data((unsigned long long)etl::integral_limits<int64_t>::min);
ETL_CONSTEXPR14 uint64_t value = data.value<int64_t>();
ETL_CONSTEXPR14 uint64_t value = static_cast<uint64_t>(data.value<int64_t>());
CHECK_EQUAL(std::numeric_limits<int64_t>::min(), value);
}
@ -1152,7 +1152,7 @@ namespace
TEST(test_value_s64_max)
{
ETL_CONSTEXPR14 etl::bitset<64> data((unsigned long long)etl::integral_limits<int64_t>::max);
ETL_CONSTEXPR14 uint64_t value = data.value<int64_t>();
ETL_CONSTEXPR14 uint64_t value = static_cast<uint64_t>(data.value<int64_t>());
CHECK_EQUAL(std::numeric_limits<int64_t>::max(), value);
}
@ -2086,7 +2086,7 @@ namespace
TEST(test_swap)
{
ETL_CONSTEXPR14 etl::bitset<8> compare1(0x2A);
ETL_CONSTEXPR14 etl::bitset<8> compare1(0x2AULL);
ETL_CONSTEXPR14 etl::bitset<8> compare2(0x15);
ETL_CONSTEXPR14 std::pair<etl::bitset<8>, etl::bitset<8>> swapped = test_swap_helper();

View File

@ -1122,7 +1122,7 @@ namespace
TEST(test_value_u64_min)
{
ETL_CONSTEXPR14 etl::bitset<64> data((unsigned long long)etl::integral_limits<int64_t>::min);
ETL_CONSTEXPR14 uint64_t value = data.value<int64_t>();
ETL_CONSTEXPR14 uint64_t value = static_cast<uint64_t>(data.value<int64_t>());
CHECK_EQUAL(std::numeric_limits<int64_t>::min(), value);
}
@ -1131,7 +1131,7 @@ namespace
TEST(test_value_u64_max)
{
ETL_CONSTEXPR14 etl::bitset<64> data((unsigned long long)etl::integral_limits<int64_t>::max);
ETL_CONSTEXPR14 uint64_t value = data.value<int64_t>();
ETL_CONSTEXPR14 uint64_t value = static_cast<uint64_t>(data.value<int64_t>());
CHECK_EQUAL(std::numeric_limits<int64_t>::max(), value);
}
@ -1140,7 +1140,7 @@ namespace
TEST(test_value_s64_min)
{
ETL_CONSTEXPR14 etl::bitset<64> data((unsigned long long)etl::integral_limits<int64_t>::min);
ETL_CONSTEXPR14 uint64_t value = data.value<int64_t>();
ETL_CONSTEXPR14 uint64_t value = static_cast<uint64_t>(data.value<int64_t>());
CHECK_EQUAL(std::numeric_limits<int64_t>::min(), value);
}
@ -1149,7 +1149,7 @@ namespace
TEST(test_value_s64_max)
{
ETL_CONSTEXPR14 etl::bitset<64> data((unsigned long long)etl::integral_limits<int64_t>::max);
ETL_CONSTEXPR14 uint64_t value = data.value<int64_t>();
ETL_CONSTEXPR14 uint64_t value = static_cast<uint64_t>(data.value<int64_t>());
CHECK_EQUAL(std::numeric_limits<int64_t>::max(), value);
}
@ -2209,7 +2209,7 @@ namespace
TEST(test_swap)
{
ETL_CONSTEXPR14 etl::bitset<8, uint8_t> compare1(0x2A);
ETL_CONSTEXPR14 etl::bitset<8, uint8_t> compare1(0x2AULL);
ETL_CONSTEXPR14 etl::bitset<8, uint8_t> compare2(0x15);
ETL_CONSTEXPR14 std::pair<etl::bitset<8, uint8_t>, etl::bitset<8, uint8_t>> swapped = test_swap_helper();

View File

@ -66,7 +66,7 @@ struct hash3_t
size_t operator ()(argument_type text) const
{
return etl::crc16(text, text + etl::char_traits<char>::length(text)) | (etl::crc16_ccitt(text, text + etl::char_traits<char>::length(text)) << 16);
return static_cast<size_t>(etl::crc16(text, text + etl::char_traits<char>::length(text))) | (static_cast<size_t>(etl::crc16_ccitt(text, text + etl::char_traits<char>::length(text))) << 16);
}
};

View File

@ -50,7 +50,7 @@ namespace
for (size_t i = 0UL; i < sizeof(value_type); ++i)
{
uint8_t byte = (value >> (i * 8UL)) & 0xFFU;
uint8_t byte = static_cast<uint8_t>((static_cast<unsigned char>(value) >> (i * 8UL)) & 0xFFU);
checksum = etl::rotate_right(checksum) + byte;
}
}
@ -80,7 +80,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
checksum_calculator.add(data[i]);
checksum_calculator.add(static_cast<uint8_t>(data[i]));
}
uint8_t sum = checksum_calculator;
@ -98,7 +98,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
checksum_calculator.add(data[i]);
checksum_calculator.add(static_cast<uint8_t>(data[i]));
}
uint8_t sum = checksum_calculator;

View File

@ -58,7 +58,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
checksum_calculator.add(data[i]);
checksum_calculator.add(static_cast<uint8_t>(data[i]));
}
uint8_t sum = checksum_calculator;
@ -75,7 +75,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
checksum_calculator.add(data[i]);
checksum_calculator.add(static_cast<uint8_t>(data[i]));
}
uint8_t sum = checksum_calculator;

View File

@ -160,12 +160,12 @@ namespace
{
for (int ds = 0; ds < 256; ++ds)
{
Chrono::day day(d);
Chrono::day day(static_cast<unsigned>(d));
Chrono::days days(ds);
day = day + days;
unsigned expected = (d + ds) % 256;
unsigned expected = static_cast<unsigned>((d + ds) % 256);
CHECK_TRUE(expected_day_ok(day));
CHECK_EQUAL(expected, unsigned(day));
@ -180,12 +180,12 @@ namespace
{
for (int ds = 0; ds < d; ++ds)
{
Chrono::day day(d);
Chrono::day day(static_cast<unsigned>(d));
Chrono::days days(ds);
day = days + day;
unsigned expected = (d + ds) % 256;
unsigned expected = static_cast<unsigned>((d + ds) % 256);
CHECK_TRUE(expected_day_ok(day));
CHECK_EQUAL(expected, unsigned(day));
@ -230,8 +230,8 @@ namespace
{
for (int d2 = 0; d2 < 256; ++d2)
{
Chrono::day day1(d1);
Chrono::day day2(d2);
Chrono::day day1(static_cast<unsigned>(d1));
Chrono::day day2(static_cast<unsigned>(d2));
Chrono::days result_days = day1 - day2;
int expected_days = d1 - d2;
@ -306,7 +306,7 @@ namespace
for (int i = 0; i < 256; ++i)
{
hashes.push_back(etl::hash<Chrono::day>()(Chrono::day(i)));
hashes.push_back(etl::hash<Chrono::day>()(Chrono::day(static_cast<unsigned>(i))));
}
std::sort(hashes.begin(), hashes.end());

View File

@ -172,10 +172,10 @@ namespace
typedef typename etl::ratio_divide<duration_type1::period, duration_type2::period>::type ratio_divide_t;
int microseonds_per_millisecond = duration_type1::period::den / duration_type2::period::den;
size_t microseonds_per_millisecond = static_cast<size_t>(duration_type1::period::den / duration_type2::period::den);
CHECK_EQUAL(1, ratio_divide_t::num);
CHECK_EQUAL(dur1.count(), dur2.count() * microseonds_per_millisecond);
CHECK_EQUAL(dur1.count(), static_cast<size_t>(dur2.count() * microseonds_per_millisecond));
}
#endif
@ -194,7 +194,7 @@ namespace
int microseonds_per_millisecond = duration_type2::period::den / duration_type1::period::den;
CHECK_EQUAL(1, ratio_divide_t::den);
CHECK_EQUAL(dur1.count() * microseonds_per_millisecond, dur2.count());
CHECK_EQUAL(static_cast<int>(dur1.count()) * microseonds_per_millisecond, dur2.count());
}
#endif

View File

@ -63,7 +63,7 @@ namespace
i = 12 + i;
}
return i == 0 ? 12 : i;
return i == 0 ? 12U : static_cast<unsigned>(i);
}
//*************************************************************************
@ -166,7 +166,7 @@ namespace
{
for (int ms = 0; ms <= 24; ++ms)
{
Chrono::month month(m);
Chrono::month month(static_cast<unsigned>(m));
Chrono::months months(ms);
month += months;
@ -183,7 +183,7 @@ namespace
{
for (int ms = 0; ms <= 24; ++ms)
{
Chrono::month month(m);
Chrono::month month(static_cast<unsigned>(m));
Chrono::months months(ms);
month = month + months;
@ -200,7 +200,7 @@ namespace
{
for (int ms = 0; ms <= 24; ++ms)
{
Chrono::month month(m);
Chrono::month month(static_cast<unsigned>(m));
Chrono::months months(ms);
month = months + month;
@ -217,7 +217,7 @@ namespace
{
for (int ms = 0; ms <= 24; ++ms)
{
Chrono::month month(m);
Chrono::month month(static_cast<unsigned>(m));
Chrono::months months(ms);
month -= months;
@ -234,7 +234,7 @@ namespace
{
for (int ms = 0; ms <= 24; ++ms)
{
Chrono::month month(m);
Chrono::month month(static_cast<unsigned>(m));
Chrono::months months(ms);
month = month - months;
@ -252,14 +252,14 @@ namespace
int m1 = m;
int m2 = 13 - m;
Chrono::month month1(m1);
Chrono::month month2(m2);
Chrono::month month1(static_cast<unsigned>(m1));
Chrono::month month2(static_cast<unsigned>(m2));
Chrono::months months12 = month1 - month2;
Chrono::months months21 = month2 - month1;
int difference12 = expected_month(m1) - expected_month(m2);
int difference21 = expected_month(m2) - expected_month(m1);
int difference12 = static_cast<int>(expected_month(m1)) - static_cast<int>(expected_month(m2));
int difference21 = static_cast<int>(expected_month(m2)) - static_cast<int>(expected_month(m1));
difference12 = (difference12 < 0) ? 12 + difference12: difference12;
difference21 = (difference21 < 0) ? 12 + difference21: difference21;
@ -318,7 +318,7 @@ namespace
for (int i = 0; i < 256; ++i)
{
hashes.push_back(etl::hash<Chrono::month>()(Chrono::month(i)));
hashes.push_back(etl::hash<Chrono::month>()(Chrono::month(static_cast<unsigned>(i))));
}
std::sort(hashes.begin(), hashes.end());

View File

@ -110,9 +110,9 @@ namespace
{
std::vector<size_t> hashes;
for (int i = 0; i < 256; ++i)
for (unsigned int i = 0U; i < 256U; ++i)
{
hashes.push_back(etl::hash<Chrono::month_weekday>()(Chrono::month_weekday(Chrono::month((i % 12) + 1), Chrono::weekday_indexed(Chrono::weekday(i % 7), i % 5))));
hashes.push_back(etl::hash<Chrono::month_weekday>()(Chrono::month_weekday(Chrono::month((i % 12U) + 1U), Chrono::weekday_indexed(Chrono::weekday(i % 7U), i % 5U))));
}
std::sort(hashes.begin(), hashes.end());

View File

@ -111,9 +111,9 @@ namespace
{
std::vector<size_t> hashes;
for (int i = 0; i < 256; ++i)
for (unsigned int i = 0U; i < 256U; ++i)
{
hashes.push_back(etl::hash<Chrono::month_weekday_last>()(Chrono::month_weekday_last(Chrono::month((i % 12) + 1), Chrono::weekday_last(Chrono::weekday(i % 7)))));
hashes.push_back(etl::hash<Chrono::month_weekday_last>()(Chrono::month_weekday_last(Chrono::month((i % 12U) + 1U), Chrono::weekday_last(Chrono::weekday(i % 7U)))));
}
std::sort(hashes.begin(), hashes.end());

View File

@ -290,11 +290,11 @@ namespace
{
for (int m = 0; m < 7; ++m)
{
Chrono::weekday weekday1(m);
Chrono::weekday weekday2(7 - m);
Chrono::weekday weekday1(static_cast<unsigned>(m));
Chrono::weekday weekday2(static_cast<unsigned>(7 - m));
Chrono::weekday std_weekday1(m);
Chrono::weekday std_weekday2(7 - m);
Chrono::weekday std_weekday1(static_cast<unsigned>(m));
Chrono::weekday std_weekday2(static_cast<unsigned>(7 - m));
auto days12 = weekday1 - weekday2;
auto days21 = weekday2 - weekday1;
@ -339,8 +339,8 @@ namespace
//*************************************************************************
TEST(test_weekday_comparison_operators)
{
Chrono::weekday weekday1(1);
Chrono::weekday weekday2(2);
Chrono::weekday weekday1(static_cast<unsigned>(1));
Chrono::weekday weekday2(static_cast<unsigned>(2));
CHECK_TRUE(weekday1 == weekday1);
CHECK_FALSE(weekday1 != weekday1);
@ -375,7 +375,7 @@ namespace
for (int i = 0; i < 256; ++i)
{
hashes.push_back(etl::hash<Chrono::weekday>()(Chrono::weekday(i)));
hashes.push_back(etl::hash<Chrono::weekday>()(Chrono::weekday(static_cast<unsigned>(i))));
}
std::sort(hashes.begin(), hashes.end());

View File

@ -146,13 +146,13 @@ namespace
for (int i = 0; i < 6; ++i)
{
hashes.push_back(etl::hash<Chrono::weekday_indexed>()(Chrono::weekday_indexed(Chrono::Monday, i)));
hashes.push_back(etl::hash<Chrono::weekday_indexed>()(Chrono::weekday_indexed(Chrono::Tuesday, i)));
hashes.push_back(etl::hash<Chrono::weekday_indexed>()(Chrono::weekday_indexed(Chrono::Wednesday, i)));
hashes.push_back(etl::hash<Chrono::weekday_indexed>()(Chrono::weekday_indexed(Chrono::Thursday, i)));
hashes.push_back(etl::hash<Chrono::weekday_indexed>()(Chrono::weekday_indexed(Chrono::Friday, i)));
hashes.push_back(etl::hash<Chrono::weekday_indexed>()(Chrono::weekday_indexed(Chrono::Saturday, i)));
hashes.push_back(etl::hash<Chrono::weekday_indexed>()(Chrono::weekday_indexed(Chrono::Sunday, i)));
hashes.push_back(etl::hash<Chrono::weekday_indexed>()(Chrono::weekday_indexed(Chrono::Monday, static_cast<unsigned>(i))));
hashes.push_back(etl::hash<Chrono::weekday_indexed>()(Chrono::weekday_indexed(Chrono::Tuesday, static_cast<unsigned>(i))));
hashes.push_back(etl::hash<Chrono::weekday_indexed>()(Chrono::weekday_indexed(Chrono::Wednesday, static_cast<unsigned>(i))));
hashes.push_back(etl::hash<Chrono::weekday_indexed>()(Chrono::weekday_indexed(Chrono::Thursday, static_cast<unsigned>(i))));
hashes.push_back(etl::hash<Chrono::weekday_indexed>()(Chrono::weekday_indexed(Chrono::Friday, static_cast<unsigned>(i))));
hashes.push_back(etl::hash<Chrono::weekday_indexed>()(Chrono::weekday_indexed(Chrono::Saturday, static_cast<unsigned>(i))));
hashes.push_back(etl::hash<Chrono::weekday_indexed>()(Chrono::weekday_indexed(Chrono::Sunday, static_cast<unsigned>(i))));
}
std::sort(hashes.begin(), hashes.end());

View File

@ -559,7 +559,7 @@ namespace
while ((offset += step) < int(data.size() - 1))
{
itr = itr + step;
CHECK_EQUAL(compare[offset], *itr);
CHECK_EQUAL(compare[static_cast<size_t>(offset)], *itr);
}
}
}
@ -582,7 +582,7 @@ namespace
while ((offset += step) < int(data.size() - 1))
{
itr = itr + step;
CHECK_EQUAL(compare[offset], *itr);
CHECK_EQUAL(compare[static_cast<size_t>(offset)], *itr);
}
}
}
@ -605,7 +605,7 @@ namespace
while ((offset += step) < int(data.size() - 1))
{
itr += + step;
CHECK_EQUAL(compare[offset], *itr);
CHECK_EQUAL(compare[static_cast<size_t>(offset)], *itr);
}
}
}
@ -628,7 +628,7 @@ namespace
while ((offset += step) < int(data.size() - 1))
{
itr += step;
CHECK_EQUAL(compare[offset], *itr);
CHECK_EQUAL(compare[static_cast<size_t>(offset)], *itr);
}
}
}
@ -651,7 +651,7 @@ namespace
while ((offset -= step) > 0)
{
itr = itr - step;
CHECK_EQUAL(compare[offset], *itr);
CHECK_EQUAL(compare[static_cast<size_t>(offset)], *itr);
}
}
}
@ -674,7 +674,7 @@ namespace
while ((offset -= step) > 0)
{
itr = itr - step;
CHECK_EQUAL(compare[offset], *itr);
CHECK_EQUAL(compare[static_cast<size_t>(offset)], *itr);
}
}
}
@ -697,7 +697,7 @@ namespace
while ((offset -= step) > 0)
{
itr -= step;
CHECK_EQUAL(compare[offset], *itr);
CHECK_EQUAL(compare[static_cast<size_t>(offset)], *itr);
}
}
}
@ -720,7 +720,7 @@ namespace
while ((offset -= step) > 0)
{
itr -= step;
CHECK_EQUAL(compare[offset], *itr);
CHECK_EQUAL(compare[static_cast<size_t>(offset)], *itr);
}
}
}

View File

@ -570,17 +570,17 @@ namespace
Data data(buffer1.raw, SIZE);
data.push(input1.begin(), input1.end());
for (int i = 0; i < int(SIZE); ++i)
for (size_t i = 0U; i < SIZE; ++i)
{
CHECK_EQUAL(input1[i + 3], data[i]);
CHECK_EQUAL(input1[i + 3U], data[i]);
}
for (int i = 0; i < int(SIZE); ++i)
for (size_t i = 0U; i < SIZE; ++i)
{
data[i] = input2[i];
}
for (int i = 0; i < int(SIZE); ++i)
for (size_t i = 0U; i < SIZE; ++i)
{
CHECK_EQUAL(input2[i], data[i]);
}
@ -595,9 +595,9 @@ namespace
Data data(buffer1.raw, SIZE);
data.push(input.begin(), input.end());
for (int i = 0; i < int(SIZE); ++i)
for (size_t i = 0U; i < SIZE; ++i)
{
CHECK_EQUAL(input[i + 3], data[i]);
CHECK_EQUAL(input[i + 3U], data[i]);
}
}
@ -620,7 +620,7 @@ namespace
while ((offset += step) < int(data.size() - 1))
{
itr = itr + step;
CHECK_EQUAL(compare[offset], *itr);
CHECK_EQUAL(compare[static_cast<size_t>(offset)], *itr);
}
}
}
@ -644,7 +644,7 @@ namespace
while ((offset += step) < int(data.size() - 1))
{
itr = itr + step;
CHECK_EQUAL(compare[offset], *itr);
CHECK_EQUAL(compare[static_cast<size_t>(offset)], *itr);
}
}
}
@ -668,7 +668,7 @@ namespace
while ((offset += step) < int(data.size() - 1))
{
itr += + step;
CHECK_EQUAL(compare[offset], *itr);
CHECK_EQUAL(compare[static_cast<size_t>(offset)], *itr);
}
}
}
@ -692,7 +692,7 @@ namespace
while ((offset += step) < int(data.size() - 1))
{
itr += step;
CHECK_EQUAL(compare[offset], *itr);
CHECK_EQUAL(compare[static_cast<size_t>(offset)], *itr);
}
}
}
@ -716,7 +716,7 @@ namespace
while ((offset -= step) > 0)
{
itr = itr - step;
CHECK_EQUAL(compare[offset], *itr);
CHECK_EQUAL(compare[static_cast<size_t>(offset)], *itr);
}
}
}
@ -740,7 +740,7 @@ namespace
while ((offset -= step) > 0)
{
itr = itr - step;
CHECK_EQUAL(compare[offset], *itr);
CHECK_EQUAL(compare[static_cast<size_t>(offset)], *itr);
}
}
}
@ -764,7 +764,7 @@ namespace
while ((offset -= step) > 0)
{
itr -= step;
CHECK_EQUAL(compare[offset], *itr);
CHECK_EQUAL(compare[static_cast<size_t>(offset)], *itr);
}
}
}
@ -788,7 +788,7 @@ namespace
while ((offset -= step) > 0)
{
itr -= step;
CHECK_EQUAL(compare[offset], *itr);
CHECK_EQUAL(compare[static_cast<size_t>(offset)], *itr);
}
}
}

View File

@ -225,7 +225,7 @@ namespace
etl::circular_iterator<ConstPointer> ci(std::begin(data), std::end(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *++ci);
}
@ -239,7 +239,7 @@ namespace
etl::circular_iterator<DataL::const_iterator> ci(std::begin(data), std::end(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *++ci);
}
@ -253,7 +253,7 @@ namespace
etl::circular_iterator<DataF::const_iterator> ci(std::begin(data), std::end(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *++ci);
}
@ -267,7 +267,7 @@ namespace
etl::circular_iterator<ConstPointer> ci(std::begin(data), std::end(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *ci++);
}
@ -281,7 +281,7 @@ namespace
etl::circular_iterator<DataL::const_iterator> ci(std::begin(data), std::end(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *ci++);
}
@ -295,7 +295,7 @@ namespace
etl::circular_iterator<DataF::const_iterator> ci(std::begin(data), std::end(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *ci++);
}
@ -309,7 +309,7 @@ namespace
etl::circular_iterator<ConstReversePointer> ci(ETL_OR_STD_R::rbegin(data), ETL_OR_STD_R::rend(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *++ci);
}
@ -323,7 +323,7 @@ namespace
etl::circular_iterator<DataL::const_reverse_iterator> ci(ETL_OR_STD_R::rbegin(data), ETL_OR_STD_R::rend(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *++ci);
}
@ -337,7 +337,7 @@ namespace
etl::circular_iterator<ConstReversePointer> ci(ETL_OR_STD_R::rbegin(data), ETL_OR_STD_R::rend(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *ci++);
}
@ -351,7 +351,7 @@ namespace
etl::circular_iterator<DataL::const_reverse_iterator> ci(ETL_OR_STD_R::rbegin(data), ETL_OR_STD_R::rend(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *ci++);
}
@ -365,7 +365,7 @@ namespace
etl::circular_iterator<ConstPointer> ci(std::begin(data), std::end(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *--ci);
}
@ -379,7 +379,7 @@ namespace
etl::circular_iterator<DataL::const_iterator> ci(std::begin(data), std::end(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *--ci);
}
@ -393,7 +393,7 @@ namespace
etl::circular_iterator<ConstReversePointer> ci(ETL_OR_STD_R::rbegin(data), ETL_OR_STD_R::rend(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *--ci);
}
@ -407,7 +407,7 @@ namespace
etl::circular_iterator<DataL::const_reverse_iterator> ci(ETL_OR_STD_R::rbegin(data), ETL_OR_STD_R::rend(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *--ci);
}
@ -421,7 +421,7 @@ namespace
etl::circular_iterator<ConstPointer> ci(std::begin(data), std::end(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *ci--);
}
@ -435,7 +435,7 @@ namespace
etl::circular_iterator<DataL::const_iterator> ci(std::begin(data), std::end(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *ci--);
}
@ -449,7 +449,7 @@ namespace
etl::circular_iterator<ConstReversePointer> ci(ETL_OR_STD_R::rbegin(data), ETL_OR_STD_R::rend(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *ci--);
}
@ -463,7 +463,7 @@ namespace
etl::circular_iterator<DataL::const_reverse_iterator> ci(ETL_OR_STD_R::rbegin(data), ETL_OR_STD_R::rend(data));
for (int i = 0; i < 20; ++i)
for (size_t i = 0U; i < 20U; ++i)
{
CHECK_EQUAL(expected[i % expected.size()], *ci--);
}
@ -619,7 +619,7 @@ namespace
{
etl::circular_iterator<ConstPointer> ci(std::begin(data), std::end(data));
for (int i = 0; i < 20; i += step)
for (size_t i = 0U; i < 20U; i += static_cast<size_t>(step))
{
CHECK_EQUAL(expected[i % 10], *ci);
ci += step;
@ -636,7 +636,7 @@ namespace
{
etl::circular_iterator<ConstPointer> ci(std::begin(data), std::end(data));
for (int i = 0; i < 20; i += step)
for (size_t i = 0U; i < 20U; i += static_cast<size_t>(step))
{
CHECK_EQUAL(data[i % 10], *ci);
ci = ci + step;
@ -657,7 +657,7 @@ namespace
{
ci = initial;
for (int i = 0; i < 20; i += step)
for (size_t i = 0U; i < 20U; i += static_cast<size_t>(step))
{
CHECK_EQUAL(expected[i % ETL_OR_STD17::size(data)], *ci);
ci -= step;
@ -675,7 +675,7 @@ namespace
{
etl::circular_iterator<ConstPointer> ci(std::begin(data), std::end(data));
for (int i = 0; i < 20; i += step)
for (size_t i = 0U; i < 20U; i += static_cast<size_t>(step))
{
CHECK_EQUAL(expected[i % ETL_OR_STD17::size(data)], *ci);
ci = ci - step;

View File

@ -86,7 +86,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint8_t crc = crc_calculator;

View File

@ -65,7 +65,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;
@ -156,7 +156,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;
@ -247,7 +247,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;

View File

@ -76,7 +76,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;
@ -167,7 +167,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;
@ -258,7 +258,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;

View File

@ -76,7 +76,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;
@ -167,7 +167,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;
@ -258,7 +258,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;

View File

@ -76,7 +76,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;
@ -167,7 +167,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;
@ -258,7 +258,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;

View File

@ -76,7 +76,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;
@ -167,7 +167,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;
@ -258,7 +258,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;

View File

@ -76,7 +76,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;
@ -167,7 +167,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;
@ -258,7 +258,7 @@ namespace
for (size_t i = 0UL; i < data.size(); ++i)
{
crc_calculator.add(data[i]);
crc_calculator.add(static_cast<uint8_t>(data[i]));
}
uint16_t crc = crc_calculator;

Some files were not shown because too many files have changed in this diff Show More