From 54dd1ad09bf2ec16471b2a8d80fb78524cff8841 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 26 Oct 2017 12:25:38 +0200 Subject: [PATCH] pcm/Order: add "noexcept" --- src/pcm/Order.cxx | 23 ++++++++++++----------- src/pcm/Order.hxx | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/pcm/Order.cxx b/src/pcm/Order.cxx index 1812b14dd..8f246bdce 100644 --- a/src/pcm/Order.cxx +++ b/src/pcm/Order.cxx @@ -27,16 +27,16 @@ struct TwoPointers { V *dest; const V *src; - TwoPointers &CopyOne() { + TwoPointers &CopyOne() noexcept { *dest++ = *src++; return *this; } - TwoPointers &CopyTwo() { + TwoPointers &CopyTwo() noexcept { return CopyOne().CopyOne(); } - TwoPointers &SwapTwoPairs() { + TwoPointers &SwapTwoPairs() noexcept { *dest++ = src[2]; *dest++ = src[3]; *dest++ = src[0]; @@ -45,12 +45,12 @@ struct TwoPointers { return *this; } - TwoPointers &ToAlsa51() { + TwoPointers &ToAlsa51() noexcept { return CopyTwo() // left+right .SwapTwoPairs(); // center, LFE, surround left+right } - TwoPointers &ToAlsa71() { + TwoPointers &ToAlsa71() noexcept { return ToAlsa51() .CopyTwo(); // side left+right } @@ -58,7 +58,7 @@ struct TwoPointers { template static void -ToAlsaChannelOrder51(V *dest, const V *src, size_t n) +ToAlsaChannelOrder51(V *dest, const V *src, size_t n) noexcept { TwoPointers p{dest, src}; for (size_t i = 0; i != n; ++i) @@ -67,7 +67,7 @@ ToAlsaChannelOrder51(V *dest, const V *src, size_t n) template static inline ConstBuffer -ToAlsaChannelOrder51(PcmBuffer &buffer, ConstBuffer src) +ToAlsaChannelOrder51(PcmBuffer &buffer, ConstBuffer src) noexcept { auto dest = buffer.GetT(src.size); ToAlsaChannelOrder51(dest, src.data, src.size / 6); @@ -76,7 +76,7 @@ ToAlsaChannelOrder51(PcmBuffer &buffer, ConstBuffer src) template static void -ToAlsaChannelOrder71(V *dest, const V *src, size_t n) +ToAlsaChannelOrder71(V *dest, const V *src, size_t n) noexcept { TwoPointers p{dest, src}; for (size_t i = 0; i != n; ++i) @@ -85,7 +85,7 @@ ToAlsaChannelOrder71(V *dest, const V *src, size_t n) template static inline ConstBuffer -ToAlsaChannelOrder71(PcmBuffer &buffer, ConstBuffer src) +ToAlsaChannelOrder71(PcmBuffer &buffer, ConstBuffer src) noexcept { auto dest = buffer.GetT(src.size); ToAlsaChannelOrder71(dest, src.data, src.size / 6); @@ -94,7 +94,8 @@ ToAlsaChannelOrder71(PcmBuffer &buffer, ConstBuffer src) template static ConstBuffer -ToAlsaChannelOrderT(PcmBuffer &buffer, ConstBuffer src, unsigned channels) +ToAlsaChannelOrderT(PcmBuffer &buffer, ConstBuffer src, + unsigned channels) noexcept { switch (channels) { case 6: // 5.1 @@ -110,7 +111,7 @@ ToAlsaChannelOrderT(PcmBuffer &buffer, ConstBuffer src, unsigned channels) ConstBuffer ToAlsaChannelOrder(PcmBuffer &buffer, ConstBuffer src, - SampleFormat sample_format, unsigned channels) + SampleFormat sample_format, unsigned channels) noexcept { switch (sample_format) { case SampleFormat::UNDEFINED: diff --git a/src/pcm/Order.hxx b/src/pcm/Order.hxx index ab32c3d63..ebd69e714 100644 --- a/src/pcm/Order.hxx +++ b/src/pcm/Order.hxx @@ -32,6 +32,6 @@ template struct ConstBuffer; */ ConstBuffer ToAlsaChannelOrder(PcmBuffer &buffer, ConstBuffer src, - SampleFormat sample_format, unsigned channels); + SampleFormat sample_format, unsigned channels) noexcept; #endif