Commit Graph

92 Commits

Author SHA1 Message Date
Behdad Esfahbod 997809ea4a [simd] Blend 9ary search with bsearch 2019-12-11 10:52:14 -06:00
Behdad Esfahbod bc25a5694c [simd] Enable ksearch for (non-range) GlyphID search 2019-12-11 10:52:14 -06:00
Behdad Esfahbod b7d01281d2 [simd] Add disabled code for preferring bsearch for shorter lists 2019-12-11 10:52:14 -06:00
Behdad Esfahbod 343da74ec6 [simd] Add HB_SIMD_VERIFY 2019-12-11 10:52:14 -06:00
Behdad Esfahbod 6bba9d876a [simd] Implement 9ary search for RangeRecord
Is good on correctness.  Have not measured performance yet.

Part of https://github.com/harfbuzz/harfbuzz/issues/566
2019-12-11 10:52:14 -06:00
Behdad Esfahbod 0033641189 [simd] Add general design and structure
Part of https://github.com/harfbuzz/harfbuzz/issues/566
2019-12-11 10:52:14 -06:00
Behdad Esfahbod fa7edf87c9 [bsearch] Massage API some more 2019-12-09 17:51:41 -06:00
Behdad Esfahbod 48eef2724c [algs/array] Consolidate the last two bsearch implementations!
Yay!  Seems to work.
2019-12-06 05:04:11 +00:00
Behdad Esfahbod fd6df520a1 [array] Isolate bsearch implementation more 2019-12-06 03:01:34 +00:00
Behdad Esfahbod 06d3c2019f [array] Simplify bfind() positioning
I had copied the old scheme from fontconfig's fccharset.c.  I just
convinced myself that this change is correct and produces exact
same results.  But I also am skeptical.  Anyone else feel like
convincing themselves as well please?
2019-12-06 02:52:54 +00:00
Ebrahim Byagowi d67ba649a3 Rename hb_array_t::in_range to hb_array_t::check_range 2019-12-06 02:27:23 +00:00
Ebrahim Byagowi 72d83a0280 Make hb_array_t::in_range similar to hb_sanitize_context_t::check_range 2019-12-06 02:27:23 +00:00
Ebrahim Byagowi 3958f6fb23 Add in_range in hb_bytes_t to merge range_checker_t with it 2019-10-29 23:16:05 +03:30
Garret Rieger 05bcdb39d8 Add a specialization of array_t:hash for hb_bytes_t and hb_ubytes_t. 2019-10-22 13:33:50 -07:00
Garret Rieger eab191fd9c Rewrite hash and == function for hb_array_t as a plain loop.
Profling showed that the current implementation were accounting for nearly all processing time in some cases. These implementations look to be about 10x faster.
2019-10-18 15:10:30 -07:00
Ebrahim Byagowi 0558413f27 Minor, tweak spaces 2019-10-01 13:50:11 +03:30
Behdad Esfahbod 7eafe94705 Revert "[array] Add chop()"
This reverts commit 545fe9d9f0.

Breaks gcc 4.8 and MSVC all versions.

Will add hb_chop() that works on all iterators instead.
2019-08-31 12:24:56 -05:00
Behdad Esfahbod 545fe9d9f0 [array] Add chop()
Takes n, and returns iterator of iterators that contain up to
n items each.  Basically cuts the array into subarrays of size n.
The last sub-array might contain fewer.

Ideally this should become a generic iter tool, not array-specific,
so we can use it in GPOS to chop a value matrix into rows and elements.
2019-08-29 15:48:21 -07:00
Behdad Esfahbod c72589f13f [iter] Change item_size to get_item_size()
By moving access to hb_static_size(Type) into a function instead of
a class-const, we can refer to iter types of incomplete types, which
come handy when a method of hb_array_t wants to return iterator
of hb_array_t.  That kind of stuff.   Next commit needs this to
build on clang...
2019-08-29 15:45:21 -07:00
Behdad Esfahbod d58e248df6 [array] Add truncate() method 2019-08-29 15:23:48 -07:00
Behdad Esfahbod a06edf1430 [array] Use injected class name more 2019-08-29 15:21:18 -07:00
Ebrahim Byagowi dce42cef2b [glyf] Move GlyphHeader::from_bytes to hb_bytes_t, introduce .as<T> () 2019-08-27 17:38:09 +04:30
Ebrahim Byagowi a0b4ac4dce Turn 8 spaces to tab across the project
According to the current code style of the project
2019-08-27 02:40:41 +04:30
Ebrahim Byagowi eff579f743 Update and use internal qsort everywhere 2019-06-08 12:53:27 -07:00
Behdad Esfahbod d822e0a16f [array] Adjust operator!=
See comments.
2019-05-15 16:30:08 -07:00
Behdad Esfahbod d0df996cdc Use implicit lambda return type 2019-05-15 00:32:41 -07:00
Behdad Esfahbod 889dc1eb06 [iter] Remove sort categorization
See comments.
2019-05-14 22:28:07 -07:00
Behdad Esfahbod 513762849a [iter] Track strictly-sorted iterators
This make output of hb_enumerate() sorted regardless of input iterator.
2019-05-13 15:36:14 -07:00
David Corbett b854d4ff46 [array] Fix rewinding 2019-05-11 11:52:40 -07:00
Behdad Esfahbod 322627ae1d Whitespace 2019-05-09 16:08:10 -07:00
Behdad Esfahbod 726002a6a6 [iter] Make hb_is_iterator_of() check is_convertible
Instead of is_cr_convertible.
2019-05-09 15:24:25 -07:00
Behdad Esfahbod 3476445420 Remove unnecessary template keyword
Should fix MSVC.
2019-05-08 21:14:01 -07:00
Behdad Esfahbod e8b45c1933 [array] Add .copy() 2019-05-08 16:37:38 -07:00
Behdad Esfahbod 41248cce0e Remove MIN/MAX in favor of hb_min/hb_max 2019-05-07 20:54:31 -07:00
Behdad Esfahbod 4c2fd05ca5 [iter] Implement range-based for loops
Part of https://github.com/harfbuzz/harfbuzz/issues/1648
2019-05-06 19:57:35 -07:00
Behdad Esfahbod c51f15ddfc [array] Adjust hb_sorted_array_t copy constructor/assignment to match hb_array_t 2019-04-26 13:04:06 -07:00
Behdad Esfahbod b2758c360c [array] Use hb_is_cr_convertible_to() 2019-04-26 13:04:06 -07:00
Behdad Esfahbod 91d958acc0 [array] Simplify copy assignment/constructor
To fix bogus MSVC warnings:

  c:\projects\harfbuzz\src\hb-array.hh(189): warning C4521: 'hb_array_t<Type>': multiple copy constructors specified [C:\projects\harfbuzz\build\harfbuzz.vcxproj]
  c:\projects\harfbuzz\src\hb-array.hh(189): warning C4522: 'hb_array_t<Type>': multiple assignment operators specified [C:\projects\harfbuzz\build\harfbuzz.vcxproj]
2019-04-18 10:04:10 -04:00
Behdad Esfahbod 54ece299bc Use type aliasing for meta-functions, ie. those returning a type 2019-04-16 16:45:53 -04:00
Behdad Esfahbod 1ae265888e Fix gcc warning 2019-04-15 11:31:40 -04:00
Behdad Esfahbod caa20e4ef9 Hide a few more symbols
Exposed by:

$ make CPPFLAGS=-O0
2019-04-12 18:00:58 -04:00
Behdad Esfahbod 95df00aec1 Hide a few static methods
Looks like static methods that do not get inlined end up exported.
We have a lot more.  Need to protect all at some point.  Wish there
was an easier way, like the visibility flag we pass that automatically
hides all inline methods.

Was exposed by check-symbols.sh when compiling on OS X 10.14 with:

$ make CPPFLAGS=-Oz CXXFLAGS=-flto=thin LDFLAGS=-lc++
2019-04-12 17:51:14 -04:00
Behdad Esfahbod f02ebc89ec [array] Add compy assignment operator since copy constructor is explicit 2019-04-03 15:23:06 -07:00
Behdad Esfahbod 20a73da2c9 [array] Add default copy constructor
MSVC seems to need it.
2019-04-03 14:32:15 -07:00
Behdad Esfahbod 5b66b033fd [serialize] Fix hb_hashmap_t<> for pointers and use in packed_map 2019-04-02 19:30:22 -07:00
Behdad Esfahbod 42ab32cbba [iter] Remove passing pointer to hb_iter()
While doable with hb_deref_pointer() as well, we also would then
need to do it in a ton of places.  Not worth it / messy.
2019-04-02 18:42:51 -07:00
Behdad Esfahbod d0da547b37 [array] Use dagger for hashing array
Also switch to better mixing.
2019-04-02 18:23:05 -07:00
Behdad Esfahbod b189bbc48f Implement hashing of objects
Should be improved for hb_bytes_t.
2019-03-30 19:41:48 -07:00
Behdad Esfahbod 849a0f1758 [iter] Add hb_iter_with_fallback_t instead 2019-01-29 17:10:19 -08:00
Behdad Esfahbod 4d40ed9d1a [iter] Add hb_iter_with_mixin_t<> 2019-01-29 13:55:23 -08:00