[HarfBuzz] harfbuzz: Branch 'master' - 4 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Tue Jul 10 13:50:17 UTC 2018
src/hb-blob-private.hh | 2
src/hb-blob.cc | 1
src/hb-buffer-private.hh | 1
src/hb-common.cc | 2
src/hb-coretext.cc | 1
src/hb-directwrite.cc | 1
src/hb-dsalgs.hh | 130 +++++++++++++++++++++++++++++++----
src/hb-face-private.hh | 1
src/hb-font-private.hh | 1
src/hb-ft.cc | 1
src/hb-map-private.hh | 1
src/hb-object-private.hh | 4 -
src/hb-open-type-private.hh | 1
src/hb-ot-layout-common-private.hh | 1
src/hb-ot-layout-gsubgpos-private.hh | 1
src/hb-ot-shape-complex-arabic.cc | 1
src/hb-private.hh | 113 +-----------------------------
src/hb-set-private.hh | 1
src/hb-shape-plan-private.hh | 1
src/hb-shape-plan.cc | 1
src/hb-subset-input.cc | 1
src/hb-subset-plan.hh | 1
src/hb-subset.cc | 1
src/hb-unicode-private.hh | 1
src/hb-uniscribe.cc | 1
src/hb-warning.cc | 4 -
26 files changed, 123 insertions(+), 152 deletions(-)
New commits:
commit f477765661c196ac17b2c86731881a3da36a5ae6
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Jul 10 15:49:05 2018 +0200
Move more stuff to hb-dsalgs.hh
diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index 4eceeb2f..60cb0023 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -541,4 +541,87 @@ struct hb_bytes_t
};
+struct HbOpOr
+{
+ static const bool passthru_left = true;
+ static const bool passthru_right = true;
+ template <typename T> static void process (T &o, const T &a, const T &b) { o = a | b; }
+};
+struct HbOpAnd
+{
+ static const bool passthru_left = false;
+ static const bool passthru_right = false;
+ template <typename T> static void process (T &o, const T &a, const T &b) { o = a & b; }
+};
+struct HbOpMinus
+{
+ static const bool passthru_left = true;
+ static const bool passthru_right = false;
+ template <typename T> static void process (T &o, const T &a, const T &b) { o = a & ~b; }
+};
+struct HbOpXor
+{
+ static const bool passthru_left = true;
+ static const bool passthru_right = true;
+ template <typename T> static void process (T &o, const T &a, const T &b) { o = a ^ b; }
+};
+
+
+/* Compiler-assisted vectorization. */
+
+/* Type behaving similar to vectorized vars defined using __attribute__((vector_size(...))),
+ * using vectorized operations if HB_VECTOR_SIZE is set to **bit** numbers (eg 128).
+ * Define that to 0 to disable. */
+template <typename elt_t, unsigned int byte_size>
+struct hb_vector_size_t
+{
+ elt_t& operator [] (unsigned int i) { return u.v[i]; }
+ const elt_t& operator [] (unsigned int i) const { return u.v[i]; }
+
+ template <class Op>
+ inline hb_vector_size_t process (const hb_vector_size_t &o) const
+ {
+ hb_vector_size_t r;
+#if HB_VECTOR_SIZE
+ if (HB_VECTOR_SIZE && 0 == (byte_size * 8) % HB_VECTOR_SIZE)
+ for (unsigned int i = 0; i < ARRAY_LENGTH (u.vec); i++)
+ Op::process (r.u.vec[i], u.vec[i], o.u.vec[i]);
+ else
+#endif
+ for (unsigned int i = 0; i < ARRAY_LENGTH (u.v); i++)
+ Op::process (r.u.v[i], u.v[i], o.u.v[i]);
+ return r;
+ }
+ inline hb_vector_size_t operator | (const hb_vector_size_t &o) const
+ { return process<HbOpOr> (o); }
+ inline hb_vector_size_t operator & (const hb_vector_size_t &o) const
+ { return process<HbOpAnd> (o); }
+ inline hb_vector_size_t operator ^ (const hb_vector_size_t &o) const
+ { return process<HbOpXor> (o); }
+ inline hb_vector_size_t operator ~ () const
+ {
+ hb_vector_size_t r;
+#if HB_VECTOR_SIZE && 0
+ if (HB_VECTOR_SIZE && 0 == (byte_size * 8) % HB_VECTOR_SIZE)
+ for (unsigned int i = 0; i < ARRAY_LENGTH (u.vec); i++)
+ r.u.vec[i] = ~u.vec[i];
+ else
+#endif
+ for (unsigned int i = 0; i < ARRAY_LENGTH (u.v); i++)
+ r.u.v[i] = ~u.v[i];
+ return r;
+ }
+
+ private:
+ static_assert (byte_size / sizeof (elt_t) * sizeof (elt_t) == byte_size, "");
+ union {
+ elt_t v[byte_size / sizeof (elt_t)];
+#if HB_VECTOR_SIZE
+ typedef unsigned long vec_t __attribute__((vector_size (HB_VECTOR_SIZE / 8)));
+ vec_t vec[byte_size / sizeof (vec_t)];
+#endif
+ } u;
+};
+
+
#endif /* HB_DSALGS_HH */
diff --git a/src/hb-private.hh b/src/hb-private.hh
index aa4d017c..61a13215 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -746,34 +746,6 @@ hb_in_ranges (T u, T lo1, T hi1, T lo2, T hi2, T lo3, T hi3)
-/* Vectorization */
-
-struct HbOpOr
-{
- static const bool passthru_left = true;
- static const bool passthru_right = true;
- template <typename T> static void process (T &o, const T &a, const T &b) { o = a | b; }
-};
-struct HbOpAnd
-{
- static const bool passthru_left = false;
- static const bool passthru_right = false;
- template <typename T> static void process (T &o, const T &a, const T &b) { o = a & b; }
-};
-struct HbOpMinus
-{
- static const bool passthru_left = true;
- static const bool passthru_right = false;
- template <typename T> static void process (T &o, const T &a, const T &b) { o = a & ~b; }
-};
-struct HbOpXor
-{
- static const bool passthru_left = true;
- static const bool passthru_right = true;
- template <typename T> static void process (T &o, const T &a, const T &b) { o = a ^ b; }
-};
-
-
/* Compiler-assisted vectorization. */
/*
@@ -787,7 +759,6 @@ struct HbOpXor
# define HB_VECTOR_SIZE 0
#endif
-
/* The `vector_size' attribute was introduced in gcc 3.1. */
#if !defined(HB_VECTOR_SIZE)
# if defined( __GNUC__ ) && ( __GNUC__ >= 4 )
@@ -797,58 +768,6 @@ struct HbOpXor
# endif
#endif
-/* Type behaving similar to vectorized vars defined using __attribute__((vector_size(...))). */
-template <typename elt_t, unsigned int byte_size>
-struct hb_vector_size_t
-{
- elt_t& operator [] (unsigned int i) { return u.v[i]; }
- const elt_t& operator [] (unsigned int i) const { return u.v[i]; }
-
- template <class Op>
- inline hb_vector_size_t process (const hb_vector_size_t &o) const
- {
- hb_vector_size_t r;
-#if HB_VECTOR_SIZE
- if (HB_VECTOR_SIZE && 0 == (byte_size * 8) % HB_VECTOR_SIZE)
- for (unsigned int i = 0; i < ARRAY_LENGTH (u.vec); i++)
- Op::process (r.u.vec[i], u.vec[i], o.u.vec[i]);
- else
-#endif
- for (unsigned int i = 0; i < ARRAY_LENGTH (u.v); i++)
- Op::process (r.u.v[i], u.v[i], o.u.v[i]);
- return r;
- }
- inline hb_vector_size_t operator | (const hb_vector_size_t &o) const
- { return process<HbOpOr> (o); }
- inline hb_vector_size_t operator & (const hb_vector_size_t &o) const
- { return process<HbOpAnd> (o); }
- inline hb_vector_size_t operator ^ (const hb_vector_size_t &o) const
- { return process<HbOpXor> (o); }
- inline hb_vector_size_t operator ~ () const
- {
- hb_vector_size_t r;
-#if HB_VECTOR_SIZE && 0
- if (HB_VECTOR_SIZE && 0 == (byte_size * 8) % HB_VECTOR_SIZE)
- for (unsigned int i = 0; i < ARRAY_LENGTH (u.vec); i++)
- r.u.vec[i] = ~u.vec[i];
- else
-#endif
- for (unsigned int i = 0; i < ARRAY_LENGTH (u.v); i++)
- r.u.v[i] = ~u.v[i];
- return r;
- }
-
- private:
- static_assert (byte_size / sizeof (elt_t) * sizeof (elt_t) == byte_size, "");
- union {
- elt_t v[byte_size / sizeof (elt_t)];
-#if HB_VECTOR_SIZE
- typedef unsigned long vec_t __attribute__((vector_size (HB_VECTOR_SIZE / 8)));
- vec_t vec[byte_size / sizeof (vec_t)];
-#endif
- } u;
-};
-
/* Global runtime options. */
commit be7f664f723fb4e7bcf15c1c2b7c6bec46f90393
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Jul 10 15:23:08 2018 +0200
Move hb_bytes_t to hb-dsalgs.hh
diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index e8fa9b3c..4eceeb2f 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -53,7 +53,6 @@ hb_bsearch_r (const void *key, const void *base,
}
-
/* From https://github.com/noporpoise/sort_r */
/* Isaac Turner 29 April 2014 Public Domain */
@@ -415,16 +414,6 @@ struct hb_vector_t
}
};
-template <typename Type>
-struct hb_auto_t : Type
-{
- hb_auto_t (void) { Type::init (); }
- ~hb_auto_t (void) { Type::fini (); }
- private: /* Hide */
- void init (void) {}
- void fini (void) {}
-};
-
#define HB_LOCKABLE_SET_INIT {HB_VECTOR_INIT}
template <typename item_t, typename lock_t>
@@ -518,4 +507,38 @@ struct hb_lockable_set_t
};
+template <typename Type>
+struct hb_auto_t : Type
+{
+ hb_auto_t (void) { Type::init (); }
+ ~hb_auto_t (void) { Type::fini (); }
+ private: /* Hide */
+ void init (void) {}
+ void fini (void) {}
+};
+
+struct hb_bytes_t
+{
+ inline hb_bytes_t (void) : bytes (nullptr), len (0) {}
+ inline hb_bytes_t (const char *bytes_, unsigned int len_) : bytes (bytes_), len (len_) {}
+
+ inline int cmp (const hb_bytes_t &a) const
+ {
+ if (len != a.len)
+ return (int) a.len - (int) len;
+
+ return memcmp (a.bytes, bytes, 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 *bytes;
+ unsigned int len;
+};
+
+
#endif /* HB_DSALGS_HH */
diff --git a/src/hb-private.hh b/src/hb-private.hh
index 4201fe6e..aa4d017c 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -882,32 +882,6 @@ hb_options (void)
#define VAR 1
-/* String type. */
-
-struct hb_bytes_t
-{
- inline hb_bytes_t (void) : bytes (nullptr), len (0) {}
- inline hb_bytes_t (const char *bytes_, unsigned int len_) : bytes (bytes_), len (len_) {}
-
- inline int cmp (const hb_bytes_t &a) const
- {
- if (len != a.len)
- return (int) a.len - (int) len;
-
- return memcmp (a.bytes, bytes, 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 *bytes;
- unsigned int len;
-};
-
-
/* fallback for round() */
static inline double
_hb_round (double x)
commit 7a00f7eb2e3859db4563071934e76142bfd13916
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Jul 10 14:42:10 2018 +0200
Remove hb_auto_array_t
diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index ef48fb08..e8fa9b3c 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -424,8 +424,6 @@ struct hb_auto_t : Type
void init (void) {}
void fini (void) {}
};
-template <typename Type>
-struct hb_auto_array_t : hb_auto_t <hb_vector_t <Type> > {};
#define HB_LOCKABLE_SET_INIT {HB_VECTOR_INIT}
commit be458eb05962dd5f5c60a25f54cf0b20e7d8b055
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Jul 10 14:41:04 2018 +0200
Include more basic internal headers from hb-private.hh
diff --git a/src/hb-blob-private.hh b/src/hb-blob-private.hh
index b72fa721..56a7b668 100644
--- a/src/hb-blob-private.hh
+++ b/src/hb-blob-private.hh
@@ -31,8 +31,6 @@
#include "hb-private.hh"
-#include "hb-object-private.hh"
-
/*
* hb_blob_t
diff --git a/src/hb-blob.cc b/src/hb-blob.cc
index b509093e..5bab1abb 100644
--- a/src/hb-blob.cc
+++ b/src/hb-blob.cc
@@ -31,7 +31,6 @@
#endif
#include "hb-private.hh"
-#include "hb-debug.hh"
#include "hb-blob-private.hh"
#ifdef HAVE_SYS_MMAN_H
diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index dd6f1dcd..f4581407 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -31,7 +31,6 @@
#define HB_BUFFER_PRIVATE_HH
#include "hb-private.hh"
-#include "hb-object-private.hh"
#include "hb-unicode-private.hh"
diff --git a/src/hb-common.cc b/src/hb-common.cc
index ca2b3278..243c2163 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -28,8 +28,6 @@
#include "hb-private.hh"
-#include "hb-mutex-private.hh"
-#include "hb-object-private.hh"
#include <locale.h>
#ifdef HAVE_XLOCALE_H
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 61f9c35a..3bdc3f78 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -29,7 +29,6 @@
#define HB_SHAPER coretext
#include "hb-private.hh"
-#include "hb-debug.hh"
#include "hb-shaper-impl-private.hh"
#include "hb-coretext.h"
diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc
index 187ab3f9..7c688494 100644
--- a/src/hb-directwrite.cc
+++ b/src/hb-directwrite.cc
@@ -23,7 +23,6 @@
*/
#include "hb-private.hh"
-#include "hb-debug.hh"
#define HB_SHAPER directwrite
#include "hb-shaper-impl-private.hh"
diff --git a/src/hb-face-private.hh b/src/hb-face-private.hh
index 43e7b1cb..fe3b8b24 100644
--- a/src/hb-face-private.hh
+++ b/src/hb-face-private.hh
@@ -31,7 +31,6 @@
#include "hb-private.hh"
-#include "hb-object-private.hh"
#include "hb-shaper-private.hh"
#include "hb-shape-plan-private.hh"
diff --git a/src/hb-font-private.hh b/src/hb-font-private.hh
index 7ba16cde..9f657db6 100644
--- a/src/hb-font-private.hh
+++ b/src/hb-font-private.hh
@@ -31,7 +31,6 @@
#include "hb-private.hh"
-#include "hb-object-private.hh"
#include "hb-face-private.hh"
#include "hb-shaper-private.hh"
diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index 7caafba8..6670d9a6 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -28,7 +28,6 @@
*/
#include "hb-private.hh"
-#include "hb-debug.hh"
#include "hb-ft.h"
diff --git a/src/hb-map-private.hh b/src/hb-map-private.hh
index c4f2fc7d..00f089e8 100644
--- a/src/hb-map-private.hh
+++ b/src/hb-map-private.hh
@@ -28,7 +28,6 @@
#define HB_MAP_PRIVATE_HH
#include "hb-private.hh"
-#include "hb-object-private.hh"
template <typename T>
diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh
index fc48a91b..95847b9c 100644
--- a/src/hb-object-private.hh
+++ b/src/hb-object-private.hh
@@ -33,10 +33,6 @@
#define HB_OBJECT_PRIVATE_HH
#include "hb-private.hh"
-#include "hb-debug.hh"
-
-#include "hb-atomic-private.hh"
-#include "hb-mutex-private.hh"
/* reference_count */
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index 59b8cc02..207f6e0e 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -30,7 +30,6 @@
#define HB_OPEN_TYPE_PRIVATE_HH
#include "hb-private.hh"
-#include "hb-debug.hh"
#include "hb-blob-private.hh"
#include "hb-face-private.hh"
diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh
index ff9c5650..21a8382c 100644
--- a/src/hb-ot-layout-common-private.hh
+++ b/src/hb-ot-layout-common-private.hh
@@ -30,7 +30,6 @@
#define HB_OT_LAYOUT_COMMON_PRIVATE_HH
#include "hb-private.hh"
-#include "hb-debug.hh"
#include "hb-ot-layout-private.hh"
#include "hb-open-type-private.hh"
#include "hb-set-private.hh"
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index cbaa6488..aed00f15 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -30,7 +30,6 @@
#define HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH
#include "hb-private.hh"
-#include "hb-debug.hh"
#include "hb-buffer-private.hh"
#include "hb-map-private.hh"
#include "hb-ot-layout-gdef-table.hh"
diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc
index 124a67f3..b1cba1c7 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -25,7 +25,6 @@
*/
#include "hb-private.hh"
-#include "hb-debug.hh"
#include "hb-ot-shape-complex-arabic-private.hh"
#include "hb-ot-shape-private.hh"
diff --git a/src/hb-private.hh b/src/hb-private.hh
index fa9a1aee..4201fe6e 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -948,7 +948,11 @@ _hb_memalign(void **memptr, size_t alignment, size_t size)
#endif
+/* Headers we include for everyone. Specifically ordered to resolve dependencies. */
+#include "hb-debug.hh"
+#include "hb-atomic-private.hh"
+#include "hb-mutex-private.hh"
#include "hb-dsalgs.hh"
-
+#include "hb-object-private.hh"
#endif /* HB_PRIVATE_HH */
diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index bdaf3f1a..032ddb1e 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -28,7 +28,6 @@
#define HB_SET_PRIVATE_HH
#include "hb-private.hh"
-#include "hb-object-private.hh"
/*
diff --git a/src/hb-shape-plan-private.hh b/src/hb-shape-plan-private.hh
index aa0413a2..c2c4987e 100644
--- a/src/hb-shape-plan-private.hh
+++ b/src/hb-shape-plan-private.hh
@@ -28,7 +28,6 @@
#define HB_SHAPE_PLAN_PRIVATE_HH
#include "hb-private.hh"
-#include "hb-object-private.hh"
#include "hb-shaper-private.hh"
diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index 6eeba2b3..37ff1a6e 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -25,7 +25,6 @@
*/
#include "hb-private.hh"
-#include "hb-debug.hh"
#include "hb-shape-plan-private.hh"
#include "hb-shaper-private.hh"
#include "hb-font-private.hh"
diff --git a/src/hb-subset-input.cc b/src/hb-subset-input.cc
index 39c5ac4f..74470fd1 100644
--- a/src/hb-subset-input.cc
+++ b/src/hb-subset-input.cc
@@ -24,7 +24,6 @@
* Google Author(s): Garret Rieger, Rod Sheeter, Behdad Esfahbod
*/
-#include "hb-object-private.hh"
#include "hb-subset-private.hh"
#include "hb-set-private.hh"
diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh
index f4b261df..7501294d 100644
--- a/src/hb-subset-plan.hh
+++ b/src/hb-subset-plan.hh
@@ -32,7 +32,6 @@
#include "hb-subset.h"
#include "hb-subset-private.hh"
-#include "hb-object-private.hh"
#include "hb-map-private.hh"
struct hb_subset_plan_t
diff --git a/src/hb-subset.cc b/src/hb-subset.cc
index e8606341..a65b58d2 100644
--- a/src/hb-subset.cc
+++ b/src/hb-subset.cc
@@ -25,7 +25,6 @@
*/
#include "hb-private.hh"
-#include "hb-object-private.hh"
#include "hb-open-type-private.hh"
#include "hb-subset-glyf.hh"
diff --git a/src/hb-unicode-private.hh b/src/hb-unicode-private.hh
index 5472ece2..b2c203d2 100644
--- a/src/hb-unicode-private.hh
+++ b/src/hb-unicode-private.hh
@@ -32,7 +32,6 @@
#define HB_UNICODE_PRIVATE_HH
#include "hb-private.hh"
-#include "hb-object-private.hh"
extern HB_INTERNAL const uint8_t _hb_modified_combining_class[256];
diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index 6d6afe80..b17fa31c 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -25,7 +25,6 @@
*/
#include "hb-private.hh"
-#include "hb-debug.hh"
#define HB_SHAPER uniscribe
#include "hb-shaper-impl-private.hh"
diff --git a/src/hb-warning.cc b/src/hb-warning.cc
index 8f322bcb..f7a87b5a 100644
--- a/src/hb-warning.cc
+++ b/src/hb-warning.cc
@@ -24,9 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-atomic-private.hh"
-#include "hb-mutex-private.hh"
-
+#include "hb-private.hh"
#if defined(HB_ATOMIC_INT_NIL)
#error "Could not find any system to define atomic_int macros, library WILL NOT be thread-safe"
More information about the HarfBuzz
mailing list