[otlayout] Add GenericArrayOf::search()
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index 79ac719..40402fb 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -837,6 +837,17 @@
return TRACE_RETURN (true);
}
+ template <typename SearchType>
+ inline int search (const SearchType &x) const
+ {
+ /* Hand-coded bsearch here since this is in the hot inner loop. */
+ unsigned int count = len;
+ for (unsigned int i = 0; i < count; i++)
+ if (!this->array[i].cmp (x))
+ return i;
+ return -1;
+ }
+
private:
inline bool sanitize_shallow (hb_sanitize_context_t *c) {
TRACE_SANITIZE (this);