use [[gnu::...]] attributes

This commit is contained in:
Max Kellermann
2023-03-06 15:57:36 +01:00
parent 3b9aab0684
commit 42f6a0441c
101 changed files with 167 additions and 234 deletions
+2 -4
View File
@@ -4,8 +4,6 @@
#ifndef MPD_PCM_UTILS_H
#define MPD_PCM_UTILS_H
#include "util/Compiler.h"
#include <cstdint>
#include <limits>
@@ -26,10 +24,10 @@ PcmClamp(typename Traits::long_type x) noexcept
static_assert(Traits::MIN >= limits::min(), "out of range");
static_assert(Traits::MAX <= limits::max(), "out of range");
if (gcc_unlikely(x < Traits::MIN))
if (x < Traits::MIN) [[unlikely]]
return T(Traits::MIN);
if (gcc_unlikely(x > Traits::MAX))
if (x > Traits::MAX) [[unlikely]]
return T(Traits::MAX);
return T(x);
-1
View File
@@ -5,7 +5,6 @@
#define MPD_PCM_MIX_HXX
#include "SampleFormat.hxx"
#include "util/Compiler.h"
#include <cstddef>
+3 -5
View File
@@ -43,8 +43,7 @@ ConstructS24(uint8_t low, uint8_t mid, uint8_t high) noexcept
/**
* Read a packed signed little-endian 24 bit integer.
*/
gcc_pure
static int32_t
static constexpr int32_t
ReadS24LE(const uint8_t *src) noexcept
{
return ConstructS24(src[0], src[1], src[2]);
@@ -53,8 +52,7 @@ ReadS24LE(const uint8_t *src) noexcept
/**
* Read a packed signed big-endian 24 bit integer.
*/
gcc_pure
static int32_t
static constexpr int32_t
ReadS24BE(const uint8_t *src) noexcept
{
return ConstructS24(src[2], src[1], src[0]);
@@ -63,7 +61,7 @@ ReadS24BE(const uint8_t *src) noexcept
/**
* Read a packed signed native-endian 24 bit integer.
*/
gcc_pure
[[gnu::pure]]
static int32_t
ReadS24(const uint8_t *src) noexcept
{
-2
View File
@@ -4,8 +4,6 @@
#ifndef MPD_PCM_RESAMPLER_HXX
#define MPD_PCM_RESAMPLER_HXX
#include "util/Compiler.h"
#include <cstddef>
#include <span>
+2 -3
View File
@@ -48,8 +48,7 @@ static constexpr struct {
{ SOXR_INVALID_RECIPE, nullptr }
};
gcc_const
static const char *
static constexpr const char *
soxr_quality_name(unsigned long recipe) noexcept
{
for (const auto *i = soxr_quality_table;; ++i) {
@@ -60,7 +59,7 @@ soxr_quality_name(unsigned long recipe) noexcept
}
}
gcc_pure
[[gnu::pure]]
static unsigned long
soxr_parse_quality(const char *quality) noexcept
{