diff --git a/src/hb-algs.hh b/src/hb-algs.hh index d03906c4ad9d55e54d7bab9b0cb1061ad270c914..9b524c130f258fb7d4816df9c5fc81176bfe9e45 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -271,18 +271,6 @@ hb_ctz (T v) * Tiny stuff. */ -template 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( - &const_cast( - reinterpret_cast(arg))); -#pragma GCC diagnostic pop -} - /* ASCII tag/character handling */ static inline bool ISALPHA (unsigned char c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); } diff --git a/src/hb-iter.hh b/src/hb-iter.hh index 532918280e11075113b87b3ef7882df82c51d8d2..93db59a9e8344610a548dd2bbd72c5e3046faa23 100644 --- a/src/hb-iter.hh +++ b/src/hb-iter.hh @@ -28,7 +28,6 @@ #define HB_ITER_HH #include "hb.hh" -#include "hb-algs.hh" // for hb_addressof #include "hb-meta.hh" diff --git a/src/hb-meta.hh b/src/hb-meta.hh index a9f9df98b712ca55faecbdc062946a04860d5d7c..b580036381ba5f59fd6c822846eaf20426ab51df 100644 --- a/src/hb-meta.hh +++ b/src/hb-meta.hh @@ -31,10 +31,22 @@ /* - * C++ Template Meta-programming. + * C++ template meta-programming & fundamentals used with them. */ +template 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( + &const_cast( + reinterpret_cast(arg))); +#pragma GCC diagnostic pop +} + template static inline T hb_declval (); #define hb_declval(T) (hb_declval ()) diff --git a/src/hb.hh b/src/hb.hh index eb941bea468ee6a1633654d7cffd32801886c9ae..a6e3667cae9c4c8d84d3a99b0a6a6756cdc0f45b 100644 --- a/src/hb.hh +++ b/src/hb.hh @@ -639,7 +639,7 @@ _hb_memalign(void **memptr, size_t alignment, size_t size) #include "hb-atomic.hh" // Requires: hb-meta #include "hb-null.hh" // Requires: hb-meta #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-array.hh" // Requires: hb-algs hb-iter hb-null #include "hb-vector.hh" // Requires: hb-array hb-null