From eb3f91d11126f53a6ec7a5c234b18ea6b8d63e1f Mon Sep 17 00:00:00 2001 From: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com> Date: Wed, 23 Aug 2023 19:15:47 +0400 Subject: [PATCH] Fix: `bitset_t` type alias for Pyhton --- include/usearch/index.hpp | 4 +++- python/lib.cpp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/usearch/index.hpp b/include/usearch/index.hpp index ed3d2bf3..5e0e9bca 100644 --- a/include/usearch/index.hpp +++ b/include/usearch/index.hpp @@ -488,6 +488,8 @@ template > class bitset_gt { inline lock_t lock(std::size_t i) noexcept { return {*this, i}; } }; +using bitset_t = bitset_gt<>; + /** * @brief Similar to `std::priority_queue`, but allows raw access to underlying * memory, in case you want to shuffle it or sort. Good for collections @@ -3552,7 +3554,7 @@ static join_result_t join( // std::memset(proposal_counts.data(), 0, sizeof(proposals_count_t) * men.size()); // Define locks, to limit concurrent accesses to `man_to_woman_slots` and `woman_to_man_slots`. - bitset_gt men_locks(men.size()), women_locks(women.size()); + bitset_t men_locks(men.size()), women_locks(women.size()); if (!men_locks || !women_locks) return result.failed("Can't allocate locks"); diff --git a/python/lib.cpp b/python/lib.cpp index 7c77b605..844db8f0 100644 --- a/python/lib.cpp +++ b/python/lib.cpp @@ -350,7 +350,7 @@ static void search_typed( // if (!threads) threads = std::thread::hardware_concurrency(); - visits_bitset_t query_mutexes(static_cast(vectors_count)); + bitset_t query_mutexes(static_cast(vectors_count)); if (!query_mutexes) throw std::bad_alloc(); @@ -481,7 +481,7 @@ static void search_typed_brute_force( // threads = std::thread::hardware_concurrency(); std::size_t tasks_count = static_cast(dataset_count * queries_count); - visits_bitset_t query_mutexes(static_cast(queries_count)); + bitset_t query_mutexes(static_cast(queries_count)); if (!query_mutexes) throw std::bad_alloc();