Skip to content

Commit 8ab8faa

Browse files
committed
Address final review comment
1 parent 6875131 commit 8ab8faa

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/datadog/endpoint_inferral.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ StringView to_string(component_type type) {
6161
return "";
6262
}
6363

64-
inline uint8_t bool2mask(bool x) { return x ? 0xFF : 0x00; }
65-
6664
component_type component_replacement(StringView path) noexcept {
6765
// viable_components is a bitset of the component types not yet excluded
6866
std::uint8_t viable_components = all_components;
@@ -108,11 +106,14 @@ component_type component_replacement(StringView path) noexcept {
108106
}
109107

110108
// is_str requires a special char or a size >= 20
111-
viable_components &= ~component_type::is_str |
112-
bool2mask(found_special_char || (path.size() >= 20));
109+
if (!found_special_char && path.size() < 20) {
110+
viable_components &= ~component_type::is_str;
111+
}
112+
113113
// hex, and hex_id require a digit
114-
viable_components &= ~(component_type::is_hex | component_type::is_hex_id) |
115-
bool2mask(found_digit);
114+
if (!found_digit) {
115+
viable_components &= ~(component_type::is_hex | component_type::is_hex_id);
116+
}
116117

117118
if (viable_components == 0) {
118119
return component_type::none;

0 commit comments

Comments
 (0)