[libc] Prevent overflow from intermediate results when adding UInt<N> values.
authorTue Ly <lntue@google.com>
Wed, 3 Aug 2022 19:42:05 +0000 (15:42 -0400)
committerTue Ly <lntue@google.com>
Thu, 4 Aug 2022 19:01:16 +0000 (15:01 -0400)
commitd1a9ba7b67038a8d2560fa4b5abac59ddda28f11
tree59ac88ff3c50a4eb9a747a890b21375608708343
parent9a5b34be157dd95816f5134eecd7fbe7d7e42d63
[libc] Prevent overflow from intermediate results when adding UInt<N> values.

Prevent overflow from intermediate results when adding UInt<N> values.

Reviewed By: orex

Differential Revision: https://reviews.llvm.org/D131095
libc/src/__support/CPP/UInt.h
libc/test/src/__support/uint128_test.cpp
libc/utils/UnitTest/LibcTest.cpp