diff options
author | Chris Robinson <[email protected]> | 2023-04-27 00:42:04 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-04-27 00:42:04 -0700 |
commit | dffbc171a5e3f549986696c9f86978fd57bc35cc (patch) | |
tree | 1a281c663b60c8c27aeadb5e223fd19c71654a4e /al | |
parent | aaa0460b5e6520e53648eba12083e2ba2cb145d5 (diff) |
Use std::transform to cast doubles to floats
Diffstat (limited to 'al')
-rw-r--r-- | al/source.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/al/source.cpp b/al/source.cpp index bdc7e878..afb63c6d 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -3111,7 +3111,8 @@ START_API_FUNC const ALuint count{DoubleValsByProp(param)}; float fvals[MaxValues]; - std::copy_n(values, count, fvals); + std::transform(values, values+count, fvals, + [](const double d) noexcept -> float { return static_cast<float>(d); }); SetSourcefv(Source, context.get(), static_cast<SourceProp>(param), {fvals, count}); } END_API_FUNC @@ -3289,7 +3290,8 @@ START_API_FUNC const ALuint count{FloatValsByProp(param)}; double dvals[MaxValues]; if(GetSourcedv(Source, context.get(), static_cast<SourceProp>(param), {dvals, count})) - std::copy_n(dvals, count, values); + std::transform(dvals, dvals+count, values, + [](const double d) noexcept -> float { return static_cast<float>(d); }); } END_API_FUNC |