Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Source/LuaBridge/detail/LuaHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -551,23 +551,23 @@ constexpr bool is_integral_representable_by(T value)
return true;

if constexpr (std::is_unsigned_v<T>)
return value <= static_cast<T>(std::numeric_limits<U>::max());
return value <= static_cast<T>((std::numeric_limits<U>::max)());

return value >= static_cast<T>(std::numeric_limits<U>::min())
&& static_cast<U>(value) <= std::numeric_limits<U>::max();
return value >= static_cast<T>((std::numeric_limits<U>::min)())
&& static_cast<U>(value) <= (std::numeric_limits<U>::max)();
}

if constexpr (sizeof(T) < sizeof(U))
{
return static_cast<U>(value) >= std::numeric_limits<U>::min()
&& static_cast<U>(value) <= std::numeric_limits<U>::max();
return static_cast<U>(value) >= (std::numeric_limits<U>::min)()
&& static_cast<U>(value) <= (std::numeric_limits<U>::max)();
}

if constexpr (std::is_unsigned_v<T>)
return value <= static_cast<T>(std::numeric_limits<U>::max());
return value <= static_cast<T>((std::numeric_limits<U>::max)());

return value >= static_cast<T>(std::numeric_limits<U>::min())
&& value <= static_cast<T>(std::numeric_limits<U>::max());
return value >= static_cast<T>((std::numeric_limits<U>::min)())
&& value <= static_cast<T>((std::numeric_limits<U>::max)());
}

template <class U = lua_Integer>
Expand All @@ -590,11 +590,11 @@ constexpr bool is_floating_point_representable_by(T value)
return true;

if constexpr (sizeof(T) < sizeof(U))
return static_cast<U>(value) >= -std::numeric_limits<U>::max()
&& static_cast<U>(value) <= std::numeric_limits<U>::max();
return static_cast<U>(value) >= -(std::numeric_limits<U>::max)()
&& static_cast<U>(value) <= (std::numeric_limits<U>::max)();

return value >= static_cast<T>(-std::numeric_limits<U>::max())
&& value <= static_cast<T>(std::numeric_limits<U>::max());
return value >= static_cast<T>(-(std::numeric_limits<U>::max)())
&& value <= static_cast<T>((std::numeric_limits<U>::max)());
}

template <class U = lua_Number>
Expand Down