[PATCH] D139036: [Support][MathExtras] Add variadic SaturatingAdd
Vy Nguyen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 30 12:01:02 PST 2022
oontvoo added inline comments.
================
Comment at: llvm/include/llvm/Support/MathExtras.h:763-764
+ T XY = SaturatingAdd(X, Y, &Overflowed);
+ if (Overflowed)
+ return SaturatingAdd(std::numeric_limits<T>::max(), T(1), Args...);
+ return SaturatingAdd(XY, Z, Args...);
----------------
P.S: perhaps just return max() here?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139036/new/
https://reviews.llvm.org/D139036
More information about the llvm-commits
mailing list