Skip to content

Reset cast buffer so it can be set with bitwise ORs #428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/usearch/index_plugins.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,7 @@ template <typename from_scalar_at> struct cast_gt<from_scalar_at, b1x8_t> {
inline static bool try_(byte_t const* input, std::size_t dim, byte_t* output) noexcept {
from_scalar_at const* typed_input = reinterpret_cast<from_scalar_at const*>(input);
unsigned char* typed_output = reinterpret_cast<unsigned char*>(output);
std::memset(typed_output, 0, dim / CHAR_BIT);
for (std::size_t i = 0; i != dim; ++i)
// Converting from scalar types to boolean isn't trivial and depends on the type.
// The most common case is to consider all positive values as `true` and all others as `false`.
Expand Down