Commit Graph

96 Commits

Author SHA1 Message Date
Behdad Esfahbod
f398097529 More static constexpr 2019-01-25 16:08:25 +01:00
Behdad Esfahbod
447323b85a Better fix for -Wcast-align errors 2019-01-22 12:50:12 +01:00
Behdad Esfahbod
70a52d6bd8 Convert all other enum class consts to static constexpr
Fixes https://github.com/harfbuzz/harfbuzz/issues/1553
2019-01-22 12:17:26 +01:00
Behdad Esfahbod
c986ca15a6 Improve overflow avoidance
Better fix for 480406cd3e
This way we behave the same on 32bit and 64bit archs.
2019-01-15 13:58:19 -05:00
Behdad Esfahbod
480406cd3e Fix assertion on address overflow
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=917031
2019-01-14 15:27:34 -05:00
Behdad Esfahbod
f6d5f1e91c [iter] Add empty test 2018-12-21 00:23:46 -05:00
Behdad Esfahbod
b80b97b549 Revert "Remove unused hb-iter.hh"
This reverts commit 969ff3c7aa.
2018-12-21 00:08:05 -05:00
Behdad Esfahbod
e6ebc9b6f8 Remove unused typedef 2018-12-20 23:13:36 -05:00
Behdad Esfahbod
87f7c83fff [serializer] Add operator <<
Not sure if we are going to use it.  But might incentivize us to.
2018-12-20 15:54:17 -05:00
Behdad Esfahbod
5b70074edf Add hb_assign(obj, value) 2018-12-20 15:38:59 -05:00
Behdad Esfahbod
4220b7bdd7 Fix code on big-endian gcc / clang
Ouch!  We need a bigendian bot...

Fixes https://github.com/harfbuzz/harfbuzz/issues/1498
2018-12-20 11:48:45 -05:00
Behdad Esfahbod
5000a59a63 [saitnize] Minor 2018-12-19 22:27:09 -05:00
Behdad Esfahbod
a62870506d [sanitize] Use hb_static_size instead of ::static_size
https://github.com/harfbuzz/harfbuzz/issues/1496#issuecomment-448818112
2018-12-19 21:05:00 -05:00
Behdad Esfahbod
9aebfb4182 [serialize] Streamline error propagation 2018-12-18 13:22:17 -05:00
Behdad Esfahbod
969ff3c7aa Remove unused hb-iter.hh
The ideas there are all part of hb-array.hh now.  To be determined how we
want to use generic iterator patterns.
2018-12-17 22:43:00 -05:00
Ebrahim Byagowi
e412008599 Remove redundant void from C++ sources (#1486) 2018-12-17 13:01:01 -05:00
Behdad Esfahbod
92680361ec [arrays] Move Supplier<> to hb-array.hh 2018-12-16 23:38:51 -05:00
Behdad Esfahbod
2a3fa3f82f [arrays] Remove unnecessary constructor from Supplier<>
Looks like operator hb_array_t<> from vector works here. :)
2018-12-16 23:33:03 -05:00
Behdad Esfahbod
507cac4943 [arrays] Start moving Supplier<> to hb_array_t<> 2018-12-16 23:31:19 -05:00
Behdad Esfahbod
1e2c98126e [arrays] Remove unused stride from Supplier 2018-12-16 22:31:16 -05:00
Behdad Esfahbod
dcfa4a8d71 [array] Remove custom hb_bytes_t implementation 2018-12-16 22:31:13 -05:00
Behdad Esfahbod
5a552f7546 [array] Move hb_array_t and related types to hb-array.hh 2018-12-16 22:31:10 -05:00
Behdad Esfahbod
01d06e34ff Minor change to explicit_operator aesthetics 2018-12-16 14:27:43 -05:00
Ebrahim Byagowi
b2ebaa9afa Remove redundant 'inline' from methods (#1483) 2018-12-16 14:08:10 -05:00
Behdad Esfahbod
6e33a3955d Minor 2018-12-13 16:40:01 -05:00
Behdad Esfahbod
c78e4784fb [dispatch] Minor 2018-12-12 09:50:18 -05:00
Behdad Esfahbod
41d1a1c10f [subset] Minor 2018-12-11 22:48:27 -05:00
Behdad Esfahbod
2aba2c6c73 [serialize] Break down assert 2018-12-11 21:21:13 -05:00
Behdad Esfahbod
fb05908213 Revert ugly fixes
Now that we have 6daf45e0, revert cryptic hacks...

This reverts commit abd81ed4f5.
This reverts commit 9c6921c08c.
This reverts commit d39760cabf.
This reverts commit fedd8e6c17.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1374
2018-11-30 20:56:15 -05:00
Behdad Esfahbod
abd81ed4f5 Umm. Cryptic, yes
In file included from hb-face.cc:35:
hb-ot-cmap-table.hh: In member function 'void OT::CmapSubtableFormat4::_compiles_assertion_on_line_388() const':
hb-ot-cmap-table.hh:388: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-open-type.hh:354: note: candidate 1: const Type& OT::UnsizedArrayOf<Type>::operator[](unsigned int) const [with Type = OT::IntType<short unsigned int, 2u>]
hb-ot-cmap-table.hh:388: note: candidate 2: operator[](const T*, int) <built-in>
hb-ot-cmap-table.hh: In member function 'void OT::CmapSubtableFormat4::_instance_assertion_on_line_388() const':
hb-ot-cmap-table.hh:388: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-open-type.hh:354: note: candidate 1: const Type& OT::UnsizedArrayOf<Type>::operator[](unsigned int) const [with Type = OT::IntType<short unsigned int, 2u>]
hb-ot-cmap-table.hh:388: note: candidate 2: operator[](const T*, int) <built-in>
hb-face.cc: In function 'hb_blob_t* _hb_face_builder_data_reference_blob(hb_face_builder_data_t*)':
hb-face.cc:650: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-vector.hh:81: note: candidate 1: Type& hb_vector_t<Type, PreallocedCount>::operator[](unsigned int) [with Type = hb_face_builder_data_t::table_entry_t, unsigned int PreallocedCount = 32u]
hb-face.cc:650: note: candidate 2: operator[](T*, int) <built-in>
hb-face.cc:650: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-vector.hh:81: note: candidate 1: Type& hb_vector_t<Type, PreallocedCount>::operator[](unsigned int) [with Type = hb_face_builder_data_t::table_entry_t, unsigned int PreallocedCount = 32u]
hb-face.cc:650: note: candidate 2: operator[](const T*, int) <built-in>
hb-face.cc:651: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-vector.hh:81: note: candidate 1: Type& hb_vector_t<Type, PreallocedCount>::operator[](unsigned int) [with Type = hb_face_builder_data_t::table_entry_t, unsigned int PreallocedCount = 32u]
hb-face.cc:651: note: candidate 2: operator[](T*, int) <built-in>
hb-face.cc:651: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
hb-vector.hh:81: note: candidate 1: Type& hb_vector_t<Type, PreallocedCount>::operator[](unsigned int) [with Type = hb_face_builder_data_t::table_entry_t, unsigned int PreallocedCount = 32u]
hb-face.cc:651: note: candidate 2: operator[](const T*, int) <built-in>
2018-11-30 11:52:41 -05:00
Ebrahim Byagowi
e7bd29ea11
Limit __builtin_bswap16 to GCC >= 5 as it was implemented on 4.8 2018-11-29 23:47:20 +03:30
Behdad Esfahbod
861bc75349 [vector] Make pointer cast explicit
Too bad this doesn't help MSVC 2008 build, as explicit operators are
C++11.
2018-11-29 14:34:44 -05:00
Behdad Esfahbod
987f418772
Merge pull request #1398 from Adenilson/bigInt01
Optimize harfbuzz big integer conversions
2018-11-27 17:40:32 -05:00
Behdad Esfahbod
4e2a03b6b6
Comment 2018-11-27 17:40:09 -05:00
Adenilson Cavalcanti
4a719a7f4c Optimize harfbuzz big integer conversions
Profiling showed that type conversions were adding considerable cycles in time
spent doing text shaping.

The idea is to optimize it using native processor instructions to help Blink
layout performance.

Doing further investigation revelead that compilers may not use the
proper instruction on ARM 32bits builds (i.e. REV16).

One way to insure that the generated ASM was ideal for both gcc/clang
was using __builtin_bswap16.

Added bonus is that we no longer need to test for CPU architecture.
2018-11-27 13:43:05 -08:00
Behdad Esfahbod
9326912941 [kerx] Fix crash 2018-11-25 00:27:23 -05:00
Behdad Esfahbod
6ee401049d Simplify sanitize set_object() / fix bots 2018-11-25 00:21:13 -05:00
Behdad Esfahbod
1e8994221f Add hb_sanitize_with_object_t
Context manager.
2018-11-24 23:38:06 -05:00
Behdad Esfahbod
b3c5affc05 Simplify sanitize set_object() 2018-11-24 23:34:34 -05:00
Behdad Esfahbod
9eeebd8dde Revert "[sanitize] Remove now-unused set_object() machinery"
This reverts commit bbdb6edb3e.
2018-11-24 22:16:47 -05:00
Behdad Esfahbod
bbdb6edb3e [sanitize] Remove now-unused set_object() machinery 2018-11-24 17:15:38 -05:00
Behdad Esfahbod
a9fe787a11 [sanitizer] Add reset_object(), make set_object() do bounds-check
Affects morx/kerx run-time only currently.  Will adjust their sanitize next.
2018-11-22 22:12:36 -05:00
Behdad Esfahbod
3b9fd176e8 Disallow taking Null() of unbounded structs
Not sure I've marked all such structs.  To be done as we discover.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1300
2018-11-22 01:18:55 -05:00
Behdad Esfahbod
7dd945a876 One more time.. 2018-11-22 01:05:17 -05:00
Behdad Esfahbod
d062ad10de Fix bots happy again, hopefully
So, our fallback static_assert cannot be had more than once per line
of source.
2018-11-22 00:39:14 -05:00
Behdad Esfahbod
fb10c021c8 Revert alignof() == 1 check
Bots not happy with using "this" inside assertion...

This reverts 2656644887
2018-11-22 00:21:49 -05:00
Behdad Esfahbod
8d778877b8 .. 2018-11-21 23:46:09 -05:00
Behdad Esfahbod
8cfeed9948 Minor 2018-11-21 23:42:31 -05:00
Behdad Esfahbod
e5d954a2fb Minor 2018-11-21 23:30:50 -05:00
Behdad Esfahbod
e987059c61 Minor 2018-11-21 23:25:06 -05:00