pow is total overkill for x*x, introduce pow2 inline function to fix it.
fix a warning. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2323 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
98bf1695c1
commit
d3f7349692
|
@ -27,6 +27,9 @@
|
|||
uses round towards zero.
|
||||
*/
|
||||
|
||||
inline float pow2f(float x) {return x * x;}
|
||||
inline double pow2(double x) {return x * x;}
|
||||
|
||||
void SaveSSEState();
|
||||
void LoadSSEState();
|
||||
void LoadDefaultSSEState();
|
||||
|
|
|
@ -257,7 +257,7 @@ CPluginInfo::CPluginInfo(const char *_rFilename)
|
|||
If the user has done that he will instead get the "Can't open %s, it's missing" message. */
|
||||
void CPluginManager::GetPluginInfo(CPluginInfo *&info, std::string Filename)
|
||||
{
|
||||
for (int i = 0; i < m_PluginInfos.size(); i++)
|
||||
for (int i = 0; i < (int)m_PluginInfos.size(); i++)
|
||||
{
|
||||
if (m_PluginInfos.at(i).GetFilename() == Filename)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "../../../Core/InputCommon/Src/XInput.h"
|
||||
|
||||
#include "Common.h" // Common
|
||||
#include "MathUtil.h"
|
||||
#include "StringUtil.h" // for ArrayToString()
|
||||
#include "IniFile.h"
|
||||
#include "pluginspecs_wiimote.h"
|
||||
|
@ -133,10 +134,10 @@ void PitchDegreeToAccelerometer(float _Roll, float _Pitch, u8 &_x, u8 &_y, u8 &_
|
|||
/* I got these from reversing the calculation in PitchAccelerometerToDegree() in a math program
|
||||
I don't know if we can derive these from some kind of matrix or something */
|
||||
float x_num = 2 * tanf(0.5f * _Roll) * z;
|
||||
float x_den = powf(tanf(0.5f * _Roll), 2) - 1;
|
||||
float x_den = pow2f(tanf(0.5f * _Roll)) - 1;
|
||||
x = - (x_num / x_den);
|
||||
float y_num = 2 * tanf(0.5f * _Pitch) * z;
|
||||
float y_den = powf(tanf(0.5f * _Pitch), 2) - 1;
|
||||
float y_den = pow2f(tanf(0.5f * _Pitch)) - 1;
|
||||
y = - (y_num / y_den);
|
||||
// =========================
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue