Merge pull request #18170 from Chaosus/improvewrapf

Small performance fix to wrapf
This commit is contained in:
Gilles Roudiere 2018-04-14 15:00:47 +02:00 committed by GitHub
commit e7445c3d82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -215,11 +215,11 @@ public:
}
static _ALWAYS_INLINE_ double wrapf(double value, double min, double max) {
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) {
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,