summaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-04-19 02:11:04 -0700
committerChris Robinson <[email protected]>2014-04-19 02:11:04 -0700
commit59fc9aac0ee41518dba0cbd2f1518decffeaa480 (patch)
treeac9793a8e3015e595b2f679b82b7f11e4472f717 /Alc
parent8badd3740e1a2e13affb4553c69ca44b1649035b (diff)
Use C11 alignas when available
Diffstat (limited to 'Alc')
-rw-r--r--Alc/align.h21
-rw-r--r--Alc/mixer_inc.c4
2 files changed, 24 insertions, 1 deletions
diff --git a/Alc/align.h b/Alc/align.h
new file mode 100644
index 00000000..babd4106
--- /dev/null
+++ b/Alc/align.h
@@ -0,0 +1,21 @@
+#ifndef AL_ALIGN_H
+#define AL_ALIGN_H
+
+#ifdef HAVE_STDALIGN_H
+#include <stdalign.h>
+#endif
+
+#ifndef alignas
+#ifdef HAVE_C11_ALIGNAS
+#define alignas _Alignas
+#elif defined(IN_IDE_PARSER)
+/* KDevelop has problems with our align macro, so just use nothing for parsing. */
+#define alignas(x)
+#else
+/* NOTE: Our custom ALIGN macro can't take a type name like alignas can. For
+ * maximum compatibility, only provide constant integer values to alignas. */
+#define alignas(_x) ALIGN(_x)
+#endif
+#endif
+
+#endif /* AL_ALIGN_H */
diff --git a/Alc/mixer_inc.c b/Alc/mixer_inc.c
index a2d0a16c..4748f785 100644
--- a/Alc/mixer_inc.c
+++ b/Alc/mixer_inc.c
@@ -2,8 +2,10 @@
#include "alMain.h"
#include "alSource.h"
+
#include "hrtf.h"
#include "mixer_defs.h"
+#include "align.h"
#define REAL_MERGE2(a,b) a##b
@@ -36,7 +38,7 @@ void MixDirect_Hrtf(DirectParams *params, const ALfloat *restrict data, ALuint s
ALfloat (*restrict Values)[2] = params->Mix.Hrtf.State.Values[srcchan];
ALuint Counter = maxu(params->Counter, OutPos) - OutPos;
ALuint Offset = params->Offset + OutPos;
- ALIGN(16) ALfloat Coeffs[HRIR_LENGTH][2];
+ alignas(16) ALfloat Coeffs[HRIR_LENGTH][2];
ALuint Delay[2];
ALfloat left, right;
ALuint pos;