LLVM 19.0.0git
Namespaces | Functions
CheckedArithmetic.h File Reference
#include "llvm/ADT/APInt.h"
#include <optional>
#include <type_traits>

Go to the source code of this file.

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 

Functions

template<typename T >
std::enable_if_t< std::is_signed_v< T >, std::optional< T > > llvm::checkedAdd (T LHS, T RHS)
 Add two signed integers LHS and RHS.
 
template<typename T >
std::enable_if_t< std::is_signed_v< T >, std::optional< T > > llvm::checkedSub (T LHS, T RHS)
 Subtract two signed integers LHS and RHS.
 
template<typename T >
std::enable_if_t< std::is_signed_v< T >, std::optional< T > > llvm::checkedMul (T LHS, T RHS)
 Multiply two signed integers LHS and RHS.
 
template<typename T >
std::enable_if_t< std::is_signed_v< T >, std::optional< T > > llvm::checkedMulAdd (T A, T B, T C)
 Multiply A and B, and add C to the resulting product.
 
template<typename T >
std::enable_if_t< std::is_unsigned_v< T >, std::optional< T > > llvm::checkedAddUnsigned (T LHS, T RHS)
 Add two unsigned integers LHS and RHS.
 
template<typename T >
std::enable_if_t< std::is_unsigned_v< T >, std::optional< T > > llvm::checkedMulUnsigned (T LHS, T RHS)
 Multiply two unsigned integers LHS and RHS.
 
template<typename T >
std::enable_if_t< std::is_unsigned_v< T >, std::optional< T > > llvm::checkedMulAddUnsigned (T A, T B, T C)
 Multiply unsigned integers A and B, and add C to the resulting product.