| Index: runtime/platform/utils.h
|
| diff --git a/runtime/platform/utils.h b/runtime/platform/utils.h
|
| index f2025624ca6e76eb5c792ea2e1e0971ce0a4c685..52e30aa596c99a3c963b091e169aa6db65b673d0 100644
|
| --- a/runtime/platform/utils.h
|
| +++ b/runtime/platform/utils.h
|
| @@ -171,6 +171,17 @@ class Utils {
|
| count <= (length - offset);
|
| }
|
|
|
| + static inline bool WillAddOverflow(int64_t a, int64_t b) {
|
| + return ((b > 0) && (a > (kMaxInt64 - b))) ||
|
| + ((b < 0) && (a < (kMinInt64 - b)));
|
| + }
|
| +
|
| + static inline bool WillSubOverflow(int64_t a, int64_t b) {
|
| + return ((b > 0) && (a < (kMinInt64 + b))) ||
|
| + ((b < 0) && (a > (kMaxInt64 + b)));
|
| + }
|
| +
|
| +
|
| // Utility functions for converting values from host endianess to
|
| // big or little endian values.
|
| static uint16_t HostToBigEndian16(uint16_t host_value);
|
|
|