| Index: src/IceDefs.h
|
| diff --git a/src/IceDefs.h b/src/IceDefs.h
|
| index 5cd1282337383607b910ea0015e1f82cae081d40..44a61323ad769b684fbd2074693b18d4320abab0 100644
|
| --- a/src/IceDefs.h
|
| +++ b/src/IceDefs.h
|
| @@ -21,6 +21,7 @@
|
| #include <cassert>
|
| #include <cstdio> // snprintf
|
| #include <functional> // std::less
|
| +#include <limits>
|
| #include <list>
|
| #include <map>
|
| #include <set>
|
| @@ -128,6 +129,11 @@ private:
|
| Timer &operator=(const Timer &) LLVM_DELETED_FUNCTION;
|
| };
|
|
|
| +template <typename T> bool WouldOverflowAdd(T X, T Y) {
|
| + return ((X > 0 && Y > 0 && (X > std::numeric_limits<T>::max() - Y)) ||
|
| + (X < 0 && Y < 0 && (X < std::numeric_limits<T>::min() - Y)));
|
| +}
|
| +
|
| } // end of namespace Ice
|
|
|
| #endif // SUBZERO_SRC_ICEDEFS_H
|
|
|