1
0
mirror of git://jb55.com/damus synced 2024-09-16 10:13:45 +00:00
damus/damus-c/alignof.h
William Casarin dbe1260b54 damus-c: add bolt11 parser from CLN
We'll need this for our lightning invoice view

Signed-off-by: William Casarin <jb55@jb55.com>
2022-10-19 07:45:06 -07:00

21 lines
497 B
C

/* CC0 (Public domain) - see LICENSE file for details */
#ifndef CCAN_ALIGNOF_H
#define CCAN_ALIGNOF_H
#include "config.h"
/**
* ALIGNOF - get the alignment of a type
* @t: the type to test
*
* This returns a safe alignment for the given type.
*/
#if HAVE_ALIGNOF
/* A GCC extension. */
#define ALIGNOF(t) __alignof__(t)
#else
/* Alignment by measuring structure padding. */
#define ALIGNOF(t) ((char *)(&((struct { char c; t _h; } *)0)->_h) - (char *)0)
#endif
#endif /* CCAN_ALIGNOF_H */