Commit 3f321ae9 authored by Max Kellermann's avatar Max Kellermann

pcm/SampleFormat: make the two inline functions "constexpr"

parent 161d32a7
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include "SampleFormat.hxx" #include "SampleFormat.hxx"
#include <assert.h>
const char * const char *
sample_format_to_string(SampleFormat format) sample_format_to_string(SampleFormat format)
{ {
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "Compiler.h" #include "Compiler.h"
#include <assert.h>
#include <stdint.h> #include <stdint.h>
#if defined(WIN32) && GCC_CHECK_VERSION(4,6) #if defined(WIN32) && GCC_CHECK_VERSION(4,6)
...@@ -65,7 +64,7 @@ enum class SampleFormat : uint8_t { ...@@ -65,7 +64,7 @@ enum class SampleFormat : uint8_t {
/** /**
* Checks whether the sample format is valid. * Checks whether the sample format is valid.
*/ */
static inline bool static constexpr inline bool
audio_valid_sample_format(SampleFormat format) audio_valid_sample_format(SampleFormat format)
{ {
switch (format) { switch (format) {
...@@ -84,8 +83,7 @@ audio_valid_sample_format(SampleFormat format) ...@@ -84,8 +83,7 @@ audio_valid_sample_format(SampleFormat format)
return false; return false;
} }
gcc_const static constexpr inline unsigned
static inline unsigned
sample_format_size(SampleFormat format) sample_format_size(SampleFormat format)
{ {
switch (format) { switch (format) {
...@@ -108,7 +106,6 @@ sample_format_size(SampleFormat format) ...@@ -108,7 +106,6 @@ sample_format_size(SampleFormat format)
return 0; return 0;
} }
assert(false);
gcc_unreachable(); gcc_unreachable();
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "PcmDither.cxx" // including the .cxx file to get inlined templates #include "PcmDither.cxx" // including the .cxx file to get inlined templates
#include <assert.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment