3 * File name: ir/adt/align.h
4 * Purpose: macros for alignment.
5 * Author: Markus Armbruster
7 * Created: 1999 by getting from fiasco
9 * Copyright: (c) 1995, 1996 Markus Armbruster
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
21 /** A size handled efficiently by malloc(), at least 1K. */
22 #define PREF_MALLOC_SIZE 2048
25 /** A wrapper around GNU C's __attribute__ */
27 /* According to the documentation, the attributes we are interested in
28 work with 2.5, but we encountered trouble before 2.7. */
29 #if defined (__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 7
30 # define HAVE_ATTRIBUTE 1
31 # define ATTRIBUTE(attrs) __attribute__ (attrs)
33 # define ATTRIBUTE(attrs)
39 /** A type that has most constrained alignment. */
44 } aligned_type ATTRIBUTE ((aligned));
46 /** Inquiring about the alignment of a type. */
48 # define ALIGNOF(type) __alignof__ (type)
50 # define ALIGNOF(type) offsetof (struct { char c; type d; }, d)
53 /** Maximal alignment required for any type. */
54 #define MAX_ALIGN ALIGNOF (aligned_type)