Andrew Geissler | ac970dd | 2021-02-12 15:32:45 -0600 | [diff] [blame^] | 1 | From 5b83983b246cff440de4421696b6b5dd9072ed2d Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sat, 6 Feb 2021 11:36:23 -0800 |
| 4 | Subject: [PATCH] Silence clang warnings |
| 5 | |
| 6 | Fixes |
| 7 | glm/gtc/random.inl:25:17: error: implicit conversion loses integer precision: 'int' to 'unsigned char' [-Werror,-Wimplicit-int-conversion] |
| 8 | | std::rand() % std::numeric_limits<uint8>::max()); |
| 9 | | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 10 | |
| 11 | glm/gtc/../ext/quaternion_common.inl:76:87: error: unused parameter 'k' [-Werror,-Wunused-parameter] |
| 12 | GLM_FUNC_QUALIFIER qua<T, Q> slerp(qua<T, Q> const& x, qua<T, Q> const& y, T a, S k) |
| 13 | ^ |
| 14 | |
| 15 | Upstream-Status: Submitted [https://github.com/g-truc/glm/pull/1055] |
| 16 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 17 | --- |
| 18 | glm/ext/quaternion_common.inl | 2 +- |
| 19 | glm/gtc/random.inl | 2 +- |
| 20 | 2 files changed, 2 insertions(+), 2 deletions(-) |
| 21 | |
| 22 | diff --git a/glm/ext/quaternion_common.inl b/glm/ext/quaternion_common.inl |
| 23 | index 0e4a3bb2..8f9dccef 100644 |
| 24 | --- a/glm/ext/quaternion_common.inl |
| 25 | +++ b/glm/ext/quaternion_common.inl |
| 26 | @@ -104,7 +104,7 @@ namespace glm |
| 27 | { |
| 28 | // Graphics Gems III, page 96 |
| 29 | T angle = acos(cosTheta); |
| 30 | - T phi = angle + k * glm::pi<T>(); |
| 31 | + T phi = angle + static_cast<float>(k) * glm::pi<T>(); |
| 32 | return (sin(angle - a * phi)* x + sin(a * phi) * z) / sin(angle); |
| 33 | } |
| 34 | } |
| 35 | diff --git a/glm/gtc/random.inl b/glm/gtc/random.inl |
| 36 | index 70485098..a4af2a06 100644 |
| 37 | --- a/glm/gtc/random.inl |
| 38 | +++ b/glm/gtc/random.inl |
| 39 | @@ -22,7 +22,7 @@ namespace detail |
| 40 | GLM_FUNC_QUALIFIER static vec<1, uint8, P> call() |
| 41 | { |
| 42 | return vec<1, uint8, P>( |
| 43 | - std::rand() % std::numeric_limits<uint8>::max()); |
| 44 | + static_cast<uint8>(std::rand()) % std::numeric_limits<uint8>::max()); |
| 45 | } |
| 46 | }; |
| 47 | |
| 48 | -- |
| 49 | 2.30.0 |
| 50 | |