Minor fix.

This commit is contained in:
Daniel Kirchner
2023-01-05 13:06:14 +01:00
parent 1364253dd9
commit 2618c84cb4
2 changed files with 5 additions and 6 deletions
+3 -3
View File
@@ -102,10 +102,10 @@ template <class T, class Out>
inline void toBigEndian(T _val, Out&& o_out)
{
static_assert(std::is_same<bigint, T>::value || !std::numeric_limits<T>::is_signed, "only unsigned types or bigint supported"); //bigint does not carry sign bit on shift
for (auto i = o_out.size(); i != 0; _val >>= 8, i--)
for (auto i = o_out.size(); i != 0u; _val >>= 8u, i--)
{
T v = _val & (T)0xff;
o_out[i - 1] = (typename std::remove_reference_t<Out>::value_type)(uint8_t)v;
T v = _val & (T)0xffu;
o_out[i - 1u] = (typename std::remove_reference_t<Out>::value_type)(uint8_t)v;
}
}