aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-07-29 09:29:35 -0700
committerChris Robinson <[email protected]>2019-07-29 09:29:35 -0700
commitf0408809d6b2012aca0f1e8a344e087cb504a231 (patch)
tree3cecaa9827519ce5419febe9f584881ad286c97e /common
parent40e937c63a2a74ef2ff94ba8a056cce0a07832ed (diff)
Cleanup common sources' includes
Diffstat (limited to 'common')
-rw-r--r--common/alcomplex.cpp11
-rw-r--r--common/almalloc.h11
-rw-r--r--common/alnumeric.h3
-rw-r--r--common/aloptional.h2
-rw-r--r--common/alspan.h6
-rw-r--r--common/threads.cpp20
-rw-r--r--common/threads.h4
-rw-r--r--common/vecmat.h13
8 files changed, 37 insertions, 33 deletions
diff --git a/common/alcomplex.cpp b/common/alcomplex.cpp
index 9074cf5f..71d3c5f8 100644
--- a/common/alcomplex.cpp
+++ b/common/alcomplex.cpp
@@ -3,14 +3,13 @@
#include "alcomplex.h"
-#include <cmath>
#include <algorithm>
+#include <cmath>
+#include <cstddef>
+#include <utility>
-namespace {
-
-constexpr double Pi{3.141592653589793238462643383279502884};
+#include "math_defs.h"
-} // namespace
void complex_fft(const al::span<std::complex<double>> buffer, const double sign)
{
@@ -36,7 +35,7 @@ void complex_fft(const al::span<std::complex<double>> buffer, const double sign)
for(size_t i{1u};i < fftsize;i<<=1, step<<=1)
{
const size_t step2{step >> 1};
- double arg{Pi / step2};
+ double arg{al::MathDefs<double>::Pi() / step2};
std::complex<double> w{std::cos(arg), std::sin(arg)*sign};
std::complex<double> u{1.0, 0.0};
diff --git a/common/almalloc.h b/common/almalloc.h
index 801df1d8..3fc979c9 100644
--- a/common/almalloc.h
+++ b/common/almalloc.h
@@ -1,11 +1,14 @@
#ifndef AL_MALLOC_H
#define AL_MALLOC_H
-#include <stddef.h>
-
-#include <memory>
-#include <limits>
#include <algorithm>
+#include <cstddef>
+#include <iterator>
+#include <limits>
+#include <memory>
+#include <new>
+#include <type_traits>
+#include <utility>
void *al_malloc(size_t alignment, size_t size);
diff --git a/common/alnumeric.h b/common/alnumeric.h
index e97c40e2..950eebe1 100644
--- a/common/alnumeric.h
+++ b/common/alnumeric.h
@@ -1,7 +1,8 @@
#ifndef AL_NUMERIC_H
#define AL_NUMERIC_H
-#include <stdint.h>
+#include <cstddef>
+#include <cstdint>
#ifdef HAVE_INTRIN_H
#include <intrin.h>
#endif
diff --git a/common/aloptional.h b/common/aloptional.h
index 2ed882e4..79827482 100644
--- a/common/aloptional.h
+++ b/common/aloptional.h
@@ -1,7 +1,9 @@
#ifndef AL_OPTIONAL_H
#define AL_OPTIONAL_H
+#include <initializer_list>
#include <type_traits>
+#include <utility>
#include "almalloc.h"
diff --git a/common/alspan.h b/common/alspan.h
index b7995121..60a2bc4a 100644
--- a/common/alspan.h
+++ b/common/alspan.h
@@ -1,11 +1,11 @@
#ifndef AL_SPAN_H
#define AL_SPAN_H
-#include <cstddef>
-
#include <array>
-#include <type_traits>
+#include <cstddef>
#include <initializer_list>
+#include <iterator>
+#include <type_traits>
namespace al {
diff --git a/common/threads.cpp b/common/threads.cpp
index 45f73243..fe34f5b0 100644
--- a/common/threads.cpp
+++ b/common/threads.cpp
@@ -22,12 +22,13 @@
#include "threads.h"
-#include <limits>
#include <system_error>
#ifdef _WIN32
+#include <limits>
+
void althrd_setname(const char *name)
{
#if defined(_MSC_VER)
@@ -86,7 +87,7 @@ bool semaphore::try_wait() noexcept
#else
-#include <cerrno>
+#if defined(HAVE_PTHREAD_SETNAME_NP) || defined(HAVE_PTHREAD_SET_NAME_NP)
#include <pthread.h>
#ifdef HAVE_PTHREAD_NP_H
#include <pthread_np.h>
@@ -94,20 +95,21 @@ bool semaphore::try_wait() noexcept
void althrd_setname(const char *name)
{
-#if defined(HAVE_PTHREAD_SETNAME_NP)
-#if defined(PTHREAD_SETNAME_NP_ONE_PARAM)
+#if defined(HAVE_PTHREAD_SET_NAME_NP)
+ pthread_set_name_np(pthread_self(), name);
+#elif defined(PTHREAD_SETNAME_NP_ONE_PARAM)
pthread_setname_np(name);
#elif defined(PTHREAD_SETNAME_NP_THREE_PARAMS)
pthread_setname_np(pthread_self(), "%s", (void*)name);
#else
pthread_setname_np(pthread_self(), name);
#endif
-#elif defined(HAVE_PTHREAD_SET_NAME_NP)
- pthread_set_name_np(pthread_self(), name);
+}
+
#else
- (void)name;
+
+void althrd_setname(const char*) { }
#endif
-}
namespace al {
@@ -134,6 +136,8 @@ bool semaphore::try_wait() noexcept
#else /* !__APPLE__ */
+#include <cerrno>
+
semaphore::semaphore(unsigned int initial)
{
if(sem_init(&mSem, 0, initial) != 0)
diff --git a/common/threads.h b/common/threads.h
index 8a640390..ff571a66 100644
--- a/common/threads.h
+++ b/common/threads.h
@@ -1,10 +1,6 @@
#ifndef AL_THREADS_H
#define AL_THREADS_H
-#include <time.h>
-
-#include <mutex>
-
#if defined(__GNUC__) && defined(__i386__)
/* force_align_arg_pointer is required for proper function arguments aligning
* when SSE code is used. Some systems (Windows, QNX) do not guarantee our
diff --git a/common/vecmat.h b/common/vecmat.h
index ab407b15..83f1381e 100644
--- a/common/vecmat.h
+++ b/common/vecmat.h
@@ -1,12 +1,11 @@
#ifndef COMMON_VECMAT_H
#define COMMON_VECMAT_H
-#include <cmath>
#include <array>
+#include <cmath>
+#include <cstddef>
#include <limits>
-#include <algorithm>
-#include "math_defs.h"
namespace alu {
@@ -19,11 +18,11 @@ public:
: mVals{{a, b, c, d}}
{ }
Vector(const Vector &rhs) noexcept
- { std::copy(rhs.mVals.begin(), rhs.mVals.end(), mVals.begin()); }
+ { mVals = rhs.mVals; }
Vector& operator=(const Vector &rhs) noexcept
{
- std::copy(rhs.mVals.begin(), rhs.mVals.end(), mVals.begin());
+ mVals = rhs.mVals;
return *this;
}
@@ -67,11 +66,11 @@ public:
: mVals{{{{aa, ab, ac, ad}}, {{ba, bb, bc, bd}}, {{ca, cb, cc, cd}}, {{da, db, dc, dd}}}}
{ }
Matrix(const Matrix &rhs) noexcept
- { std::copy(rhs.mVals.begin(), rhs.mVals.end(), mVals.begin()); }
+ { mVals = rhs.mVals; }
Matrix& operator=(const Matrix &rhs) noexcept
{
- std::copy(rhs.mVals.begin(), rhs.mVals.end(), mVals.begin());
+ mVals = rhs.mVals;
return *this;
}