[PATCH] D109217: [llvm-dwarfdump] Fix unsigned overflow when calculating stats

Djordje Todorovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 9 03:43:38 PDT 2021


djtodoro added a comment.

In D109217#2987177 <https://reviews.llvm.org/D109217#2987177>, @tschuett wrote:

> Let me revisit the saturating integer without asserts. If you print 5 for an `uint32_t`, you will never know whether it overflowed never or 10 times (in release mode).
>
> A saturating integer will print 5 or max int (saturated).
>
> Even an `SaturatingUint<uint64_t>` shouldn't yield too much overhead.

Hmm, is there an implementation of the `SaturatingUint`, or do we need to implement such type?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109217/new/

https://reviews.llvm.org/D109217



More information about the llvm-commits mailing list