Add basic assembler interface and an x86 backend.

Change-Id: Ia8136bad88f1194c8a247e2af80e486ab88c1e8c
diff --git a/src/utils.h b/src/utils.h
new file mode 100644
index 0000000..6f38e7f
--- /dev/null
+++ b/src/utils.h
@@ -0,0 +1,45 @@
+// Copyright 2011 Google Inc. All Rights Reserved.
+
+#ifndef ART_SRC_UTILS_H_
+#define ART_SRC_UTILS_H_
+
+#include "src/globals.h"
+
+namespace android {
+namespace runtime {
+
+// Check whether an N-bit two's-complement representation can hold value.
+static inline bool IsInt(int N, word value) {
+  CHECK_LT(0, N);
+  CHECK_LT(N, kBitsPerWord);
+  word limit = static_cast<word>(1) << (N - 1);
+  return (-limit <= value) && (value < limit);
+}
+
+
+template<typename T>
+static inline bool IsPowerOfTwo(T x) {
+  return (x & (x - 1)) == 0;
+}
+
+
+static inline bool IsUint(int N, word value) {
+  CHECK_LT(0, N);
+  CHECK_LT(N, kBitsPerWord);
+  word limit = static_cast<word>(1) << N;
+  return (0 <= value) && (value < limit);
+}
+
+
+static inline int32_t Low32Bits(int64_t value) {
+  return static_cast<int32_t>(value);
+}
+
+
+static inline int32_t High32Bits(int64_t value) {
+  return static_cast<int32_t>(value >> 32);
+}
+
+} }  // namespace android::runtime
+
+#endif  // ART_SRC_UTILS_H_