Commit 7d7fe756 authored by Max Kellermann's avatar Max Kellermann

pcm/AudioFormat: use [[gnu::pure]]

parent 1cb7fe12
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "pcm/SampleFormat.hxx" // IWYU pragma: export #include "pcm/SampleFormat.hxx" // IWYU pragma: export
#include "pcm/ChannelDefs.hxx" // IWYU pragma: export #include "pcm/ChannelDefs.hxx" // IWYU pragma: export
#include "util/Compiler.h"
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
...@@ -124,14 +123,14 @@ struct AudioFormat { ...@@ -124,14 +123,14 @@ struct AudioFormat {
void ApplyMask(AudioFormat mask) noexcept; void ApplyMask(AudioFormat mask) noexcept;
gcc_pure [[gnu::pure]]
AudioFormat WithMask(AudioFormat mask) const noexcept { AudioFormat WithMask(AudioFormat mask) const noexcept {
AudioFormat result = *this; AudioFormat result = *this;
result.ApplyMask(mask); result.ApplyMask(mask);
return result; return result;
} }
gcc_pure [[gnu::pure]]
bool MatchMask(AudioFormat mask) const noexcept { bool MatchMask(AudioFormat mask) const noexcept {
return WithMask(mask) == *this; return WithMask(mask) == *this;
} }
...@@ -226,7 +225,7 @@ AudioFormat::GetFrameSize() const noexcept ...@@ -226,7 +225,7 @@ AudioFormat::GetFrameSize() const noexcept
* @param af the #AudioFormat object * @param af the #AudioFormat object
* @return the string buffer * @return the string buffer
*/ */
gcc_const [[gnu::const]]
StringBuffer<24> StringBuffer<24>
ToString(AudioFormat af) noexcept; ToString(AudioFormat af) noexcept;
......
...@@ -116,7 +116,7 @@ sample_format_size(SampleFormat format) noexcept ...@@ -116,7 +116,7 @@ sample_format_size(SampleFormat format) noexcept
* @param format a #SampleFormat enum value * @param format a #SampleFormat enum value
* @return the string * @return the string
*/ */
gcc_pure gcc_returns_nonnull [[gnu::pure]] [[gnu::returns_nonnull]]
const char * const char *
sample_format_to_string(SampleFormat format) noexcept; sample_format_to_string(SampleFormat format) noexcept;
......
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