提交 2aae617a 编写于 作者: B Behdad Esfahbod

Move _hb_alignof later again

It uses constexpr...
上级 f3a74c16
......@@ -84,19 +84,9 @@ extern "C" int hb_memalign_impl(void **memptr, size_t alignment, size_t size);
#endif
/* Compiler attributes */
template <typename T>
struct _hb_alignof
{
struct s
{
char c;
T t;
};
static constexpr size_t value = offsetof (s, t);
};
/*
* Compiler attributes
* */
#if __cplusplus < 201103L
......@@ -122,6 +112,16 @@ struct _hb_alignof
#define thread_local
#endif
template <typename T>
struct _hb_alignof
{
struct s
{
char c;
T t;
};
static constexpr size_t value = offsetof (s, t);
};
#ifndef alignof
#define alignof(x) (_hb_alignof<x>::value)
#endif // alignof
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册