Explicitly mask enum values to work around probable VS/Win64 compiler bug
authorrossberg@chromium.org <rossberg@chromium.org>
Mon, 15 Sep 2014 13:04:44 +0000 (13:04 +0000)
committerrossberg@chromium.org <rossberg@chromium.org>
Mon, 15 Sep 2014 13:04:44 +0000 (13:04 +0000)
TBR=svenpanne@chromium.org
BUG=

Review URL: https://codereview.chromium.org/564413003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23947 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/types.h

index df35c9e..47f1de7 100644 (file)
@@ -275,10 +275,13 @@ class TypeImpl : public Config::Base {
 
   // Constructors.
 
+  // Explicitly mask, since VS on Win64 (wrongly?) sign extends the enum value.
   #define DEFINE_TYPE_CONSTRUCTOR(type, value)                                \
-    static TypeImpl* type() { return BitsetType::New(BitsetType::k##type); }  \
+    static TypeImpl* type() {                                                 \
+      return BitsetType::New(BitsetType::k##type & 0xffffffffu);              \
+    }                                                                         \
     static TypeHandle type(Region* region) {                                  \
-      return BitsetType::New(BitsetType::k##type, region);                    \
+      return BitsetType::New(BitsetType::k##type & 0xffffffffu, region);      \
     }
   BITSET_TYPE_LIST(DEFINE_TYPE_CONSTRUCTOR)
   #undef DEFINE_TYPE_CONSTRUCTOR