Skip to content

Commit

Permalink
[libc++][NFC] Rewrite function call on two lines for clarity (llvm#79141
Browse files Browse the repository at this point in the history
)

Previously, there was a ternary conditional with a less-than comparison
appearing inside a template argument, which was really confusing because
of the <...> of the function template. This patch rewrites the same
statement on two lines for clarity.

(cherry picked from commit 382f70a)
  • Loading branch information
ldionne authored and owenca committed Jun 22, 2024
1 parent d74eafd commit 69e63d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libcxx/include/string
Original file line number Diff line number Diff line change
Expand Up @@ -1943,8 +1943,8 @@ private:
if (__s < __min_cap) {
return static_cast<size_type>(__min_cap) - 1;
}
size_type __guess =
__align_it < sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : 1 > (__s + 1) - 1;
const size_type __boundary = sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : 1;
size_type __guess = __align_it<__boundary>(__s + 1) - 1;
if (__guess == __min_cap)
++__guess;
return __guess;
Expand Down

0 comments on commit 69e63d3

Please sign in to comment.