From fee9f1482c0f593b43f88b2fd589c10d5176e639 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 26 Oct 2017 12:28:21 +0200 Subject: [PATCH] pcm/Pack: add "noexcept" --- src/pcm/PcmPack.cxx | 12 +++++++----- src/pcm/PcmPack.hxx | 9 ++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/pcm/PcmPack.cxx b/src/pcm/PcmPack.cxx index 47d59b32b..5c9f18fb2 100644 --- a/src/pcm/PcmPack.cxx +++ b/src/pcm/PcmPack.cxx @@ -21,7 +21,7 @@ #include "system/ByteOrder.hxx" static void -pack_sample(uint8_t *dest, const int32_t *src0) +pack_sample(uint8_t *dest, const int32_t *src0) noexcept { const uint8_t *src = (const uint8_t *)src0; @@ -34,7 +34,7 @@ pack_sample(uint8_t *dest, const int32_t *src0) } void -pcm_pack_24(uint8_t *dest, const int32_t *src, const int32_t *src_end) +pcm_pack_24(uint8_t *dest, const int32_t *src, const int32_t *src_end) noexcept { /* duplicate loop to help the compiler's optimizer (constant parameter to the pack_sample() inline function) */ @@ -49,7 +49,7 @@ pcm_pack_24(uint8_t *dest, const int32_t *src, const int32_t *src_end) * Construct a signed 24 bit integer from three bytes into a int32_t. */ static constexpr int32_t -ConstructS24(uint8_t low, uint8_t mid, uint8_t high) +ConstructS24(uint8_t low, uint8_t mid, uint8_t high) noexcept { return int32_t(low) | (int32_t(mid) << 8) | (int32_t(high) << 16) | /* extend the sign bit */ @@ -87,7 +87,8 @@ ReadS24(const uint8_t *src) noexcept } void -pcm_unpack_24(int32_t *dest, const uint8_t *src, const uint8_t *src_end) +pcm_unpack_24(int32_t *dest, + const uint8_t *src, const uint8_t *src_end) noexcept { while (src < src_end) { *dest++ = ReadS24(src); @@ -96,7 +97,8 @@ pcm_unpack_24(int32_t *dest, const uint8_t *src, const uint8_t *src_end) } void -pcm_unpack_24be(int32_t *dest, const uint8_t *src, const uint8_t *src_end) +pcm_unpack_24be(int32_t *dest, + const uint8_t *src, const uint8_t *src_end) noexcept { while (src < src_end) { *dest++ = ReadS24BE(src); diff --git a/src/pcm/PcmPack.hxx b/src/pcm/PcmPack.hxx index 9b4d58c08..fe4c0613d 100644 --- a/src/pcm/PcmPack.hxx +++ b/src/pcm/PcmPack.hxx @@ -37,7 +37,8 @@ * @param src the source buffer */ void -pcm_pack_24(uint8_t *dest, const int32_t *src, const int32_t *src_end); +pcm_pack_24(uint8_t *dest, + const int32_t *src, const int32_t *src_end) noexcept; /** * Converts packed 24 bit samples (3 bytes per sample) to padded 24 @@ -47,13 +48,15 @@ pcm_pack_24(uint8_t *dest, const int32_t *src, const int32_t *src_end); * @param src the source buffer (array of triples) */ void -pcm_unpack_24(int32_t *dest, const uint8_t *src, const uint8_t *src_end); +pcm_unpack_24(int32_t *dest, + const uint8_t *src, const uint8_t *src_end) noexcept; /** * Like pcm_unpack_24(), but assume the source byte order is * big-endian. The destination byte order ia always native. */ void -pcm_unpack_24be(int32_t *dest, const uint8_t *src, const uint8_t *src_end); +pcm_unpack_24be(int32_t *dest, + const uint8_t *src, const uint8_t *src_end) noexcept; #endif