1 #ifndef AUDIOGRAPHER_TYPE_UTILS_H
2 #define AUDIOGRAPHER_TYPE_UTILS_H
19 template<
typename T,
bool b>
21 { std::uninitialized_fill_n (buffer, samples, T()); }
25 {
memset (buffer, 0, samples *
sizeof(T)); }
29 template<
typename T = DefaultSampleType>
32 static_assert (std::is_trivially_destructible<T>::value);
34 typedef std::bool_constant<std::is_floating_point<T>::value ||
50 { std::uninitialized_copy (source, &source[samples], destination); }
58 if (destination < source) {
59 std::copy (source, &source[samples], destination);
60 }
else if (destination > source) {
61 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 std::bool_constant< b > &)
static void do_zero_fill(T *buffer, samplecnt_t samples, const std::true_type &)
Utilities for initializing, copying, moving, etc. data.
static void move(T const *source, T *destination, samplecnt_t samples)
std::bool_constant< std::is_floating_point< T >::value||std::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)