Skip to content

Commit abbe82a

Browse files
committed
ccan: expose ALIGNED for future manual structure alignment
1 parent f5fc513 commit abbe82a

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/ccan/ccan/compiler/compiler.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,16 @@
228228
#define WARN_UNUSED_RESULT
229229
#endif
230230
#endif
231+
232+
/* ALIGNED - ensure a structure/variable is aligned to a given number of bytes
233+
*
234+
*/
235+
#ifndef ALIGNED
236+
#if (defined(__clang__) || defined(__GNUC__))
237+
#define ALIGNED(N) __attribute__((aligned(N)))
238+
#else
239+
#define ALIGNED(N)
240+
#endif
241+
#endif /* ALIGNED */
242+
231243
#endif /* CCAN_COMPILER_H */

src/ccan/ccan/crypto/sha256/sha256_sse4.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
#include <stdlib.h>
1010

1111
#if defined(__x86_64__) || defined(__amd64__)
12-
/* TODO: Support alignment in compiler.h */
13-
#define ALIGNED(N) __attribute__((aligned(N)))
14-
1512
void TransformSSE4(uint32_t* s, const uint32_t* chunk, size_t blocks)
1613
{
1714
static const uint32_t K256[] ALIGNED(16) = {

0 commit comments

Comments
 (0)