]> source.dussan.org Git - rspamd.git/commitdiff
Slightly optimize alignment
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 16 Oct 2015 11:50:56 +0000 (12:50 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 16 Oct 2015 11:50:56 +0000 (12:50 +0100)
config.h.in
src/libutil/keypair_private.h

index 93721f82e00d40d93ab7bfdfe4fcaa915314a4ab..f53f519787f12016c857a864e3c9aa1acb818a15 100644 (file)
  #if !defined(BYTE_ORDER)
  # error "Undefined or unknown BYTE_ORDER"
  #endif
-
-#ifdef _MSC_VER
-# define RSPAMD_PACKED(name) \
-    __pragma(pack(push, 1)) struct name __pragma(pack(pop))
-#elif defined(__GNUC__)
-# define RSPAMD_PACKED(name) struct __attribute__((packed)) name
-#else
-# define RSPAMD_PACKED(name) struct name
-#endif
-
-
-#ifndef RSPAMD_ALIGNED
-#if defined(_MSC_VER)
-# define RSPAMD_ALIGNED(x) __declspec(align(x))
-#elif defined(__GNUC__)
-# define RSPAMD_ALIGNED(x) __attribute__((aligned(x)))
-#else
-# define RSPAMD_ALIGNED(x)
-#endif
-#endif
-
-
-
 #cmakedefine HAVE_SYS_QUEUE_H    1
 #cmakedefine HAVE_SYS_MMAN_H     1
 #cmakedefine HAVE_SYS_SOCKET_H   1
 typedef off_t goffset;
 #endif
 
-#ifndef ALIGN
-#if defined(_MSC_VER)
-# define ALIGN(x) __declspec(align(x))
-#else
-# define ALIGN(x) __attribute__((aligned(x)))
-#endif
-#endif
-
 #ifndef PARAM_H_HAS_BITSET
 /* Bit map related macros. */
 #ifndef NBBY
@@ -364,6 +333,25 @@ typedef off_t goffset;
        ((((const unsigned char *)(a))[(i) / NBBY] & (1 << ((i) % NBBY))) == 0)
 #endif
 
+#ifdef _MSC_VER
+# define RSPAMD_PACKED(name) \
+    __pragma(pack(push, 1)) struct name __pragma(pack(pop))
+#elif defined(__GNUC__)
+# define RSPAMD_PACKED(name) struct __attribute__((packed)) name
+#else
+# define RSPAMD_PACKED(name) struct name
+#endif
+
+#ifndef RSPAMD_ALIGNED
+#if defined(_MSC_VER)
+# define RSPAMD_ALIGNED(x) __declspec(align(x))
+#elif defined(__GNUC__)
+# define RSPAMD_ALIGNED(x) __attribute__((aligned(x)))
+#else
+# define RSPAMD_ALIGNED(x)
+#endif
+#endif
+
 #ifndef BITSPERBYTE
 # define BITSPERBYTE (NBBY * sizeof (char))
 #endif
index ac70f25e65481499d7ae263a63807bb569f6bf0f..757dabb6b3175a771887d249fbe1ac65982859ee 100644 (file)
 #include "blake2.h"
 #include "cryptobox.h"
 
-struct rspamd_http_keypair {
+struct RSPAMD_ALIGNED(32) rspamd_http_keypair  {
        guchar pk[rspamd_cryptobox_PKBYTES];
-       guchar sk[rspamd_cryptobox_SKBYTES];
+       guchar RSPAMD_ALIGNED(32) sk[rspamd_cryptobox_SKBYTES];
        guchar id[BLAKE2B_OUTBYTES];
-       guchar nm[rspamd_cryptobox_NMBYTES];
+       guchar RSPAMD_ALIGNED(32) nm[rspamd_cryptobox_NMBYTES];
        gboolean has_nm;
        ref_entry_t ref;
 };