diff options
author | Chris Robinson <[email protected]> | 2023-05-04 11:39:13 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-05-04 11:39:13 -0700 |
commit | 7cbf3ba2e2bab5c3aecb001e1d387c89309dbec4 (patch) | |
tree | 6fae4aae25d87e7435b2f0b0936b822360851c9b /core/fmt_traits.h | |
parent | 6e0a0a2692a4303d6410c24bf83e09ca47ac6759 (diff) |
Use std::byte instead of a custom al::byte
Diffstat (limited to 'core/fmt_traits.h')
-rw-r--r-- | core/fmt_traits.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/core/fmt_traits.h b/core/fmt_traits.h index f797f836..1879c81b 100644 --- a/core/fmt_traits.h +++ b/core/fmt_traits.h @@ -1,10 +1,9 @@ #ifndef CORE_FMT_TRAITS_H #define CORE_FMT_TRAITS_H -#include <stddef.h> +#include <cstddef> #include <stdint.h> -#include "albyte.h" #include "buffer_storage.h" @@ -22,36 +21,35 @@ struct FmtTypeTraits<FmtUByte> { using Type = uint8_t; template<typename OutT> - static constexpr inline OutT to(const Type val) noexcept - { return val*OutT{1.0/128.0} - OutT{1.0}; } + static constexpr OutT to(const Type val) noexcept { return val*OutT{1.0/128.0} - OutT{1.0}; } }; template<> struct FmtTypeTraits<FmtShort> { using Type = int16_t; template<typename OutT> - static constexpr inline OutT to(const Type val) noexcept { return val*OutT{1.0/32768.0}; } + static constexpr OutT to(const Type val) noexcept { return val*OutT{1.0/32768.0}; } }; template<> struct FmtTypeTraits<FmtFloat> { using Type = float; template<typename OutT> - static constexpr inline OutT to(const Type val) noexcept { return val; } + static constexpr OutT to(const Type val) noexcept { return val; } }; template<> struct FmtTypeTraits<FmtDouble> { using Type = double; template<typename OutT> - static constexpr inline OutT to(const Type val) noexcept { return static_cast<OutT>(val); } + static constexpr OutT to(const Type val) noexcept { return static_cast<OutT>(val); } }; template<> struct FmtTypeTraits<FmtMulaw> { using Type = uint8_t; template<typename OutT> - static constexpr inline OutT to(const Type val) noexcept + static constexpr OutT to(const Type val) noexcept { return muLawDecompressionTable[val] * OutT{1.0/32768.0}; } }; template<> @@ -59,14 +57,14 @@ struct FmtTypeTraits<FmtAlaw> { using Type = uint8_t; template<typename OutT> - static constexpr inline OutT to(const Type val) noexcept + static constexpr OutT to(const Type val) noexcept { return aLawDecompressionTable[val] * OutT{1.0/32768.0}; } }; template<FmtType SrcType, typename DstT> -inline void LoadSampleArray(DstT *RESTRICT dst, const al::byte *src, const size_t srcstep, - const size_t samples) noexcept +inline void LoadSampleArray(DstT *RESTRICT dst, const std::byte *src, const std::size_t srcstep, + const std::size_t samples) noexcept { using TypeTraits = FmtTypeTraits<SrcType>; using SampleType = typename TypeTraits::Type; |