From 7b03f55cb443391b90fe5a3aa5bd8abd71ec5347 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 5 Feb 2020 19:49:18 +0100 Subject: [PATCH] util/bit_reverse: convert to C++ --- src/decoder/plugins/DsdiffDecoderPlugin.cxx | 2 +- src/decoder/plugins/DsfDecoderPlugin.cxx | 2 +- src/pcm/Dsd2Pcm.cxx | 2 +- src/util/{bit_reverse.c => BitReverse.cxx} | 2 +- src/util/{bit_reverse.h => BitReverse.hxx} | 6 +++--- src/util/meson.build | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) rename src/util/{bit_reverse.c => BitReverse.cxx} (97%) rename src/util/{bit_reverse.h => BitReverse.hxx} (91%) diff --git a/src/decoder/plugins/DsdiffDecoderPlugin.cxx b/src/decoder/plugins/DsdiffDecoderPlugin.cxx index ba6a78079..16460627a 100644 --- a/src/decoder/plugins/DsdiffDecoderPlugin.cxx +++ b/src/decoder/plugins/DsdiffDecoderPlugin.cxx @@ -31,7 +31,7 @@ #include "../DecoderAPI.hxx" #include "input/InputStream.hxx" #include "pcm/CheckAudioFormat.hxx" -#include "util/bit_reverse.h" +#include "util/BitReverse.hxx" #include "util/ByteOrder.hxx" #include "util/StringView.hxx" #include "tag/Handler.hxx" diff --git a/src/decoder/plugins/DsfDecoderPlugin.cxx b/src/decoder/plugins/DsfDecoderPlugin.cxx index 62f168d4a..1d8e943c3 100644 --- a/src/decoder/plugins/DsfDecoderPlugin.cxx +++ b/src/decoder/plugins/DsfDecoderPlugin.cxx @@ -32,7 +32,7 @@ #include "../DecoderAPI.hxx" #include "input/InputStream.hxx" #include "pcm/CheckAudioFormat.hxx" -#include "util/bit_reverse.h" +#include "util/BitReverse.hxx" #include "util/ByteOrder.hxx" #include "DsdLib.hxx" #include "tag/Handler.hxx" diff --git a/src/pcm/Dsd2Pcm.cxx b/src/pcm/Dsd2Pcm.cxx index f46ae4371..9b105ae12 100644 --- a/src/pcm/Dsd2Pcm.cxx +++ b/src/pcm/Dsd2Pcm.cxx @@ -32,7 +32,7 @@ or implied, of Sebastian Gesemann. #include "Dsd2Pcm.hxx" #include "Traits.hxx" -#include "util/bit_reverse.h" +#include "util/BitReverse.hxx" #include "util/GenerateArray.hxx" #include diff --git a/src/util/bit_reverse.c b/src/util/BitReverse.cxx similarity index 97% rename from src/util/bit_reverse.c rename to src/util/BitReverse.cxx index a33b08947..29ffb49eb 100644 --- a/src/util/bit_reverse.c +++ b/src/util/BitReverse.cxx @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "bit_reverse.h" +#include "BitReverse.hxx" /** * @see http://graphics.stanford.edu/~seander/bithacks.html#BitReverseTable diff --git a/src/util/bit_reverse.h b/src/util/BitReverse.hxx similarity index 91% rename from src/util/bit_reverse.h rename to src/util/BitReverse.hxx index 9445751c8..c67d8a68e 100644 --- a/src/util/bit_reverse.h +++ b/src/util/BitReverse.hxx @@ -17,8 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MPD_BIT_REVERSE_H -#define MPD_BIT_REVERSE_H +#ifndef MPD_BIT_REVERSE_HXX +#define MPD_BIT_REVERSE_HXX #include "Compiler.h" @@ -28,7 +28,7 @@ extern const uint8_t bit_reverse_table[256]; gcc_const static inline uint8_t -bit_reverse(uint8_t x) +bit_reverse(uint8_t x) noexcept { return bit_reverse_table[x]; } diff --git a/src/util/meson.build b/src/util/meson.build index 9b1e261d7..2339d7702 100644 --- a/src/util/meson.build +++ b/src/util/meson.build @@ -29,7 +29,7 @@ util = static_library( 'OptionParser.cxx', 'ByteReverse.cxx', 'format.c', - 'bit_reverse.c', + 'BitReverse.cxx', include_directories: inc, )