src/hb-array.hh

Branch


Log

Author Commit Date CI Message
Behdad Esfahbod 1a278073 2025-02-05T00:35:40 [array] Micro-optimize
Behdad Esfahbod 29d49ece 2023-11-01T15:55:47 [vector] Introduce realloc_moves tag Some types (even aggregate) can be moved using realloc(). Extend the fast path to hb_hashmap and tuple_delta_t.
Behdad Esfahbod 6a17622a 2023-06-22T18:35:10 [array] Speed up iteration These are faster than relying on the random-access methods (forward, rewind, item_it).
Behdad Esfahbod 0364c69e 2023-06-07T15:52:18 [iter] Add has_fast_len Set iterators are not random_access, but have fast len().
Behdad Esfahbod 826fe2c9 2023-05-09T13:48:38 [hash] Wrap specialization in HB_OPTIMIZE_SIZE_MORE
Behdad Esfahbod b2b15fa3 2023-05-09T13:39:52 [hash] Links
Behdad Esfahbod fe0f7dc5 2023-05-08T22:19:02 [bytes] Use fasthash as hash algorithm Part of https://github.com/harfbuzz/harfbuzz/pull/4228
Behdad Esfahbod c005e3a2 2023-05-08T16:33:31 [bytes] Simplify hash function Part of https://github.com/harfbuzz/harfbuzz/issues/4227
Behdad Esfahbod 45afbdff 2023-05-08T11:19:55 [array] Add a const to a cast
Behdad Esfahbod 6d7de2f8 2023-05-07T15:23:05 [array] Implement FNV-1a hash function
Behdad Esfahbod ebdeab8b 2023-05-07T14:18:36 [array] Improve hash function Previously all arrays of 0 bytes were getting same hash.
Behdad Esfahbod ef2a8f72 2023-02-06T12:04:16 [VarComposite] Adjust for RESET_UNSPECIFIED_AXES semantic change https://github.com/harfbuzz/boring-expansion-spec/issues/81
Behdad Esfahbod a24d4e92 2022-12-01T20:27:56 [array] Oops. Fix memcpy copy()!
Behdad Esfahbod 5e41766b 2022-12-01T20:19:04 [array] Fix hb_bytes_t memcpy copy Wasn't being used!
Behdad Esfahbod 3b68c714 2022-12-01T14:19:27 [array] Don't clear serializer buffer when copying out Not needed.
Behdad Esfahbod d8d0e066 2022-11-29T21:35:54 [array] Comment
Behdad Esfahbod 3131aecf 2022-11-28T14:12:55 [array/hash] Fix asan issue ../src/hb-algs.hh:240:43: runtime error: reference binding to misaligned address 0x7ffe91a08b0e for type 'const unsigned int', which requires 4 byte alignment
Behdad Esfahbod 9d18180c 2022-11-26T15:38:21 [array] Use hb_hash instead of handrolling
Behdad Esfahbod e333223f 2022-11-25T14:23:57 [array] Optimize serializing copy()
Behdad Esfahbod dce3502e 2022-11-23T18:34:54 [array] Add commented-out static asserts They don't work.
Behdad Esfahbod ae578705 2022-11-22T12:23:17 [array] Write hash as range for loop again Now that our range loop is faster than our own iter.
Behdad Esfahbod bca569ae 2022-11-21T23:19:42 [array] Speed up hash() for byte arrays
Behdad Esfahbod d7b492e3 2022-11-21T23:08:51 Revert "[array] Remove hash specializations for bytes" This reverts commit 213117317cefeb4e75d21c5c21e383309f116bb0.
Behdad Esfahbod b00a911f 2022-11-21T12:11:30 [sorted-array] Add faster iterator implementation here as well
Behdad Esfahbod e82a3c69 2022-11-21T12:00:10 [array/vector] Optimize range-based for-loop Avoid bounds-checking.
Behdad Esfahbod 921f45f4 2022-11-18T17:26:58 [array] Rewrite hash() as dagger
Behdad Esfahbod 21311731 2022-11-18T17:24:23 [array] Remove hash specializations for bytes Not needed.
Behdad Esfahbod c7d57dcf 2022-11-16T21:21:31 [vector/array] Simplify qsort()
Behdad Esfahbod a87843be 2022-11-14T13:43:58 [array] Another try at sizeof sorted_array
Behdad Esfahbod df040de9 2022-08-18T16:15:00 [array] Add a std::forward
Behdad Esfahbod c606978e 2022-08-18T16:13:56 [array] Remove unused type pack
Behdad Esfahbod b475a2ab 2022-07-17T18:44:11 [array] Adjust operator !=
Behdad Esfahbod 4b3afafb 2022-07-13T15:13:07 [array] Use hb_swap() in reverse()
Behdad Esfahbod 97ea10a6 2022-06-02T11:14:17 Remove old nullptr_t hacks Were used for hashmap before.
Behdad Esfahbod 975a5f91 2022-05-20T12:34:49 [array] Use hb_memcmp instead of memcmp Fixes ubsan error.
Behdad Esfahbod 4266cf3b 2022-05-19T18:15:46 [array] Specialize operator== for bytes_t and ubytes_t
Behdad Esfahbod 1c8226ed 2022-05-17T15:28:50 Fix compiler warning On Mac compiler: FAILED: src/libharfbuzz.0.dylib.p/hb-ot-tag.cc.o c++ -Isrc/libharfbuzz.0.dylib.p -Isrc -I../src -I. -I.. -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/graphite2/1.3.14/include -I/usr/local/Cellar/glib/2.72.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.72.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.45/include -Xclang -fcolor-diagnostics --coverage -pipe -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++11 -fno-rtti -O2 -g -fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -DHAVE_CONFIG_H -Wno-non-virtual-dtor -MD -MQ src/libharfbuzz.0.dylib.p/hb-ot-tag.cc.o -MF src/libharfbuzz.0.dylib.p/hb-ot-tag.cc.o.d -o src/libharfbuzz.0.dylib.p/hb-ot-tag.cc.o -c ../src/hb-ot-tag.cc In file included from ../src/hb-ot-tag.cc:29: In file included from ../src/hb.hh:481: ../src/hb-array.hh:359:14: error: missing default argument on parameter 'ds' Ts... ds) const ^ ../src/hb-ot-tag.cc:292:58: note: in instantiation of function template specialization 'hb_sorted_array_t<const LangTag>::bfind<const char *, unsigned int>' requested here if (hb_sorted_array (ot_languages, ot_languages_len).bfind (lang_str, &tag_idx, ^ 1 error generated.
Behdad Esfahbod c1f4b57c 2022-05-17T15:19:40 [ot-tags] Optimize language comparison Now that we know both strings are of equal len of 2 or 3, optimize. Part of https://github.com/harfbuzz/harfbuzz/issues/3591 Before: ------------------------------------------------------------------------------------------------ Benchmark Time CPU Iterations ------------------------------------------------------------------------------------------------ BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY 8.50 ns 8.47 ns 81221549 BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 79.6 ns 79.3 ns 8785804 BM_hb_ot_tags_from_script_and_language/COMMON en_US 40.0 ns 39.9 ns 17462768 BM_hb_ot_tags_from_script_and_language/LATIN en_US 39.2 ns 39.1 ns 17886793 BM_hb_ot_tags_from_script_and_language/COMMON none 4.31 ns 4.30 ns 162805417 BM_hb_ot_tags_from_script_and_language/LATIN none 4.32 ns 4.31 ns 162656688 After: ------------------------------------------------------------------------------------------------ Benchmark Time CPU Iterations ------------------------------------------------------------------------------------------------ BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY 8.27 ns 8.24 ns 81868701 BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 56.1 ns 56.0 ns 12353284 BM_hb_ot_tags_from_script_and_language/COMMON en_US 24.3 ns 24.2 ns 28955030 BM_hb_ot_tags_from_script_and_language/LATIN en_US 24.5 ns 24.4 ns 28664868 BM_hb_ot_tags_from_script_and_language/COMMON none 4.35 ns 4.34 ns 161190014 BM_hb_ot_tags_from_script_and_language/LATIN none 4.36 ns 4.34 ns 161319000
luz paz e2e30506 2022-01-16T07:00:53 Fix various typos Found via `codespell -q 3 -S ./perf/texts -L actualy,ba,beng,fo,gir,inout,nd,ot,pres,ro,te,teh,timne`
Behdad Esfahbod 325f2629 2021-11-19T17:19:09 [array] Fix a couple constexpr warnings ./subprojects/harfbuzz/src/hb-array.hh:71:25: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const] constexpr hb_array_t& operator = (const hb_array_t<U> &o) ^ const ../subprojects/harfbuzz/src/hb-array.hh:72:5: warning: use of this statement in a constexpr function is a C++14 extension [-Wc++14-extensions] { arrayZ = o.arrayZ; length = o.length; backwards_length = o.backwards_length; return *this; } ^ ../subprojects/harfbuzz/src/hb-array.hh:329:32: warning: 'constexpr' non-static member function will not be implicitly 'const' in C++14; add 'const' to avoid a change in behavior [-Wconstexpr-not-const] constexpr hb_sorted_array_t& operator = (const hb_array_t<U> &o) ^ const ../subprojects/harfbuzz/src/hb-array.hh:330:5: warning: use of this statement in a constexpr function is a C++14 extension [-Wc++14-extensions] { hb_array_t<Type> (*this) = o; return *this; } ^ 4 warnings generated.
Behdad Esfahbod 4731b107 2021-11-19T12:33:37 [array] Mark constructors constexpr ../src/hb-map.hh:44:38: note: non-constexpr constructor 'hb_array_t' cannot be used in a constant expression static constexpr K INVALID_KEY = kINVALID; ^
Behdad Esfahbod 1da7423e 2021-11-19T12:11:41 [array] Add constructor taking std::nullptr_t Not all impls implement nullptr_t in a way that would automatically convert to what we were accepting. In file included from ../src/test-map.cc:27: ../src/hb-map.hh:44:22: error: no viable conversion from 'nullptr_t' to 'const hb_array_t<const char>' static constexpr K INVALID_KEY = kINVALID; ^ ~~~~~~~~
Behdad Esfahbod cba17fd1 2021-11-19T11:49:03 [array] Add default methods again, this time the full set Should add tests.
Behdad Esfahbod 54e7d626 2021-11-03T14:43:34 [array] Remove defaulted destructor
Behdad Esfahbod d2c364f6 2021-11-01T21:55:14 [array] Use default methods
Behdad Esfahbod 03cd9c5c 2021-07-22T11:27:33 Align lfind() API to match bfind()
Behdad Esfahbod 2337f0d0 2021-07-08T10:58:50 Internally use hb_malloc/.../hb_free instead of malloc/.../free Redefining those stock names as macros was conflicting with gcc 10 headers. Fixes https://github.com/harfbuzz/harfbuzz/issues/3044
Behdad Esfahbod bb48bf52 2021-07-08T10:53:45 Rename misc uses of "free" In preparation for fixing https://github.com/harfbuzz/harfbuzz/issues/3044
Behdad Esfahbod 499248c5 2021-04-16T13:14:48 [blob] Use min_size, instead of null_size in .as<T>() Part of https://github.com/harfbuzz/harfbuzz/pull/2067
Behdad Esfahbod 836814a5 2021-02-05T13:41:19 [array] Swap order of args to hb_equal() Prioritizes Key::cmp() over table's cmp.
Behdad Esfahbod 921b4e46 2021-01-29T20:35:05 [algs] Add hb_equal() Use in hb_array_t::lfind()
Ebrahim Byagowi 08d57d9e 2020-06-28T13:13:25 Add hb_array_t::lfind
Garret Rieger 14a7b6f1 2020-02-26T15:09:04 Set hb_buffer_t to use array_t.reverse().
Garret Rieger 50129b03 2020-02-25T17:39:59 Add a reverse () call to hb_array_t.
Behdad Esfahbod fa7edf87 2019-12-07T22:01:13 [bsearch] Massage API some more
Behdad Esfahbod 48eef272 2019-12-06T05:04:11 [algs/array] Consolidate the last two bsearch implementations! Yay! Seems to work.
Behdad Esfahbod fd6df520 2019-12-06T03:00:23 [array] Isolate bsearch implementation more
Behdad Esfahbod 06d3c201 2019-12-06T02:52:54 [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?
Ebrahim Byagowi d67ba649 2019-12-05T13:15:21 Rename hb_array_t::in_range to hb_array_t::check_range
Ebrahim Byagowi 72d83a02 2019-12-05T13:09:48 Make hb_array_t::in_range similar to hb_sanitize_context_t::check_range
Ebrahim Byagowi 3958f6fb 2019-10-29T22:36:50 Add in_range in hb_bytes_t to merge range_checker_t with it
Garret Rieger 05bcdb39 2019-10-21T16:10:06 Add a specialization of array_t:hash for hb_bytes_t and hb_ubytes_t.
Garret Rieger eab191fd 2019-10-02T14:28:53 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.
Ebrahim Byagowi 0558413f 2019-10-01T13:49:55 Minor, tweak spaces
Behdad Esfahbod 7eafe947 2019-08-30T09:40:40 Revert "[array] Add chop()" This reverts commit 545fe9d9f0870568c40c17591f3f224c228feba6. Breaks gcc 4.8 and MSVC all versions. Will add hb_chop() that works on all iterators instead.
Behdad Esfahbod 545fe9d9 2019-08-29T15:48:21 [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.
Behdad Esfahbod c72589f1 2019-08-29T15:45:21 [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...
Behdad Esfahbod d58e248d 2019-08-29T15:23:48 [array] Add truncate() method
Behdad Esfahbod a06edf14 2019-08-29T15:21:18 [array] Use injected class name more
Ebrahim Byagowi dce42cef 2019-08-27T14:32:05 [glyf] Move GlyphHeader::from_bytes to hb_bytes_t, introduce .as<T> ()
Ebrahim Byagowi a0b4ac4d 2019-08-24T17:57:14 Turn 8 spaces to tab across the project According to the current code style of the project
Ebrahim Byagowi eff579f7 2019-06-07T12:58:09 Update and use internal qsort everywhere
Behdad Esfahbod d822e0a1 2019-05-15T16:30:08 [array] Adjust operator!= See comments.
Behdad Esfahbod d0df996c 2019-05-15T00:32:41 Use implicit lambda return type
Behdad Esfahbod 889dc1eb 2019-05-14T22:28:07 [iter] Remove sort categorization See comments.
Behdad Esfahbod 51376284 2019-05-13T15:36:14 [iter] Track strictly-sorted iterators This make output of hb_enumerate() sorted regardless of input iterator.
David Corbett b854d4ff 2019-05-10T22:51:49 [array] Fix rewinding
Behdad Esfahbod 322627ae 2019-05-09T16:08:10 Whitespace
Behdad Esfahbod 726002a6 2019-05-09T14:53:02 [iter] Make hb_is_iterator_of() check is_convertible Instead of is_cr_convertible.
Behdad Esfahbod 34764454 2019-05-08T21:14:01 Remove unnecessary template keyword Should fix MSVC.
Behdad Esfahbod e8b45c19 2019-05-08T16:37:38 [array] Add .copy()
Behdad Esfahbod 41248cce 2019-05-07T20:54:31 Remove MIN/MAX in favor of hb_min/hb_max
Behdad Esfahbod 4c2fd05c 2019-05-06T19:57:15 [iter] Implement range-based for loops Part of https://github.com/harfbuzz/harfbuzz/issues/1648
Behdad Esfahbod c51f15dd 2019-04-26T13:03:41 [array] Adjust hb_sorted_array_t copy constructor/assignment to match hb_array_t
Behdad Esfahbod b2758c36 2019-04-26T12:58:06 [array] Use hb_is_cr_convertible_to()
Behdad Esfahbod 91d958ac 2019-04-18T10:04:10 [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]
Behdad Esfahbod 54ece299 2019-04-16T16:45:53 Use type aliasing for meta-functions, ie. those returning a type
Behdad Esfahbod 1ae26588 2019-04-15T11:31:40 Fix gcc warning
Behdad Esfahbod caa20e4e 2019-04-12T17:59:18 Hide a few more symbols Exposed by: $ make CPPFLAGS=-O0
Behdad Esfahbod 95df00ae 2019-04-12T17:50:03 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++
Behdad Esfahbod f02ebc89 2019-04-03T15:23:06 [array] Add compy assignment operator since copy constructor is explicit
Behdad Esfahbod 20a73da2 2019-04-03T14:32:15 [array] Add default copy constructor MSVC seems to need it.
Behdad Esfahbod 5b66b033 2019-04-02T19:27:02 [serialize] Fix hb_hashmap_t<> for pointers and use in packed_map
Behdad Esfahbod 42ab32cb 2019-04-02T18:41:33 [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.
Behdad Esfahbod d0da547b 2019-04-02T18:22:39 [array] Use dagger for hashing array Also switch to better mixing.
Behdad Esfahbod b189bbc4 2019-03-30T19:41:48 Implement hashing of objects Should be improved for hb_bytes_t.
Behdad Esfahbod 849a0f17 2019-01-29T17:10:19 [iter] Add hb_iter_with_fallback_t instead
Behdad Esfahbod 4d40ed9d 2019-01-29T13:55:23 [iter] Add hb_iter_with_mixin_t<>
Behdad Esfahbod 84a25d79 2019-01-29T13:39:19 [iter] Rename
Behdad Esfahbod 0363ce65 2019-01-27T01:03:56 [iter] Accept C arrays in hb_iter()