From 435824e9b5b2441d3cb575eef3c15446d3064898 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Fri, 20 Nov 2015 11:21:31 -0800 Subject: [PATCH] Clean up buffer_t constructors. --- firmware/baseband/baseband_dma.cpp | 4 ++-- firmware/common/buffer.hpp | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/firmware/baseband/baseband_dma.cpp b/firmware/baseband/baseband_dma.cpp index 88bc443e..520365d1 100644 --- a/firmware/baseband/baseband_dma.cpp +++ b/firmware/baseband/baseband_dma.cpp @@ -169,10 +169,10 @@ baseband::buffer_t wait_for_rx_buffer() { const size_t free_index = (next_index + transfers_per_buffer - 2) & transfers_mask; return { reinterpret_cast(lli_loop[free_index].destaddr), transfer_samples }; } else { - return { nullptr, 0 }; + return { }; } } else { - return { nullptr, 0 }; + return { }; } } diff --git a/firmware/common/buffer.hpp b/firmware/common/buffer.hpp index 9df2d9ee..be1846dd 100644 --- a/firmware/common/buffer.hpp +++ b/firmware/common/buffer.hpp @@ -32,18 +32,24 @@ struct buffer_t { const uint32_t sampling_rate; constexpr buffer_t( - T* const p, - const size_t count - ) : p { p }, - count { count }, + ) : p { nullptr }, + count { 0 }, sampling_rate { 0 } { } + constexpr buffer_t( + const buffer_t& other + ) : p { other.p }, + count { other.count }, + sampling_rate { other.sampling_rate } + { + } + constexpr buffer_t( T* const p, const size_t count, - const uint32_t sampling_rate + const uint32_t sampling_rate = 0 ) : p { p }, count { count }, sampling_rate { sampling_rate }