bit of cleanup

This commit is contained in:
2024-11-25 20:04:31 -06:00
parent aefbe17786
commit 274c96bb64
37 changed files with 128 additions and 122 deletions

View File

@ -21,7 +21,7 @@ namespace Dawn {
* @return The larger of the two numbers
*/
template<typename T>
static T max(T left, T right) {
static T max(const T &left, const T &right) {
return left < right ? right : left;
}
@ -33,7 +33,7 @@ namespace Dawn {
* @return Smaller of the two numbers.
*/
template<typename T>
static T min(T left, T right) {
static T min(const T &left, const T &right) {
return left < right ? left : right;
}
@ -47,7 +47,7 @@ namespace Dawn {
* @return The value, or the closest clamped value.
*/
template<typename T>
static T clamp(T val, T min, T max) {
static T clamp(const T &val, const T &min, const T &max) {
return mathMin<T>(mathMax<T>(val, min), max);
}
@ -59,7 +59,7 @@ namespace Dawn {
* @return The absolute value (-value if value < 0)
*/
template<typename T>
static T abs(T value) {
static T abs(const T &value) {
return value < 0 ? -value : value;
}
@ -71,11 +71,11 @@ namespace Dawn {
* @returns The modulo result.
*/
template<typename T>
static inline T mod(T value, T modulo) {
static inline T mod(const T &value, const T &modulo) {
return ((value % modulo) + modulo) % modulo;
}
static inline float_t fmod(float_t value, float_t modulo) {
static inline float_t fmod(const float_t &value, const float_t &modulo) {
float_t n = fmod(value, modulo);
return n;
}
@ -86,7 +86,7 @@ namespace Dawn {
* @param n Degrees to convert.
* @returns The number in radians.
*/
static float_t deg2rad(float_t degrees) {
static float_t deg2rad(const float_t &degrees) {
return degrees * (MATH_PI / 180.0f);
}
@ -95,7 +95,7 @@ namespace Dawn {
* @param n Radians to convert.
* @returns The number in degrees.
*/
static float_t rad2deg(float_t n) {
static float_t rad2deg(const float_t &n) {
return (n * 180.0f) / MATH_PI;
}
@ -105,7 +105,7 @@ namespace Dawn {
* @return Rounded number.
*/
template<typename T>
static T round(const float_t n) {
static T round(const float_t &n) {
return (T)roundf(n);
}
@ -115,7 +115,7 @@ namespace Dawn {
* @return Rounded number.
*/
template<typename T>
static T floor(const float_t n) {
static T floor(const float_t &n) {
return (T)floorf(n);
}
@ -125,12 +125,12 @@ namespace Dawn {
* @param n Number to get the square root of.
* @return float_t
*/
static float_t sqrt(const float_t n) {
static float_t sqrt(const float_t &n) {
return sqrtf(n);
}
template<typename T>
static T ceil(const float_t n) {
static T ceil(const float_t &n) {
return (T)ceilf(n);
}