|
|
|
@ -530,6 +530,35 @@ struct hb_auto_t : Type |
|
|
|
|
void fini (void) {} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct hb_bytes_t |
|
|
|
|
{ |
|
|
|
|
inline hb_bytes_t (void) : arrayZ (nullptr), len (0) {} |
|
|
|
|
inline hb_bytes_t (const char *bytes_, unsigned int len_) : arrayZ (bytes_), len (len_) {} |
|
|
|
|
inline hb_bytes_t (const void *bytes_, unsigned int len_) : arrayZ ((const char *) bytes_), len (len_) {} |
|
|
|
|
template <typename T> |
|
|
|
|
inline hb_bytes_t (const T& array) : arrayZ ((const char *) array.arrayZ), len (array.len) {} |
|
|
|
|
|
|
|
|
|
inline void free (void) { ::free ((void *) arrayZ); arrayZ = nullptr; len = 0; } |
|
|
|
|
|
|
|
|
|
inline int cmp (const hb_bytes_t &a) const |
|
|
|
|
{ |
|
|
|
|
if (len != a.len) |
|
|
|
|
return (int) a.len - (int) len; |
|
|
|
|
|
|
|
|
|
return memcmp (a.arrayZ, arrayZ, len); |
|
|
|
|
} |
|
|
|
|
static inline int cmp (const void *pa, const void *pb) |
|
|
|
|
{ |
|
|
|
|
hb_bytes_t *a = (hb_bytes_t *) pa; |
|
|
|
|
hb_bytes_t *b = (hb_bytes_t *) pb; |
|
|
|
|
return b->cmp (*a); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const char *arrayZ; |
|
|
|
|
unsigned int len; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
template <typename T> |
|
|
|
|
struct hb_array_t |
|
|
|
|
{ |
|
|
|
@ -553,6 +582,11 @@ struct hb_array_t |
|
|
|
|
return hb_array_t<T> (arrayZ + start_offset, count); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline hb_bytes_t as_bytes (void) const |
|
|
|
|
{ |
|
|
|
|
return hb_bytes_t (arrayZ, len * sizeof (T)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline void free (void) { ::free ((void *) arrayZ); arrayZ = nullptr; len = 0; } |
|
|
|
|
|
|
|
|
|
T *arrayZ; |
|
|
|
@ -561,34 +595,6 @@ struct hb_array_t |
|
|
|
|
template <typename T> static inline |
|
|
|
|
hb_array_t<T> hb_array (T *array, unsigned int len) { return hb_array_t<T> (array, len); } |
|
|
|
|
|
|
|
|
|
struct hb_bytes_t |
|
|
|
|
{ |
|
|
|
|
inline hb_bytes_t (void) : arrayZ (nullptr), len (0) {} |
|
|
|
|
inline hb_bytes_t (const char *bytes_, unsigned int len_) : arrayZ (bytes_), len (len_) {} |
|
|
|
|
inline hb_bytes_t (const void *bytes_, unsigned int len_) : arrayZ ((const char *) bytes_), len (len_) {} |
|
|
|
|
template <typename T> |
|
|
|
|
inline hb_bytes_t (const T& array) : arrayZ ((const char *) array.arrayZ), len (array.len) {} |
|
|
|
|
|
|
|
|
|
inline void free (void) { ::free ((void *) arrayZ); arrayZ = nullptr; len = 0; } |
|
|
|
|
|
|
|
|
|
inline int cmp (const hb_bytes_t &a) const |
|
|
|
|
{ |
|
|
|
|
if (len != a.len) |
|
|
|
|
return (int) a.len - (int) len; |
|
|
|
|
|
|
|
|
|
return memcmp (a.arrayZ, arrayZ, len); |
|
|
|
|
} |
|
|
|
|
static inline int cmp (const void *pa, const void *pb) |
|
|
|
|
{ |
|
|
|
|
hb_bytes_t *a = (hb_bytes_t *) pa; |
|
|
|
|
hb_bytes_t *b = (hb_bytes_t *) pb; |
|
|
|
|
return b->cmp (*a); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const char *arrayZ; |
|
|
|
|
unsigned int len; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct HbOpOr |
|
|
|
|
{ |
|
|
|
|