Version 2.1.2
Fix a crash bug caused by wrong assert.
Fix a bug with register names on 64-bit V8 (issue 615).
Performance improvements on all platforms.
git-svn-id: http://v8.googlecode.com/svn/trunk@3930 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/utils.h b/src/utils.h
index c59ca25..2fcd241 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -157,7 +157,9 @@
// Returns a uint32_t mask of bit field.
static uint32_t mask() {
- return (1U << (size + shift)) - (1U << shift);
+ // To use all bits of a uint32 in a bitfield without compiler warnings we
+ // have to compute 2^32 without using a shift count of 32.
+ return ((1U << shift) << size) - (1U << shift);
}
// Returns a uint32_t with the bit field value encoded.
@@ -168,7 +170,7 @@
// Extracts the bit field from the value.
static T decode(uint32_t value) {
- return static_cast<T>((value >> shift) & ((1U << (size)) - 1));
+ return static_cast<T>((value & mask()) >> shift);
}
};