X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm%2FSupport%2FMathExtras.h;fp=include%2Fllvm%2FSupport%2FMathExtras.h;h=2c515bbd242a13b725b37c5ad30ad4478a836418;hp=b7b3c02dcfe76be2cf9572cb4308f4aed4dc9905;hb=d4cf58476e0af9e62fbf868221e5f59547c682df;hpb=d663426c2fcd19aac2cba06993cde8eed5579f6b diff --git a/include/llvm/Support/MathExtras.h b/include/llvm/Support/MathExtras.h index b7b3c02dcfe..2c515bbd242 100644 --- a/include/llvm/Support/MathExtras.h +++ b/include/llvm/Support/MathExtras.h @@ -653,32 +653,6 @@ inline int64_t SignExtend64(uint64_t X, unsigned B) { return int64_t(X << (64 - B)) >> (64 - B); } -/// \brief Add two unsigned integers, X and Y, of type T. -/// Clamp the result to the maximum representable value of T on overflow. -template -typename std::enable_if::value, T>::type -SaturatingAdd(T X, T Y) { - // Hacker's Delight, p. 29 - T Z = X + Y; - if (Z < X || Z < Y) - return std::numeric_limits::max(); - else - return Z; -} - -/// \brief Multiply two unsigned integers, X and Y, of type T. -/// Clamp the result to the maximum representable value of T on overflow. -template -typename std::enable_if::value, T>::type -SaturatingMultiply(T X, T Y) { - // Hacker's Delight, p. 30 - T Z = X * Y; - if (Y != 0 && Z / Y != X) - return std::numeric_limits::max(); - else - return Z; -} - extern const float huge_valf; } // End llvm namespace