pcm/Dsd*: add "noexcept"

This commit is contained in:
Max Kellermann 2017-10-26 12:26:50 +02:00
parent 54dd1ad09b
commit ae67f44c6e
4 changed files with 12 additions and 8 deletions

View File

@ -26,7 +26,7 @@
* Construct a 16 bit integer from two bytes. * Construct a 16 bit integer from two bytes.
*/ */
static constexpr inline uint16_t static constexpr inline uint16_t
Construct16(uint8_t a, uint8_t b) Construct16(uint8_t a, uint8_t b) noexcept
{ {
/* "a" is the oldest byte, which must be in the most /* "a" is the oldest byte, which must be in the most
significant byte */ significant byte */
@ -35,13 +35,14 @@ Construct16(uint8_t a, uint8_t b)
} }
static constexpr inline uint16_t static constexpr inline uint16_t
Dsd8To16Sample(const uint8_t *src, unsigned channels) Dsd8To16Sample(const uint8_t *src, unsigned channels) noexcept
{ {
return Construct16(src[0], src[channels]); return Construct16(src[0], src[channels]);
} }
ConstBuffer<uint16_t> ConstBuffer<uint16_t>
Dsd8To16(PcmBuffer &buffer, unsigned channels, ConstBuffer<uint8_t> _src) Dsd8To16(PcmBuffer &buffer, unsigned channels,
ConstBuffer<uint8_t> _src) noexcept
{ {
const size_t in_frames = _src.size / channels; const size_t in_frames = _src.size / channels;
const size_t out_frames = in_frames / 2; const size_t out_frames = in_frames / 2;

View File

@ -31,6 +31,7 @@ class PcmBuffer;
* Convert DSD_U8 to DSD_U16 (native endian, oldest bits in MSB). * Convert DSD_U8 to DSD_U16 (native endian, oldest bits in MSB).
*/ */
ConstBuffer<uint16_t> ConstBuffer<uint16_t>
Dsd8To16(PcmBuffer &buffer, unsigned channels, ConstBuffer<uint8_t> src); Dsd8To16(PcmBuffer &buffer, unsigned channels,
ConstBuffer<uint8_t> src) noexcept;
#endif #endif

View File

@ -26,7 +26,7 @@
* Construct a 32 bit integer from four bytes. * Construct a 32 bit integer from four bytes.
*/ */
static constexpr inline uint32_t static constexpr inline uint32_t
Construct32(uint8_t a, uint8_t b, uint8_t c, uint8_t d) Construct32(uint8_t a, uint8_t b, uint8_t c, uint8_t d) noexcept
{ {
/* "a" is the oldest byte, which must be in the most /* "a" is the oldest byte, which must be in the most
significant byte */ significant byte */
@ -36,14 +36,15 @@ Construct32(uint8_t a, uint8_t b, uint8_t c, uint8_t d)
} }
static constexpr inline uint32_t static constexpr inline uint32_t
Dsd8To32Sample(const uint8_t *src, unsigned channels) Dsd8To32Sample(const uint8_t *src, unsigned channels) noexcept
{ {
return Construct32(src[0], src[channels], return Construct32(src[0], src[channels],
src[2 * channels], src[3 * channels]); src[2 * channels], src[3 * channels]);
} }
ConstBuffer<uint32_t> ConstBuffer<uint32_t>
Dsd8To32(PcmBuffer &buffer, unsigned channels, ConstBuffer<uint8_t> _src) Dsd8To32(PcmBuffer &buffer, unsigned channels,
ConstBuffer<uint8_t> _src) noexcept
{ {
const size_t in_frames = _src.size / channels; const size_t in_frames = _src.size / channels;
const size_t out_frames = in_frames / 4; const size_t out_frames = in_frames / 4;

View File

@ -31,6 +31,7 @@ class PcmBuffer;
* Convert DSD_U8 to DSD_U32 (native endian, oldest bits in MSB). * Convert DSD_U8 to DSD_U32 (native endian, oldest bits in MSB).
*/ */
ConstBuffer<uint32_t> ConstBuffer<uint32_t>
Dsd8To32(PcmBuffer &buffer, unsigned channels, ConstBuffer<uint8_t> src); Dsd8To32(PcmBuffer &buffer, unsigned channels,
ConstBuffer<uint8_t> src) noexcept;
#endif #endif