Skip to content

Commit

Permalink
added the brackets to fix
Browse files Browse the repository at this point in the history
  • Loading branch information
FourierTransformer committed Jul 30, 2024
1 parent c2178c4 commit e54cab5
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/luasimdjson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,21 @@ void convert_ondemand_element_to_table(lua_State *L, ondemand::value element) {
break;

case fallback::number_type::unsigned_integer:
// a uint64 can be greater than an int64, so we must check how large and pass as a number
// if larger but LUA_MAXINTEGER (which is only defined in 5.3+)
#if defined(LUA_MAXINTEGER)
uint64_t actual_value = element.get_uint64();
if (actual_value > LUA_MAXINTEGER) {
lua_pushnumber(L, actual_value);
} else {
lua_pushinteger(L, actual_value);
{
// a uint64 can be greater than an int64, so we must check how large and pass as a number
// if larger but LUA_MAXINTEGER (which is only defined in 5.3+)
#if defined(LUA_MAXINTEGER)
uint64_t actual_value = element.get_uint64();
if (actual_value > LUA_MAXINTEGER) {
lua_pushnumber(L, actual_value);
} else {
lua_pushinteger(L, actual_value);
}
#else
lua_pushnumber(L, element.get_double());
#endif
break;
}
#else
lua_pushnumber(L, element.get_double());
#endif
break;

case fallback::number_type::big_integer:
lua_pushnumber(L, element.get_double());
Expand Down

0 comments on commit e54cab5

Please sign in to comment.