unum-cloud / usearch

Fast Open-Source Search & Clustering engine × for Vectors & 🔜 Strings × in C++, C, Python, JavaScript, Rust, Java, Objective-C, Swift, C#, GoLang, and Wolfram 🔍
https://unum-cloud.github.io/usearch/
Apache License 2.0
1.92k stars 109 forks source link

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

Closed Ngalstyan4 closed 1 month ago

Ngalstyan4 commented 1 month ago

When converting floating point arrays to binary, we use bitwise OR operations to set the relevant bits in the output buffer to 1. We do nothing if the bit is zero, so we assume that the bit is zero to start with. The memset statement makes sure this assumption holds.

ashvardanian commented 1 month ago

Amazing, thank you @Ngalstyan4, merged 😉