Skip to content
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

Fix: Avoid overflow when viewing large files #517

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 6 additions & 6 deletions include/usearch/index_plugins.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,10 @@ inline expected_gt<metric_kind_t> metric_from_name(char const* name) {
* @brief Convenience function to upcast a half-precision floating point number to a single-precision one.
*/
inline float f16_to_f32(std::uint16_t u16) noexcept {
#if USEARCH_USE_FP16LIB
return fp16_ieee_to_fp32_value(u16);
#elif USEARCH_USE_SIMSIMD
#if USEARCH_USE_SIMSIMD
return simsimd_f16_to_f32((simsimd_f16_t const*)&u16);
#elif USEARCH_USE_FP16LIB
return fp16_ieee_to_fp32_value(u16);
#else
#warning "It's recommended to use SimSIMD and fp16lib for half-precision numerics"
_Float16 f16;
Expand All @@ -412,12 +412,12 @@ inline float f16_to_f32(std::uint16_t u16) noexcept {
* @brief Convenience function to downcast a single-precision floating point number to a half-precision one.
*/
inline std::uint16_t f32_to_f16(float f32) noexcept {
#if USEARCH_USE_FP16LIB
return fp16_ieee_from_fp32_value(f32);
#elif USEARCH_USE_SIMSIMD
#if USEARCH_USE_SIMSIMD
std::uint16_t result;
simsimd_f32_to_f16(f32, (simsimd_f16_t*)&result);
return result;
#elif USEARCH_USE_FP16LIB
return fp16_ieee_from_fp32_value(f32);
#else
#warning "It's recommended to use SimSIMD and fp16lib for half-precision numerics"
_Float16 f16 = _Float16(f32);
Expand Down
Loading