faster floating point comparison

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1726 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-10-02 21:47:04 +00:00
parent 6be3579bcb
commit baf52ca21c

View File

@@ -60,6 +60,10 @@ typedef Sint8 fx_ch_t; // FX-channel (0 to MAX_EFFECT_CHANNEL)
typedef Uint32 jo_id_t; // (unique) ID of a journalling object
// use for improved branch prediction
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)
template<typename T>
struct typeInfo
@@ -100,6 +104,10 @@ inline float typeInfo<float>::minEps( void )
template<>
inline bool typeInfo<float>::isEqual( float _x, float _y )
{
if( likely( _x == _y ) )
{
return true;
}
return absVal( _x - _y ) < minEps();
}
@@ -121,8 +129,4 @@ typedef sample_t sampleFrame[DEFAULT_CHANNELS];
typedef sample_t surroundSampleFrame[SURROUND_CHANNELS];
// use for improved branch prediction
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)
#endif