Commit Graph

112 Commits

Author SHA1 Message Date
Behdad Esfahbod bcd59b5142 [set/map] Remove init_shallow/fini_shallow() 2022-07-20 15:58:28 -06:00
Behdad Esfahbod e1b5f2f806 [object] Call destructor in hb_object_destroy() 2022-07-20 15:07:55 -06:00
Behdad Esfahbod 9ea4ab6051 [object] Call constructor 2022-07-20 14:57:32 -06:00
Behdad Esfahbod 61c0438425 [map] Allow geting non-const value pointer out with has() 2022-07-20 14:43:58 -06:00
Behdad Esfahbod 00cfc5c17d [map] Don't set out value in has() if not found 2022-07-20 14:38:28 -06:00
Behdad Esfahbod 485f043211 [map] Enable using hashmap with unique_ptr 2022-07-20 14:34:55 -06:00
Qunxin Liu 2a4773e43d add option "--instance", store axes_location in subset_plan and drop all
variation tables when all axes are pinned at default
2022-07-18 14:59:07 -06:00
Behdad Esfahbod d8f9d51780 [hashmap] Add keys_ref() and values_ref() 2022-07-12 13:19:31 -06:00
Behdad Esfahbod 5da341ce92 [map] Another try at hiding minus1
To fix https://github.com/harfbuzz/harfbuzz/issues/3684
2022-06-27 14:00:34 -06:00
Behdad Esfahbod c72d3104ed [map] Return const reference in operator[] 2022-06-27 13:31:05 -06:00
Behdad Esfahbod 69d53f3e7f [map] Make default_value() inline
See if it make fix https://github.com/harfbuzz/harfbuzz/issues/3684
2022-06-27 13:17:10 -06:00
Behdad Esfahbod 88f00ecb84 [map] Fix iter_ref () and test it 2022-06-03 01:30:27 -06:00
Behdad Esfahbod 25f57230d5 [map] Return references from new iter_ref() 2022-06-03 01:14:35 -06:00
Behdad Esfahbod 997d9cc466 [map] Make unique_ptr hashable 2022-06-02 18:47:42 -06:00
Behdad Esfahbod 8bb2a3326e [map] Remove unneeded assignment 2022-06-02 15:18:23 -06:00
Behdad Esfahbod e9407a2bd2 Use shared_ptr<hb_set_t> in one place
See if valgrind is happy...
2022-06-02 12:00:43 -06:00
Behdad Esfahbod b9230c5425 [map] Fix has() 2022-06-02 11:23:38 -06:00
Behdad Esfahbod 97ea10a63a Remove old nullptr_t hacks
Were used for hashmap before.
2022-06-02 11:23:38 -06:00
Behdad Esfahbod 3f78a71ca0 [map] Finally! Just can usd hb_hashmap_t<obj_t, obj_t>
Yay!
2022-06-02 11:23:37 -06:00
Behdad Esfahbod 0ccab339f9 [map] Remove invalid-key template arguments since unused 2022-06-02 11:23:37 -06:00
Behdad Esfahbod 3f6a8f69a0 [map] Remove invalid-key special-casing
Can override invalid-key value now.
2022-06-02 11:23:37 -06:00
Behdad Esfahbod 5328b73fba [map] Reduce map item size again 2022-06-02 11:23:37 -06:00
Behdad Esfahbod 4f58ae60eb [map] Keep is_used, is_tombstone as booleans 2022-06-02 11:23:37 -06:00
Behdad Esfahbod ea2dd54b68 [map] Place item hash between key and value, not after them
This way if only one of key and value is 64bit (eg. pointer), and other is 32bit,
the whole item will fit in 128bit, whereas before it would have been bumped up to
196 if only value was 64bit (a common use-case for us.)
2022-05-30 05:54:20 -06:00
Behdad Esfahbod cbcdf442c5 [map] Speed up map's own hash() 2022-05-30 05:54:20 -06:00
Behdad Esfahbod de33ef61b7 [map] Add TODO item 2022-05-30 05:54:20 -06:00
Behdad Esfahbod b99efa6c8d [map] Minor: use const reference in has() 2022-05-28 05:16:34 -06:00
Behdad Esfahbod 2fdb7616f5 [map Further adjust hash function 2022-05-19 16:00:43 -06:00
Behdad Esfahbod 01fc90b68c [map] Adjust hash function 2022-05-19 16:00:06 -06:00
Behdad Esfahbod 58f848daa8 [set/map] Adjust hash function return type 2022-05-19 15:43:19 -06:00
Behdad Esfahbod 561e02fefb [map] Make hb_map_t hashable 2022-05-19 13:41:53 -06:00
Behdad Esfahbod ad17699089 [map] Add is_equal() / towards making hb_map_t hashable
New API:
+ hb_map_is_equal()
2022-05-19 13:36:12 -06:00
Behdad Esfahbod f82ee17a75 [map] Pre-size map in constructor if we can 2022-05-18 12:19:49 -06:00
Behdad Esfahbod 7fa580bc4f [map] Fix map copy/move constructors to actually work
Ouch!
2022-05-12 13:05:32 -06:00
Garret Rieger e30511a8de [map] Correct previous commit, if (...) was reversed. 2022-01-14 16:48:42 -08:00
Garret Rieger ff4e8c7eac [map] Fix bad memory access if hb_map.fini() was called twice. 2022-01-14 16:42:39 -08:00
Behdad Esfahbod 8a69e00639 [meta] Use std::addressof() instead of hb_addressof() 2022-01-13 16:17:34 -07:00
Behdad Esfahbod 47afb3ef04 [meta] Replace hb_is_pointer with std::is_pointer 2022-01-13 15:27:41 -07:00
Behdad Esfahbod 956e0a4d13 [map] Destruct objects 2022-01-13 15:07:10 -07:00
Behdad Esfahbod 985b63b3ee [map] Allow invalid items to be pointer to static object
By derefencing them when necessary.

Also, we do not rely on trivially-copyable, so remove that assertion.
2022-01-13 13:33:07 -07:00
Behdad Esfahbod 5a91db1135 [map] Remove constexpr invalid items
These were non-workable in the general case, eg std::string.
2022-01-13 12:44:48 -07:00
Behdad Esfahbod 114046dc27 [map] Construct objects 2022-01-13 12:38:26 -07:00
Behdad Esfahbod ca4f56bdc7 [map] Massage some more
Towards being able to store arbitrary types.
2022-01-13 12:18:59 -07:00
Behdad Esfahbod 74811c501d [map] Map == / != use correct types 2022-01-12 10:35:28 -07:00
Behdad Esfahbod ce7f19a2cc Revert "[map] Actually use k/v invalid types for declaration!"
This reverts commit 6f559346ac.

Err. My bad.
2022-01-10 14:40:27 -07:00
Behdad Esfahbod 6f559346ac [map] Actually use k/v invalid types for declaration! 2022-01-10 14:29:36 -07:00
Behdad Esfahbod 394f772937 [map] Allow storing classes in the hashmap
Fixes https://github.com/harfbuzz/harfbuzz/issues/3293

The trick was to change the type of the invalid key/value to be non-class.
2021-11-19 11:49:23 -07:00
Behdad Esfahbod b1cd0dce8e [map] Add INVALID_KEY and INVALID_VALUE 2021-11-02 17:56:11 -06:00
Behdad Esfahbod 59d8f6c817 [map] Fix copy assignment operator 2021-11-02 10:33:53 -06:00
Behdad Esfahbod 943921cf0c [meta] Use more std type_traits 2021-11-02 00:26:46 -06:00