From 509f8dab8946cfc311def89f62352c0881e73348 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 15 Oct 2013 22:04:17 +0200 Subject: Util/Macros: replacement for GLib's G_N_ELEMENTS() --- src/pcm/PcmDsd.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/pcm/PcmDsd.cxx') diff --git a/src/pcm/PcmDsd.cxx b/src/pcm/PcmDsd.cxx index 096c5464a..4db274635 100644 --- a/src/pcm/PcmDsd.cxx +++ b/src/pcm/PcmDsd.cxx @@ -20,8 +20,7 @@ #include "config.h" #include "PcmDsd.hxx" #include "dsd2pcm/dsd2pcm.h" - -#include +#include "util/Macros.hxx" #include @@ -30,12 +29,12 @@ PcmDsd::PcmDsd() { - std::fill_n(dsd2pcm, G_N_ELEMENTS(dsd2pcm), nullptr); + std::fill_n(dsd2pcm, ARRAY_SIZE(dsd2pcm), nullptr); } PcmDsd::~PcmDsd() { - for (unsigned i = 0; i < G_N_ELEMENTS(dsd2pcm); ++i) + for (unsigned i = 0; i < ARRAY_SIZE(dsd2pcm); ++i) if (dsd2pcm[i] != nullptr) dsd2pcm_destroy(dsd2pcm[i]); } @@ -43,7 +42,7 @@ PcmDsd::~PcmDsd() void PcmDsd::Reset() { - for (unsigned i = 0; i < G_N_ELEMENTS(dsd2pcm); ++i) + for (unsigned i = 0; i < ARRAY_SIZE(dsd2pcm); ++i) if (dsd2pcm[i] != nullptr) dsd2pcm_reset(dsd2pcm[i]); } @@ -56,7 +55,7 @@ PcmDsd::ToFloat(unsigned channels, bool lsbfirst, assert(src != nullptr); assert(src_size > 0); assert(src_size % channels == 0); - assert(channels <= G_N_ELEMENTS(dsd2pcm)); + assert(channels <= ARRAY_SIZE(dsd2pcm)); const unsigned num_samples = src_size; const unsigned num_frames = src_size / channels; -- cgit v1.2.3