From 3ec03cadd2b5059e54e5e9b8f4d506b4c6ce727d Mon Sep 17 00:00:00 2001
From: Chris Robinson <chris.kcat@gmail.com>
Date: Fri, 5 May 2023 06:46:00 -0700
Subject: Use deduction guides instead of helper functions for spans

---
 core/cubic_tables.cpp | 2 +-
 core/hrtf.cpp         | 2 +-
 core/logging.cpp      | 8 ++++----
 core/voice.cpp        | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

(limited to 'core')

diff --git a/core/cubic_tables.cpp b/core/cubic_tables.cpp
index 73ec6b3f..66958735 100644
--- a/core/cubic_tables.cpp
+++ b/core/cubic_tables.cpp
@@ -49,7 +49,7 @@ struct SplineFilterArray {
         mTable[pi].mDeltas[3] = -mTable[pi].mCoeffs[3];
     }
 
-    constexpr auto getTable() const noexcept { return al::as_span(mTable); }
+    constexpr auto& getTable() const noexcept { return mTable; }
 };
 
 constexpr SplineFilterArray SplineFilter{};
diff --git a/core/hrtf.cpp b/core/hrtf.cpp
index 1d9bc368..607e3d3d 100644
--- a/core/hrtf.cpp
+++ b/core/hrtf.cpp
@@ -425,7 +425,7 @@ std::unique_ptr<HrtfStore> CreateHrtfStore(uint rate, uint8_t irSize,
         std::uninitialized_copy_n(delays, irCount, delays_);
 
         /* Finally, assign the storage pointers. */
-        Hrtf->mFields = al::as_span(field_, fields.size());
+        Hrtf->mFields = {field_, fields.size()};
         Hrtf->mElev = elev_;
         Hrtf->mCoeffs = coeffs_;
         Hrtf->mDelays = delays_;
diff --git a/core/logging.cpp b/core/logging.cpp
index 34a95e5a..8e0116ea 100644
--- a/core/logging.cpp
+++ b/core/logging.cpp
@@ -25,13 +25,13 @@ void al_print(LogLevel level, FILE *logfile, const char *fmt, ...)
      * that includes the null terminator, which we want to exclude from the
      * span.
      */
-    auto prefix = al::as_span("[ALSOFT] (--) ").first<14>();
+    auto prefix = al::span{"[ALSOFT] (--) "}.first<14>();
     switch(level)
     {
     case LogLevel::Disable: break;
-    case LogLevel::Error: prefix = al::as_span("[ALSOFT] (EE) ").first<14>(); break;
-    case LogLevel::Warning: prefix = al::as_span("[ALSOFT] (WW) ").first<14>(); break;
-    case LogLevel::Trace: prefix = al::as_span("[ALSOFT] (II) ").first<14>(); break;
+    case LogLevel::Error: prefix = al::span{"[ALSOFT] (EE) "}.first<14>(); break;
+    case LogLevel::Warning: prefix = al::span{"[ALSOFT] (WW) "}.first<14>(); break;
+    case LogLevel::Trace: prefix = al::span{"[ALSOFT] (II) "}.first<14>(); break;
     }
 
     al::vector<char> dynmsg;
diff --git a/core/voice.cpp b/core/voice.cpp
index db6b6d27..478ea81f 100644
--- a/core/voice.cpp
+++ b/core/voice.cpp
@@ -389,7 +389,7 @@ inline void LoadSamples<FmtMSADPCM>(float *RESTRICT dstSamples, const std::byte
         sampleHistory[1] = int(input[2*srcChan + 0]) | (int(input[2*srcChan + 1])<<8);
         input += srcStep*2;
 
-        const auto coeffs = al::as_span(MSADPCMAdaptionCoeff[blockpred]);
+        const al::span coeffs{MSADPCMAdaptionCoeff[blockpred]};
         delta = (delta^0x8000) - 32768;
         sampleHistory[0] = (sampleHistory[0]^0x8000) - 32768;
         sampleHistory[1] = (sampleHistory[1]^0x8000) - 32768;
@@ -798,7 +798,7 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi
         using ResBufType = decltype(DeviceBase::mResampleData);
         static constexpr uint srcSizeMax{static_cast<uint>(ResBufType{}.size()-MaxResamplerEdge)};
 
-        const auto prevSamples = al::as_span(mPrevSamples[chan]);
+        const al::span prevSamples{mPrevSamples[chan]};
         const auto resampleBuffer = std::copy(prevSamples.cbegin(), prevSamples.cend(),
             Device->mResampleData.begin()) - MaxResamplerEdge;
         int intPos{DataPosInt};
-- 
cgit v1.2.3