damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

alignof.h (497B)


      1 /* CC0 (Public domain) - see LICENSE file for details */
      2 #ifndef CCAN_ALIGNOF_H
      3 #define CCAN_ALIGNOF_H
      4 #include "config.h"
      5 
      6 /**
      7  * ALIGNOF - get the alignment of a type
      8  * @t: the type to test
      9  *
     10  * This returns a safe alignment for the given type.
     11  */
     12 #if HAVE_ALIGNOF
     13 /* A GCC extension. */
     14 #define ALIGNOF(t) __alignof__(t)
     15 #else
     16 /* Alignment by measuring structure padding. */
     17 #define ALIGNOF(t) ((char *)(&((struct { char c; t _h; } *)0)->_h) - (char *)0)
     18 #endif
     19 
     20 #endif /* CCAN_ALIGNOF_H */