diff -r 27f12e2fc369 -r 46fc53b8fd2f jitcraft/Types.h --- a/jitcraft/Types.h Mon Jun 25 21:20:01 2012 -0700 +++ b/jitcraft/Types.h Tue Jun 26 00:35:15 2012 -0700 @@ -104,6 +104,30 @@ unsigned levels_; }; +class BoxedPrimitive +{ + PrimitiveType type_; + union { + int i_; + }; + + public: + static BoxedPrimitive Int(int i) { + BoxedPrimitive b; + b.type_ = PrimitiveType_Int32; + b.i_ = i; + return b; + } + + PrimitiveType type() const { + return type_; + } + int toInt() const { + assert(type() == PrimitiveType_Int32); + return i_; + } +}; + } #endif // _include_jc_types_h_