Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(597)

Unified Diff: runtime/platform/utils.h

Issue 328503003: Extend Range analysis to 64-bit range and mint operations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698