Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
saturated_arithmetic.h File Reference
#include <cstdint>
#include <limits>
#include <type_traits>
#include "absl/base/casts.h"
#include "absl/log/check.h"
#include "ortools/base/types.h"
#include "ortools/util/bitset.h"

Go to the source code of this file.

Namespaces

namespace  operations_research
 In SWIG mode, we don't want anything besides these top-level includes.
 
namespace  operations_research::cap_prod_util
 

Functions

bool operations_research::AtMinOrMaxInt64 (int64_t x)
 Checks if x is equal to the min or the max value of an int64_t.
 
int64_t operations_research::CapOpp (int64_t v)
 Note(user): -kint64min != kint64max, but kint64max == ~kint64min.
 
int64_t operations_research::CapAbs (int64_t v)
 
int64_t operations_research::TwosComplementAddition (int64_t x, int64_t y)
 -------— Overflow utility functions -------—
 
int64_t operations_research::TwosComplementSubtraction (int64_t x, int64_t y)
 
bool operations_research::AddHadOverflow (int64_t x, int64_t y, int64_t sum)
 
bool operations_research::SubHadOverflow (int64_t x, int64_t y, int64_t diff)
 
bool operations_research::AddOverflows (int64_t x, int64_t y)
 
int64_t operations_research::SubOverflows (int64_t x, int64_t y)
 
template<typename IntegerType >
bool operations_research::SafeAddInto (IntegerType a, IntegerType *b)
 
int64_t operations_research::CapWithSignOf (int64_t x)
 Returns kint64max if x >= 0 and kint64min if x < 0.
 
int64_t operations_research::CapAddGeneric (int64_t x, int64_t y)
 
int64_t operations_research::CapSubGeneric (int64_t x, int64_t y)
 
uint64_t operations_research::cap_prod_util::uint_abs (int64_t n)
 
int64_t operations_research::CapProdGeneric (int64_t x, int64_t y)
 
template<typename T >
operations_research::CapOrFloatAdd (T x, T y)
 
int64_t operations_research::CapAdd (int64_t x, int64_t y)
 
void operations_research::CapAddTo (int64_t x, int64_t *y)
 
int64_t operations_research::CapSub (int64_t x, int64_t y)
 
int64_t operations_research::CapProd (int64_t x, int64_t y)