summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-01-17 22:52:09 +0100
committerMax Kellermann <max@musicpd.org>2017-01-17 22:52:09 +0100
commit3f321ae9a05a88b6b036b6bd845d5b60b586ceb3 (patch)
tree71e869c5f70cc62c819169b6069cefccad5f2667 /src
parent161d32a7e79cdbfed22ad97c6cc1cec15958b4f2 (diff)
pcm/SampleFormat: make the two inline functions "constexpr"
Diffstat (limited to 'src')
-rw-r--r--src/pcm/SampleFormat.cxx2
-rw-r--r--src/pcm/SampleFormat.hxx7
-rw-r--r--src/pcm/Volume.cxx1
3 files changed, 5 insertions, 5 deletions
diff --git a/src/pcm/SampleFormat.cxx b/src/pcm/SampleFormat.cxx
index 7968e69b7..5d477115a 100644
--- a/src/pcm/SampleFormat.cxx
+++ b/src/pcm/SampleFormat.cxx
@@ -19,6 +19,8 @@
#include "SampleFormat.hxx"
+#include <assert.h>
+
const char *
sample_format_to_string(SampleFormat format)
{
diff --git a/src/pcm/SampleFormat.hxx b/src/pcm/SampleFormat.hxx
index e5b4c5985..25e6352b6 100644
--- a/src/pcm/SampleFormat.hxx
+++ b/src/pcm/SampleFormat.hxx
@@ -22,7 +22,6 @@
#include "Compiler.h"
-#include <assert.h>
#include <stdint.h>
#if defined(WIN32) && GCC_CHECK_VERSION(4,6)
@@ -65,7 +64,7 @@ enum class SampleFormat : uint8_t {
/**
* Checks whether the sample format is valid.
*/
-static inline bool
+static constexpr inline bool
audio_valid_sample_format(SampleFormat format)
{
switch (format) {
@@ -84,8 +83,7 @@ audio_valid_sample_format(SampleFormat format)
return false;
}
-gcc_const
-static inline unsigned
+static constexpr inline unsigned
sample_format_size(SampleFormat format)
{
switch (format) {
@@ -108,7 +106,6 @@ sample_format_size(SampleFormat format)
return 0;
}
- assert(false);
gcc_unreachable();
}
diff --git a/src/pcm/Volume.cxx b/src/pcm/Volume.cxx
index 41def6dd0..761fd048d 100644
--- a/src/pcm/Volume.cxx
+++ b/src/pcm/Volume.cxx
@@ -27,6 +27,7 @@
#include "PcmDither.cxx" // including the .cxx file to get inlined templates
+#include <assert.h>
#include <stdint.h>
#include <string.h>