Skip to content

Commit

Permalink
Indicate that fallthrough is intentional in faiss (#2897)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #2897

Reviewed By: algoriddle

Differential Revision: D46385243

fbshipit-source-id: f08b16c9db91edca53cdbf0932a990c8c1f9d0db
  • Loading branch information
r-barnes authored and facebook-github-bot committed Jun 8, 2023
1 parent 8ec166c commit 463ffd8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
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

0 comments on commit 463ffd8

Please sign in to comment.