Merge pull request #205 from jpcima/misc

Misc
This commit is contained in:
JP Cimalando 2020-05-03 05:16:26 +02:00 committed by GitHub
commit b528f54db1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View file

@ -55,12 +55,17 @@ struct GetIndexShuffleBits<false, array_size, elements_per_cache_line> {
// the element within the cache line) with the next N bits (which are the index of the cache line)
// of the element index.
template<int BITS>
constexpr unsigned remap_index(unsigned index) noexcept {
constexpr unsigned MASK = (1u << BITS) - 1;
unsigned mix = (index ^ (index >> BITS)) & MASK;
constexpr unsigned remap_index_with_mix(unsigned index, unsigned mix)
{
return index ^ mix ^ (mix << BITS);
}
template<int BITS>
constexpr unsigned remap_index(unsigned index) noexcept {
return remap_index_with_mix<BITS>(
index, (index ^ (index >> BITS)) & ((1u << BITS) - 1));
}
template<>
constexpr unsigned remap_index<0>(unsigned index) noexcept {
return index;
@ -68,8 +73,7 @@ constexpr unsigned remap_index<0>(unsigned index) noexcept {
template<int BITS, class T>
constexpr T& map(T* elements, unsigned index) noexcept {
index = remap_index<BITS>(index);
return elements[index];
return elements[remap_index<BITS>(index)];
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -265,7 +265,6 @@ private:
float baseVolumedB{ 0.0 };
float baseGain { 1.0 };
float baseFrequency { 440.0 };
float phase { 0.0f };
float floatPositionOffset { 0.0f };
int sourcePosition { 0 };