From 02ca02544348edc9d89f436ed2000f4ba4f50231 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 21 Jul 2022 10:30:23 -0600 Subject: [PATCH] [layout] Add large_int to Types --- src/OT/Layout/Common/CoverageFormat2.hh | 6 +++--- src/OT/Layout/types.hh | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/OT/Layout/Common/CoverageFormat2.hh b/src/OT/Layout/Common/CoverageFormat2.hh index 4f34d2865..c0449e326 100644 --- a/src/OT/Layout/Common/CoverageFormat2.hh +++ b/src/OT/Layout/Common/CoverageFormat2.hh @@ -67,10 +67,10 @@ struct CoverageFormat2_4 unsigned get_population () const { - unsigned ret = 0; + typename Types::large_int ret = 0; for (const auto &r : rangeRecord) - ret += r.get_population (); // TODO Overflow - return ret; + ret += r.get_population (); + return ret > UINT_MAX ? UINT_MAX : (unsigned) ret; } template