Move hb_addressof() to hb-meta.hh
This commit is contained in:
parent
6cf25c2971
commit
e75b22039f
|
@ -271,18 +271,6 @@ hb_ctz (T v)
|
||||||
* Tiny stuff.
|
* Tiny stuff.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template <typename T> static inline T*
|
|
||||||
hb_addressof (const T& arg)
|
|
||||||
{
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
|
||||||
/* https://en.cppreference.com/w/cpp/memory/addressof */
|
|
||||||
return reinterpret_cast<T*>(
|
|
||||||
&const_cast<char&>(
|
|
||||||
reinterpret_cast<const volatile char&>(arg)));
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ASCII tag/character handling */
|
/* ASCII tag/character handling */
|
||||||
static inline bool ISALPHA (unsigned char c)
|
static inline bool ISALPHA (unsigned char c)
|
||||||
{ return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); }
|
{ return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); }
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#define HB_ITER_HH
|
#define HB_ITER_HH
|
||||||
|
|
||||||
#include "hb.hh"
|
#include "hb.hh"
|
||||||
#include "hb-algs.hh" // for hb_addressof
|
|
||||||
#include "hb-meta.hh"
|
#include "hb-meta.hh"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,22 @@
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* C++ Template Meta-programming.
|
* C++ template meta-programming & fundamentals used with them.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
template <typename T> static inline T*
|
||||||
|
hb_addressof (const T& arg)
|
||||||
|
{
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||||
|
/* https://en.cppreference.com/w/cpp/memory/addressof */
|
||||||
|
return reinterpret_cast<T*>(
|
||||||
|
&const_cast<char&>(
|
||||||
|
reinterpret_cast<const volatile char&>(arg)));
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T> static inline T hb_declval ();
|
template <typename T> static inline T hb_declval ();
|
||||||
#define hb_declval(T) (hb_declval<T> ())
|
#define hb_declval(T) (hb_declval<T> ())
|
||||||
|
|
||||||
|
|
|
@ -639,7 +639,7 @@ _hb_memalign(void **memptr, size_t alignment, size_t size)
|
||||||
#include "hb-atomic.hh" // Requires: hb-meta
|
#include "hb-atomic.hh" // Requires: hb-meta
|
||||||
#include "hb-null.hh" // Requires: hb-meta
|
#include "hb-null.hh" // Requires: hb-meta
|
||||||
#include "hb-algs.hh" // Requires: hb-null
|
#include "hb-algs.hh" // Requires: hb-null
|
||||||
#include "hb-iter.hh" // Requires: hb-algs hb-meta
|
#include "hb-iter.hh" // Requires: hb-meta
|
||||||
#include "hb-debug.hh" // Requires: hb-algs hb-atomic
|
#include "hb-debug.hh" // Requires: hb-algs hb-atomic
|
||||||
#include "hb-array.hh" // Requires: hb-algs hb-iter hb-null
|
#include "hb-array.hh" // Requires: hb-algs hb-iter hb-null
|
||||||
#include "hb-vector.hh" // Requires: hb-array hb-null
|
#include "hb-vector.hh" // Requires: hb-array hb-null
|
||||||
|
|
Loading…
Reference in New Issue