Add checkMulAdd helper function to CheckedArithmetic
ClosedPublic

Authored by george.karpenkov on Jun 13 2018, 10:57 AM.

Details

Summary

Multiplication followed by addition (https://en.wikipedia.org/wiki/Multiply–accumulate_operation) is a sufficiently common use-case to warrant a separate helper.

Diff Detail

Repository
rL LLVM
NoQ accepted this revision.Jun 13 2018, 11:12 AM
NoQ added inline comments.
llvm/include/llvm/Support/CheckedArithmetic.h
65–67 ↗(On Diff #151201)

if (llvm::Optional<T> Product = checkedMul(A, B)) { ... }

This revision is now accepted and ready to land.Jun 13 2018, 11:12 AM
This revision was automatically updated to reflect the committed changes.