Skip to content

Commit 218573b

Browse files
] noexcept
Summary: marking noinline functions as noexcept to help compiler optimizations. I didn't see effect in the microbenchmarks, but should be at least not worse. Reviewed By: yfeldblum Differential Revision: D64046213 fbshipit-source-id: 68e24dc26bea1a974e9cd68d3c17edf5abbe2adc
1 parent a483ba1 commit 218573b

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

third-party/folly/src/folly/algorithm/simd/Contains.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,21 @@
2222

2323
namespace folly::simd::detail {
2424

25-
bool containsU8(folly::span<const std::uint8_t> haystack, std::uint8_t needle) {
25+
bool containsU8(
26+
folly::span<const std::uint8_t> haystack, std::uint8_t needle) noexcept {
2627
return containsImpl(haystack, needle);
2728
}
2829
bool containsU16(
29-
folly::span<const std::uint16_t> haystack, std::uint16_t needle) {
30+
folly::span<const std::uint16_t> haystack, std::uint16_t needle) noexcept {
3031
return containsImpl(haystack, needle);
3132
}
3233
bool containsU32(
33-
folly::span<const std::uint32_t> haystack, std::uint32_t needle) {
34+
folly::span<const std::uint32_t> haystack, std::uint32_t needle) noexcept {
3435
return containsImpl(haystack, needle);
3536
}
3637

3738
bool containsU64(
38-
folly::span<const std::uint64_t> haystack, std::uint64_t needle) {
39+
folly::span<const std::uint64_t> haystack, std::uint64_t needle) noexcept {
3940
return containsImpl(haystack, needle);
4041
}
4142

third-party/folly/src/folly/algorithm/simd/Contains.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ namespace detail {
2626

2727
// no overloading for easier profiling.
2828

29-
bool containsU8(folly::span<const std::uint8_t> haystack, std::uint8_t needle);
29+
bool containsU8(
30+
folly::span<const std::uint8_t> haystack, std::uint8_t needle) noexcept;
3031
bool containsU16(
31-
folly::span<const std::uint16_t> haystack, std::uint16_t needle);
32+
folly::span<const std::uint16_t> haystack, std::uint16_t needle) noexcept;
3233
bool containsU32(
33-
folly::span<const std::uint32_t> haystack, std::uint32_t needle);
34+
folly::span<const std::uint32_t> haystack, std::uint32_t needle) noexcept;
3435
bool containsU64(
35-
folly::span<const std::uint64_t> haystack, std::uint64_t needle);
36+
folly::span<const std::uint64_t> haystack, std::uint64_t needle) noexcept;
3637

3738
template <typename R>
3839
using std_range_value_t = typename std::iterator_traits<decltype(std::begin(

0 commit comments

Comments
 (0)