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

Indicate that fallthrough is intentional in faiss #2897

Closed
Closed
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions faiss/utils/distances_simd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2176,10 +2176,13 @@ void pq2_8cents_table(
switch (nout) {
case 4:
ip3.storeu(out + 3 * ldo);
[[fallthrough]];
case 3:
ip2.storeu(out + 2 * ldo);
[[fallthrough]];
case 2:
ip1.storeu(out + 1 * ldo);
[[fallthrough]];
case 1:
ip0.storeu(out);
}
Expand Down
13 changes: 13 additions & 0 deletions faiss/utils/hamming_distance/avx2-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,21 +280,27 @@ struct HammingComputerDefault {
case 7:
accu += popcount64(a64[i] ^ b64[i]);
i++;
[[fallthrough]];
case 6:
accu += popcount64(a64[i] ^ b64[i]);
i++;
[[fallthrough]];
case 5:
accu += popcount64(a64[i] ^ b64[i]);
i++;
[[fallthrough]];
case 4:
accu += popcount64(a64[i] ^ b64[i]);
i++;
[[fallthrough]];
case 3:
accu += popcount64(a64[i] ^ b64[i]);
i++;
[[fallthrough]];
case 2:
accu += popcount64(a64[i] ^ b64[i]);
i++;
[[fallthrough]];
case 1:
accu += popcount64(a64[i] ^ b64[i]);
i++;
Expand All @@ -306,18 +312,25 @@ struct HammingComputerDefault {
switch (remainder8) {
case 7:
accu += hamdis_tab_ham_bytes[a[6] ^ b[6]];
[[fallthrough]];
case 6:
accu += hamdis_tab_ham_bytes[a[5] ^ b[5]];
[[fallthrough]];
case 5:
accu += hamdis_tab_ham_bytes[a[4] ^ b[4]];
[[fallthrough]];
case 4:
accu += hamdis_tab_ham_bytes[a[3] ^ b[3]];
[[fallthrough]];
case 3:
accu += hamdis_tab_ham_bytes[a[2] ^ b[2]];
[[fallthrough]];
case 2:
accu += hamdis_tab_ham_bytes[a[1] ^ b[1]];
[[fallthrough]];
case 1:
accu += hamdis_tab_ham_bytes[a[0] ^ b[0]];
[[fallthrough]];
default:
break;
}
Expand Down