nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

alignof.h (500B)


      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 */