aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/util
diff options
context:
space:
mode:
authorMax Horn2010-10-19 09:42:48 +0000
committerMax Horn2010-10-19 09:42:48 +0000
commitebf9911649f6596128493c5965f5b5638a029812 (patch)
treece0ba5f9167931245afd252d3cf69cf8610869b4 /engines/sword25/util
parent3b29bda9a1d98eb5bca748451f763a2ea6523b9e (diff)
downloadscummvm-rg350-ebf9911649f6596128493c5965f5b5638a029812.tar.gz
scummvm-rg350-ebf9911649f6596128493c5965f5b5638a029812.tar.bz2
scummvm-rg350-ebf9911649f6596128493c5965f5b5638a029812.zip
SWORD25: Work around for bug in Mac OS X 10.2 SDK
svn-id: r53604
Diffstat (limited to 'engines/sword25/util')
-rw-r--r--engines/sword25/util/lua/lmathlib.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/engines/sword25/util/lua/lmathlib.cpp b/engines/sword25/util/lua/lmathlib.cpp
index fd9c69681f..ed50539f1f 100644
--- a/engines/sword25/util/lua/lmathlib.cpp
+++ b/engines/sword25/util/lua/lmathlib.cpp
@@ -252,7 +252,17 @@ LUALIB_API int luaopen_math (lua_State *L) {
luaL_register(L, LUA_MATHLIBNAME, mathlib);
lua_pushnumber(L, PI);
lua_setfield(L, -2, "pi");
+#if defined(MACOSX) && defined(__GNUC__) && ! defined( __XLC__ )
+ // WORKAROUND for a bug in the Mac OS X 10.2.8 SDK. It defines
+ // HUGE_VAL simply to 1e500, leading to this compiler error:
+ // error: floating constant exceeds range of 'double'
+ // However, GCC (at least the version we are using for our cross
+ // compiler) has a __builtin_huge_val which returns the correct
+ // value, so we just use that.
+ lua_pushnumber(L, __builtin_huge_val());
+#else
lua_pushnumber(L, HUGE_VAL);
+#endif
lua_setfield(L, -2, "huge");
#if defined(LUA_COMPAT_MOD)
lua_getfield(L, -1, "fmod");