[blob] Use min_size, instead of null_size in .as<T>()
Part of https://github.com/harfbuzz/harfbuzz/pull/2067
This commit is contained in:
parent
a4fb5da984
commit
499248c533
|
@ -219,7 +219,7 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
|
|||
unsigned P = sizeof (Type),
|
||||
hb_enable_if (P == 1)>
|
||||
const T *as () const
|
||||
{ return length < hb_null_size (T) ? &Null (T) : reinterpret_cast<const T *> (arrayZ); }
|
||||
{ return length < hb_min_size (T) ? &Null (T) : reinterpret_cast<const T *> (arrayZ); }
|
||||
|
||||
template <typename T,
|
||||
unsigned P = sizeof (Type),
|
||||
|
|
|
@ -50,7 +50,6 @@ template <typename T, typename>
|
|||
struct _hb_null_size : hb_integral_constant<unsigned, sizeof (T)> {};
|
||||
template <typename T>
|
||||
struct _hb_null_size<T, hb_void_t<decltype (T::min_size)>> : hb_integral_constant<unsigned, T::null_size> {};
|
||||
|
||||
template <typename T>
|
||||
using hb_null_size = _hb_null_size<T, void>;
|
||||
#define hb_null_size(T) hb_null_size<T>::value
|
||||
|
@ -68,6 +67,14 @@ template <typename T>
|
|||
using hb_static_size = _hb_static_size<T, void>;
|
||||
#define hb_static_size(T) hb_static_size<T>::value
|
||||
|
||||
template <typename T, typename>
|
||||
struct _hb_min_size : hb_integral_constant<unsigned, sizeof (T)> {};
|
||||
template <typename T>
|
||||
struct _hb_min_size<T, hb_void_t<decltype (T::min_size)>> : hb_integral_constant<unsigned, T::min_size> {};
|
||||
template <typename T>
|
||||
using hb_min_size = _hb_min_size<T, void>;
|
||||
#define hb_min_size(T) hb_min_size<T>::value
|
||||
|
||||
|
||||
/*
|
||||
* Null()
|
||||
|
|
Loading…
Reference in New Issue