1
0
Fork 0

Small performance fix to wrapf

This commit is contained in:
Chaosus 2018-04-13 13:50:17 +03:00
parent 3a5b25d5b4
commit ac4c340a45
1 changed files with 2 additions and 2 deletions

View File

@ -215,11 +215,11 @@ public:
} }
static _ALWAYS_INLINE_ double wrapf(double value, double min, double max) { static _ALWAYS_INLINE_ double wrapf(double value, double min, double max) {
double rng = max - min; double rng = max - min;
return min + (value - min) - (rng * Math::floor((value - min) / rng)); return value - (rng * Math::floor((value - min) / rng));
} }
static _ALWAYS_INLINE_ float wrapf(float value, float min, float max) { static _ALWAYS_INLINE_ float wrapf(float value, float min, float max) {
float rng = max - min; float rng = max - min;
return min + (value - min) - (rng * Math::floor((value - min) / rng)); return value - (rng * Math::floor((value - min) / rng));
} }
// double only, as these functions are mainly used by the editor and not performance-critical, // double only, as these functions are mainly used by the editor and not performance-critical,