Skip to content

Commit 463ffd8

Browse files
r-barnesfacebook-github-bot
authored andcommitted
Indicate that fallthrough is intentional in faiss (facebookresearch#2897)
Summary: Pull Request resolved: facebookresearch#2897 Reviewed By: algoriddle Differential Revision: D46385243 fbshipit-source-id: f08b16c9db91edca53cdbf0932a990c8c1f9d0db
1 parent 8ec166c commit 463ffd8

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

faiss/utils/distances_simd.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -2176,10 +2176,13 @@ void pq2_8cents_table(
21762176
switch (nout) {
21772177
case 4:
21782178
ip3.storeu(out + 3 * ldo);
2179+
[[fallthrough]];
21792180
case 3:
21802181
ip2.storeu(out + 2 * ldo);
2182+
[[fallthrough]];
21812183
case 2:
21822184
ip1.storeu(out + 1 * ldo);
2185+
[[fallthrough]];
21832186
case 1:
21842187
ip0.storeu(out);
21852188
}

faiss/utils/hamming_distance/avx2-inl.h

+13
Original file line numberDiff line numberDiff line change
@@ -280,21 +280,27 @@ struct HammingComputerDefault {
280280
case 7:
281281
accu += popcount64(a64[i] ^ b64[i]);
282282
i++;
283+
[[fallthrough]];
283284
case 6:
284285
accu += popcount64(a64[i] ^ b64[i]);
285286
i++;
287+
[[fallthrough]];
286288
case 5:
287289
accu += popcount64(a64[i] ^ b64[i]);
288290
i++;
291+
[[fallthrough]];
289292
case 4:
290293
accu += popcount64(a64[i] ^ b64[i]);
291294
i++;
295+
[[fallthrough]];
292296
case 3:
293297
accu += popcount64(a64[i] ^ b64[i]);
294298
i++;
299+
[[fallthrough]];
295300
case 2:
296301
accu += popcount64(a64[i] ^ b64[i]);
297302
i++;
303+
[[fallthrough]];
298304
case 1:
299305
accu += popcount64(a64[i] ^ b64[i]);
300306
i++;
@@ -306,18 +312,25 @@ struct HammingComputerDefault {
306312
switch (remainder8) {
307313
case 7:
308314
accu += hamdis_tab_ham_bytes[a[6] ^ b[6]];
315+
[[fallthrough]];
309316
case 6:
310317
accu += hamdis_tab_ham_bytes[a[5] ^ b[5]];
318+
[[fallthrough]];
311319
case 5:
312320
accu += hamdis_tab_ham_bytes[a[4] ^ b[4]];
321+
[[fallthrough]];
313322
case 4:
314323
accu += hamdis_tab_ham_bytes[a[3] ^ b[3]];
324+
[[fallthrough]];
315325
case 3:
316326
accu += hamdis_tab_ham_bytes[a[2] ^ b[2]];
327+
[[fallthrough]];
317328
case 2:
318329
accu += hamdis_tab_ham_bytes[a[1] ^ b[1]];
330+
[[fallthrough]];
319331
case 1:
320332
accu += hamdis_tab_ham_bytes[a[0] ^ b[0]];
333+
[[fallthrough]];
321334
default:
322335
break;
323336
}

0 commit comments

Comments
 (0)