Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
c6653b59
Commit
c6653b59
authored
Jan 15, 2019
by
Javier Peletier
Committed by
Terry Ellison
Jan 15, 2019
Browse files
fix number2integer conversion in ESP8266 for floating-point builds (#2609)
parent
b126c6b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/lua/luaconf.h
View file @
c6653b59
...
...
@@ -717,8 +717,18 @@ union luai_Cast { double l_d; long l_l; };
/* this option always works, but may be slow */
#else
#define lua_number2int(i,d) ((i)=(int)(d))
#define lua_number2integer(i,d) ((i)=(lua_Integer)(d))
#ifdef LUA_NUMBER_INTEGRAL
#define lua_number2int(i, d) ((i) = (int)(d))
#define lua_number2integer(i, d) ((i) = (lua_Integer)(d))
#else // for floating-point builds, cast to a larger integer first to avoid undefined behavior on overflows.
#define lua_number2int(i, d) ((i) = (int)(long long)(d))
#define lua_number2integer(i, d) ((i) = (lua_Integer)(long long)(d))
#endif // LUA_NUMBER_INTEGRAL
#endif
...
...
@@ -900,4 +910,4 @@ union luai_Cast { double l_d; long l_l; };
#error "Pipes not supported in aggresive optimization mode (LUA_OPTIMIZE_MEMORY=2)"
#endif
#endif
#endif
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment