diff --git a/dune/common/bigunsignedint.hh b/dune/common/bigunsignedint.hh index bb76bf4077a43e1a1fabdfafca1324bca2125bd9..0dbddc8520a0cddbb316b9ccbc132a04bfd1904b 100644 --- a/dune/common/bigunsignedint.hh +++ b/dune/common/bigunsignedint.hh @@ -268,10 +268,13 @@ namespace Dune { std::int_fast32_t diff = static_cast<std::int_fast32_t>(digit[i]) - static_cast<std::int_fast32_t>(x.digit[i]) - overflow; if (diff>=0) + { result.digit[i] = static_cast<std::uint16_t>(diff); + overflow = 0; + } else { - result.digit[i] = static_cast<std::uint16_t>(diff+bitmask); + result.digit[i] = static_cast<std::uint16_t>(diff+bitmask+1); overflow = 1; } }