summaryrefslogtreecommitdiff
path: root/src/util-inl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util-inl.h')
-rw-r--r--src/util-inl.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util-inl.h b/src/util-inl.h
index 75bdb4784a..308c9b2787 100644
--- a/src/util-inl.h
+++ b/src/util-inl.h
@@ -198,6 +198,14 @@ TypeName* Unwrap(v8::Local<v8::Object> object) {
return static_cast<TypeName*>(pointer);
}
+inline bool IsValidSmi(int64_t value) {
+ if (sizeof(int32_t) == sizeof(intptr_t)) {
+ return value >= -0x40000000LL && value <= 0x3fffffffLL;
+ } else {
+ return value >= -0x80000000LL && value <= 0x7fffffffLL;
+ }
+}
+
} // namespace node
#endif // SRC_UTIL_INL_H_