[Indic] Reorder matras
Number of failing shape-complex tests goes from 125 down to 94.
Next: Add Ra handling and it's fair to say we kinda support Indic :).
diff --git a/src/hb-private.hh b/src/hb-private.hh
index b5277a5..23fc0af 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -568,12 +568,9 @@
const char *message) {}
};
-HB_BEGIN_DECLS
-
/* Misc */
-HB_END_DECLS
/* Pre-mature optimization:
* Checks for lo <= u <= hi but with an optimization if lo and hi
@@ -590,13 +587,40 @@
return lo <= u && u <= hi;
}
-HB_BEGIN_DECLS
-
-/* Useful for set-operations on small enums */
+/* Useful for set-operations on small enums.
+ * For example, for testing "x ∈ {x1, x2, x3}" use:
+ * (FLAG(x) & (FLAG(x1) | FLAG(x2) | FLAG(x3)))
+ */
#define FLAG(x) (1<<(x))
+template <typename T> inline void
+hb_bubble_sort (T *array, unsigned int len, int(*compar)(const T *, const T *))
+{
+ if (unlikely (!len))
+ return;
+
+ unsigned int k = len - 1;
+ do {
+ unsigned int new_k = 0;
+
+ for (unsigned int j = 0; j < k; j++)
+ if (compar (&array[j], &array[j+1]) > 0) {
+ T t;
+ t = array[j];
+ array[j] = array[j + 1];
+ array[j + 1] = t;
+
+ new_k = j;
+ }
+ k = new_k;
+ } while (k);
+}
+
+
+HB_BEGIN_DECLS
+
HB_END_DECLS
#endif /* HB_PRIVATE_HH */