Clean up math functions

- Remove checking for standard functions from the build system
- Prefix all invocations with std::
- Replace suffixed functions with unprefixed versions
- Include <cmath> in all files that use it and remove the global include

e.g. floorf(x) -> std::floor(x)
This commit is contained in:
Martin Natano
2023-04-19 19:31:40 +02:00
parent f39ed52dbf
commit b68ca517e6
111 changed files with 1831 additions and 1785 deletions
+7 -6
View File
@@ -16,6 +16,7 @@
#include <sstream> // conversion for lua functions.
#include <csetjmp>
#include <cassert>
#include <cmath>
#include <map>
LuaManager *LUA = nullptr;
@@ -170,9 +171,9 @@ static int GetLuaStack( lua_State *L )
{
RString sErr;
LuaHelpers::Pop( L, sErr );
lua_Debug ar;
for( int iLevel = 0; lua_getstack(L, iLevel, &ar); ++iLevel )
{
if( !lua_getinfo(L, "nSluf", &ar) )
@@ -181,7 +182,7 @@ static int GetLuaStack( lua_State *L )
const char *file = ar.source[0] == '@' ? ar.source + 1 : ar.short_src;
const char *name;
std::vector<RString> vArgs;
if( !strcmp(ar.what, "C") )
{
for( int i = 1; i <= ar.nups && (name = lua_getupvalue(L, -1, i)) != nullptr; ++i )
@@ -740,7 +741,7 @@ XNode *LuaHelpers::GetLuaInformation()
XNode *pConstantNode = pConstantsNode->AppendChild( "Constant" );
pConstantNode->AppendAttr( "name", c.first );
if( c.second == truncf(c.second) )
if( c.second == std::trunc(c.second) )
pConstantNode->AppendAttr( "value", static_cast<int>(c.second) );
else
pConstantNode->AppendAttr( "value", c.second );
@@ -1177,7 +1178,7 @@ LUA_REGISTER_NAMESPACE( lua )
/*
* (c) 2004-2006 Glenn Maynard, Steve Checkoway
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -1187,7 +1188,7 @@ LUA_REGISTER_NAMESPACE( lua )
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF