mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-22 15:31:05 +01:00
Add fallback implementation for constexpr and alignof
This commit is contained in:
1 parent
7cb47d0f3f
commit
bca83618cd
1 file changed
+18
@@ -84,6 +84,10 @@ extern "C" void hb_free_impl(void *ptr);
|
||||
#define nullptr NULL
|
||||
#endif
|
||||
|
||||
#ifndef constexpr
|
||||
#define constexpr const
|
||||
#endif
|
||||
|
||||
// Static assertions
|
||||
#ifndef static_assert
|
||||
#define static_assert(e, msg) \
|
||||
@@ -98,6 +102,20 @@ extern "C" void hb_free_impl(void *ptr);
|
||||
#define thread_local
|
||||
#endif
|
||||
|
||||
#ifndef alignof
|
||||
#define alignof(x) _hb_alignof<x>::value;
|
||||
template <typename T>
|
||||
struct _hb_alignof
|
||||
{
|
||||
struct s
|
||||
{
|
||||
char c;
|
||||
T t;
|
||||
};
|
||||
static constexpr unsigned int value = offsetof (s, t);
|
||||
};
|
||||
#endif // alignof
|
||||
|
||||
#endif // __cplusplus < 201103L
|
||||
|
||||
#if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__)
|
||||
|
||||
Reference in new issue
Block a user