1.1 --- a/jitcraft/Types.h Mon Jun 25 21:20:01 2012 -0700
1.2 +++ b/jitcraft/Types.h Tue Jun 26 00:35:15 2012 -0700
1.3 @@ -104,6 +104,30 @@
1.4 unsigned levels_;
1.5 };
1.6
1.7 +class BoxedPrimitive
1.8 +{
1.9 + PrimitiveType type_;
1.10 + union {
1.11 + int i_;
1.12 + };
1.13 +
1.14 + public:
1.15 + static BoxedPrimitive Int(int i) {
1.16 + BoxedPrimitive b;
1.17 + b.type_ = PrimitiveType_Int32;
1.18 + b.i_ = i;
1.19 + return b;
1.20 + }
1.21 +
1.22 + PrimitiveType type() const {
1.23 + return type_;
1.24 + }
1.25 + int toInt() const {
1.26 + assert(type() == PrimitiveType_Int32);
1.27 + return i_;
1.28 + }
1.29 +};
1.30 +
1.31 }
1.32
1.33 #endif // _include_jc_types_h_