Skip to content

Commit 46320e0

Browse files
r-barnesfacebook-github-bot
authored andcommitted
Fix shadowed variable in faiss/utils/hamming_distance/avx2-inl.h
Summary: Our upcoming compiler upgrade will require us not to have shadowed variables. Such variables have a _high_ bug rate and reduce readability, so we would like to avoid them even if the compiler was not forcing us to do so. This codemod attempts to fix an instance of a shadowed variable. Please review with care: if it's failed the result will be a silent bug. **What's a shadowed variable?** Shadowed variables are variables in an inner scope with the same name as another variable in an outer scope. Having the same name for both variables might be semantically correct, but it can make the code confusing to read! It can also hide subtle bugs. This diff fixes such an issue by renaming the variable. - If you approve of this diff, please use the "Accept & Ship" button :-) Reviewed By: meyering Differential Revision: D52582813 fbshipit-source-id: 02a742df17614c546e10446bc530835e876942f0
1 parent 1be1d32 commit 46320e0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

faiss/utils/hamming_distance/avx2-inl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ struct HammingComputerDefault {
259259
set(a8, code_size);
260260
}
261261

262-
void set(const uint8_t* a8, int code_size) {
263-
this->a8 = a8;
262+
void set(const uint8_t* a8_2, int code_size) {
263+
this->a8 = a8_2;
264264
quotient8 = code_size / 8;
265265
remainder8 = code_size % 8;
266266
}

0 commit comments

Comments
 (0)