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

This commit is contained in:
Max Kellermann 2017-01-17 22:52:09 +01:00
parent 161d32a7e7
commit 3f321ae9a0
3 changed files with 5 additions and 5 deletions

View File

@ -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)
{ {

View File

@ -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 {
/** /**
* 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)
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)
return 0; return 0;
} }
assert(false);
gcc_unreachable(); gcc_unreachable();
} }

View File

@ -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>