Fixed some undefined behavior in our external header.

R=bmeurer@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23788 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7b4f1d2b
...@@ -5599,8 +5599,8 @@ template <size_t ptr_size> struct SmiTagging; ...@@ -5599,8 +5599,8 @@ template <size_t ptr_size> struct SmiTagging;
template<int kSmiShiftSize> template<int kSmiShiftSize>
V8_INLINE internal::Object* IntToSmi(int value) { V8_INLINE internal::Object* IntToSmi(int value) {
int smi_shift_bits = kSmiTagSize + kSmiShiftSize; int smi_shift_bits = kSmiTagSize + kSmiShiftSize;
intptr_t tagged_value = uintptr_t tagged_value =
(static_cast<intptr_t>(value) << smi_shift_bits) | kSmiTag; (static_cast<uintptr_t>(value) << smi_shift_bits) | kSmiTag;
return reinterpret_cast<internal::Object*>(tagged_value); return reinterpret_cast<internal::Object*>(tagged_value);
} }
...@@ -5770,7 +5770,7 @@ class Internals { ...@@ -5770,7 +5770,7 @@ class Internals {
V8_INLINE static void UpdateNodeFlag(internal::Object** obj, V8_INLINE static void UpdateNodeFlag(internal::Object** obj,
bool value, int shift) { bool value, int shift) {
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
uint8_t mask = static_cast<uint8_t>(1 << shift); uint8_t mask = static_cast<uint8_t>(1U << shift);
*addr = static_cast<uint8_t>((*addr & ~mask) | (value << shift)); *addr = static_cast<uint8_t>((*addr & ~mask) | (value << shift));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment