Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 5526705c84269523ab7eafd144ab26dd12aa594e..78598c9f163d31486f60f963aee6b15b7622f662 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -5674,8 +5674,9 @@ void ReturnValue<T>::Set(int32_t i) { |
template<typename T> |
void ReturnValue<T>::Set(uint32_t i) { |
typedef internal::Internals I; |
- if (V8_LIKELY(I::IsValidSmi(i))) { |
- *value_ = I::IntToSmi(i); |
+ bool fits_into_int32_t = (i & (1 << 31)) == 0; |
Sven Panne
2013/06/07 07:05:06
I think 'i < INT32_MAX' is more readable than this
|
+ if (V8_LIKELY(fits_into_int32_t)) { |
+ Set(static_cast<int32_t>(i)); |
return; |
} |
Set(Integer::NewFromUnsigned(i, GetIsolate())); |