1 #ifndef AUDIOGRAPHER_TYPE_UTILS_H
2 #define AUDIOGRAPHER_TYPE_UTILS_H
4 #include <boost/static_assert.hpp>
5 #include <boost/type_traits.hpp>
21 template<
typename T,
bool b>
23 { std::uninitialized_fill_n (buffer, samples, T()); }
27 {
memset (buffer, 0, samples *
sizeof(T)); }
31 template<
typename T = DefaultSampleType>
36 typedef boost::integral_constant<bool,
37 boost::is_floating_point<T>::value ||
53 { std::uninitialized_copy (source, &source[samples], destination); }
61 if (destination < source) {
62 std::copy (source, &source[samples], destination);
63 }
else if (destination > source) {
64 std::copy_backward (source, &source[samples], destination + samples);
#define LIBAUDIOGRAPHER_API
Non-template base class for TypeUtils.
static void do_zero_fill(T *buffer, samplecnt_t samples, const boost::integral_constant< bool, b > &)
static void do_zero_fill(T *buffer, samplecnt_t samples, const boost::true_type &)
Utilities for initializing, copying, moving, etc. data.
static void move(T const *source, T *destination, samplecnt_t samples)
BOOST_STATIC_ASSERT(boost::has_trivial_destructor< T >::value)
boost::integral_constant< bool, boost::is_floating_point< T >::value||boost::is_signed< T >::value > zero_fillable
static void zero_fill(T *buffer, samplecnt_t samples)
static void copy(T const *source, T *destination, samplecnt_t samples)
void memset(float *data, const float val, const uint32_t n_samples)