Commit Graph

128 Commits

Author SHA1 Message Date
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
Behdad Esfahbod 84a25d79c6 [iter] Rename 2019-01-29 13:39:19 -08:00
Behdad Esfahbod 0363ce650b [iter] Accept C arrays in hb_iter() 2019-01-27 01:06:32 +01:00
Behdad Esfahbod 090fe56dc6 Merge branch 'master' into iter 2019-01-25 16:06:52 +01:00
Behdad Esfahbod 6e3ad650d1 Rename hb-dsalgs to hb-algs 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 636786ecaf [iter] Rename __item_type__ to __item_t__ 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 177a8af380 [array] SFINAE fun 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 8e0a58e1b3 [array] Remove construction that was removing constness 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 815cde9fa3 [iter] Use is_sorted_iterator 2019-01-20 20:12:12 -05:00
Behdad Esfahbod b5d6fe1a45 [iter] Remove hb_sorted_iter_t
Not enforcing it using type hierarchy.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 6cd96ba1ac [iter] Make is_random_access_iterator a constant
We cannot rely on constexpr functions...
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 8ac64d0090 [iter] Fix sorted_iter iter class 2019-01-20 20:12:12 -05:00
Behdad Esfahbod 5ec11ce13a [iter] Clarify readonly vs lvalue iterators
lvalue iterators must declare __item_type__ as a reference.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 570473a345 [iter] Make hb_sorted_array_t work as iter
Ugly, but does the job.
2019-01-20 20:12:12 -05:00
Behdad Esfahbod 89949ed28d Fix ubsan with passing nullptr to qsort() 2018-12-30 01:52:19 -05:00
Behdad Esfahbod 954b985422 [iter] Add hb_sorted_iter_t<> 2018-12-21 19:55:02 -05:00
Behdad Esfahbod 25786f49c1 [array] Port to hb_iter_t<>
hb_array_t is its own iterator...
2018-12-21 19:29:00 -05:00
Behdad Esfahbod 474a12058d [array/vector] Rename len to length 2018-12-21 18:53:01 -05:00
Behdad Esfahbod 865deeb3be Adjust internal header dependencies 2018-12-21 17:46:10 -05:00
Behdad Esfahbod 7b4eea853c [array] Add more hb_array() / hb_sorted_array() variants 2018-12-21 16:02:16 -05:00
Behdad Esfahbod 95265aeab7 [array] Remove copy constructor
Fixes https://github.com/harfbuzz/harfbuzz/issues/1502
2018-12-21 15:12:55 -05:00
Behdad Esfahbod 879faa2aee Rename 2018-12-21 01:57:40 -05:00
Behdad Esfahbod bd36977392 Rename 2018-12-20 23:14:24 -05:00
Behdad Esfahbod 3d9d7dc4dd [arrays] Add hb_ubytes_t for unsigned char 2018-12-18 22:11:23 -05:00
Behdad Esfahbod f1e95e40ed [arrays] Remove hb_supplier_t<> 2018-12-18 16:49:08 -05:00
Behdad Esfahbod b1094fc2d2 [arrays] Minor tweaks to hb_supplier_t
I think I like to keep this hb_supplier_t thing separately from hb_array_t.
2018-12-17 22:41:04 -05:00
Behdad Esfahbod cf39c24205 [arrays] Rename Supplier to hb_supplier_t 2018-12-17 22:36:23 -05:00
Ebrahim Byagowi e412008599 Remove redundant void from C++ sources (#1486) 2018-12-17 13:01:01 -05:00
Behdad Esfahbod 381c3548e9 [array] Add cast operator to add const to Type
In lieu of constructor removed in previous commit.
2018-12-17 00:39:30 -05:00
Behdad Esfahbod 15acf33c22 [array] Remove problematic constructor 2018-12-17 00:38:13 -05:00
Behdad Esfahbod 470369a871 [array] Add arithmetic operators 2018-12-17 00:21:38 -05:00
Behdad Esfahbod 6cd60c2f2a [array] Return Crap instead of Null if Type is not const
Ouch!
2018-12-17 00:09:06 -05:00
Behdad Esfahbod 94e72cf1c9 [array] Add operator * 2018-12-17 00:06:40 -05:00
Behdad Esfahbod 68d4a5eee0 [array] Add constructor from fixed-size array 2018-12-17 00:02:42 -05:00
Behdad Esfahbod a4354d2fd3 [array] Organize 2018-12-16 23:57:27 -05:00
Behdad Esfahbod 84c1865821 [arrays] Reduce Supplier<> even further 2018-12-16 23:52:17 -05:00
Behdad Esfahbod f85f6e815f [array] Add operator += 2018-12-16 23:45:07 -05:00
Behdad Esfahbod 7c0e3e9b2b [array] Add constructor from hb_array_t<const Type> 2018-12-16 23:43:17 -05:00
Behdad Esfahbod 92680361ec [arrays] Move Supplier<> to hb-array.hh 2018-12-16 23:38:51 -05:00
Behdad Esfahbod dcfa4a8d71 [array] Remove custom hb_bytes_t implementation 2018-12-16 22:31:13 -05:00
Behdad Esfahbod 3656f56d47 [arrays] Minor 2018-12-16 22:31:13 -05:00
Behdad Esfahbod aa8f94714e [array] Minor 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