aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-10-15 06:17:58 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-10-15 06:17:58 +0300
commit428d5035d0803f135e65e7c968d2a90888099c8d (patch)
tree5f5c805c4ac3202f46d1a510ba7d1f5c48eadf58 /include
parentCMakeLists.txt fixes (diff)
downloadaes-tools-428d5035d0803f135e65e7c968d2a90888099c8d.tar.gz
aes-tools-428d5035d0803f135e65e7c968d2a90888099c8d.zip
add "portable" alignment macro
Diffstat (limited to '')
-rw-r--r--include/aes/all.h1
-rw-r--r--include/aes/workarounds.h14
2 files changed, 15 insertions, 0 deletions
diff --git a/include/aes/all.h b/include/aes/all.h
index 959e10c..ff27c18 100644
--- a/include/aes/all.h
+++ b/include/aes/all.h
@@ -18,3 +18,4 @@
#include "error.h"
#include "mode.h"
#include "padding.h"
+#include "workarounds.h"
diff --git a/include/aes/workarounds.h b/include/aes/workarounds.h
new file mode 100644
index 0000000..45fece2
--- /dev/null
+++ b/include/aes/workarounds.h
@@ -0,0 +1,14 @@
+// Copyright (c) 2016 Egor Tensin <Egor.Tensin@gmail.com>
+// This file is part of the "AES tools" project.
+// For details, see https://github.com/egor-tensin/aes-tools.
+// Distributed under the MIT License.
+
+#pragma once
+
+#if defined(_MSC_VER)
+#define AES_ALIGN(t, x) __declspec(align(x)) t
+#elif defined(__GNUC__) || defined(__MINGW32__)
+#define AES_ALIGN(t, x) t __attribute__((aligned(x)))
+#else
+#warning "couldn't determine alignment attribute"
+#endif