aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-01-01 22:15:46 -0800
committerChris Robinson <[email protected]>2023-01-01 22:15:46 -0800
commit52224f8bb87b724eb3c97605c37283f032937c9e (patch)
tree3c8670b1729fa512e5a01f14af91292702288d63 /core
parent7cd9bf18183a9b9ca4e86a4a231cac6fda2f9667 (diff)
Multiply by the inverse instead of divide
Diffstat (limited to 'core')
-rw-r--r--core/hrtf.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/hrtf.cpp b/core/hrtf.cpp
index 310b7a80..076d62d5 100644
--- a/core/hrtf.cpp
+++ b/core/hrtf.cpp
@@ -180,8 +180,8 @@ struct IdxBlend { uint idx; float blend; };
*/
IdxBlend CalcEvIndex(uint evcount, float ev)
{
- ev = (al::numbers::pi_v<float>*0.5f + ev) * static_cast<float>(evcount-1) /
- al::numbers::pi_v<float>;
+ ev = (al::numbers::pi_v<float>*0.5f + ev) * static_cast<float>(evcount-1) *
+ al::numbers::inv_pi_v<float>;
uint idx{float2uint(ev)};
return IdxBlend{minu(idx, evcount-1), ev-static_cast<float>(idx)};
@@ -192,8 +192,8 @@ IdxBlend CalcEvIndex(uint evcount, float ev)
*/
IdxBlend CalcAzIndex(uint azcount, float az)
{
- az = (al::numbers::pi_v<float>*2.0f + az) * static_cast<float>(azcount) /
- (al::numbers::pi_v<float>*2.0f);
+ az = (al::numbers::pi_v<float>*2.0f + az) * static_cast<float>(azcount) *
+ (al::numbers::inv_pi_v<float>*0.5f);
uint idx{float2uint(az)};
return IdxBlend{idx%azcount, az-static_cast<float>(idx)};