From 5893ab77daee3c84ecc74a2c84c18d7cd486fcea Mon Sep 17 00:00:00 2001 From: Junjie Qi Date: Mon, 22 Apr 2024 09:30:05 -0700 Subject: [PATCH] remove unused code (#3371) Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/3371 This will never happen because N is fixed at compile time and the buffer is large enough. It is misleading to add error handling code for a case that will never happen. Reviewed By: kuarora Differential Revision: D56274458 fbshipit-source-id: ca706f1223dbc97e69d5ac9750b277afa4df80a7 --- faiss/utils/simdlib_neon.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/faiss/utils/simdlib_neon.h b/faiss/utils/simdlib_neon.h index 439a5210bc..1bdf0ed01e 100644 --- a/faiss/utils/simdlib_neon.h +++ b/faiss/utils/simdlib_neon.h @@ -170,14 +170,10 @@ static inline std::string elements_to_string(const char* fmt, const S& simd) { for (size_t i = 0; i < N; ++i) { int bytesWritten = snprintf(ptr, sizeof(res) - (ptr - res), fmt, bytes[i]); - if (bytesWritten >= 0) { - ptr += bytesWritten; - } else { - break; - } + ptr += bytesWritten; } - // strip last , - + // The format usually contains a ',' separator so this is to remove the last + // separator. ptr[-1] = 0; return std::string(res); }