Introduce primitive type helpers.
Change-Id: I81e909a185787f109c0afafa27b4335050a0dcdf
diff --git a/runtime/primitive.h b/runtime/primitive.h
index 50d171c..9dda144 100644
--- a/runtime/primitive.h
+++ b/runtime/primitive.h
@@ -148,6 +148,27 @@
static const char* PrettyDescriptor(Type type);
+ static bool IsFloatingPointType(Type type) {
+ return type == kPrimFloat || type == kPrimDouble;
+ }
+
+ static bool IsIntegralType(Type type) {
+ switch (type) {
+ case kPrimByte:
+ case kPrimChar:
+ case kPrimShort:
+ case kPrimInt:
+ case kPrimLong:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ static bool Is64BitType(Type type) {
+ return type == kPrimLong || type == kPrimDouble;
+ }
+
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(Primitive);
};