Skip to content

Commit

Permalink
Fix: bitset_t type alias for Pyhton
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvardanian committed Aug 23, 2023
1 parent 9fe5735 commit eb3f91d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion include/usearch/index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ template <typename allocator_at = std::allocator<byte_t>> 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
Expand Down Expand Up @@ -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<dynamic_allocator_t> 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");

Expand Down
4 changes: 2 additions & 2 deletions python/lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ static void search_typed( //
if (!threads)
threads = std::thread::hardware_concurrency();

visits_bitset_t query_mutexes(static_cast<std::size_t>(vectors_count));
bitset_t query_mutexes(static_cast<std::size_t>(vectors_count));
if (!query_mutexes)
throw std::bad_alloc();

Expand Down Expand Up @@ -481,7 +481,7 @@ static void search_typed_brute_force( //
threads = std::thread::hardware_concurrency();

std::size_t tasks_count = static_cast<std::size_t>(dataset_count * queries_count);
visits_bitset_t query_mutexes(static_cast<std::size_t>(queries_count));
bitset_t query_mutexes(static_cast<std::size_t>(queries_count));
if (!query_mutexes)
throw std::bad_alloc();

Expand Down

0 comments on commit eb3f91d

Please sign in to comment.