diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-05-02 14:44:31 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-05-02 14:44:31 +0100 |
commit | f2654cf7d46b0e55d288cc48bdd6af872fb021f4 (patch) | |
tree | b3bc31345a2ea16fd6b76b0435247027fab48808 /lib/maths.h | |
parent | Bump to release GCC version (diff) | |
download | ilt-f2654cf7d46b0e55d288cc48bdd6af872fb021f4.tar.bz2 ilt-f2654cf7d46b0e55d288cc48bdd6af872fb021f4.tar.xz ilt-f2654cf7d46b0e55d288cc48bdd6af872fb021f4.zip |
Fix warnings produced by new clang-tidy
Diffstat (limited to 'lib/maths.h')
-rw-r--r-- | lib/maths.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/maths.h b/lib/maths.h index c4c1a51..c02123a 100644 --- a/lib/maths.h +++ b/lib/maths.h @@ -56,6 +56,20 @@ float vector_pitch(const glm::vec3 & diff); float round_frac(const float & v, const float & frac); +template<typename T> +inline constexpr auto +sq(T v) +{ + return v * v; +} + +template<typename R = float, typename Ta, typename Tb> +inline constexpr auto +rdiv(Ta a, Tb b) +{ + return ((R)a / (R)b); +} + constexpr inline glm::vec2 operator!(const glm::vec3 & v) { |