Skip to content

Commit

Permalink
remove manual linear search clause
Browse files Browse the repository at this point in the history
  • Loading branch information
rimathia committed Nov 8, 2020
1 parent a2de072 commit e662999
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions include/fmt/printf.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,8 @@ OutputIt basic_printf_context<OutputIt, Char>::format() {
const Char* end = parse_ctx_.end();
auto it = start;
while (it != end) {
if (end - it < 32) {
// Use a simple linear search instead of memchr for small strings.
it = std::find(it, end, '%');
} else {
if (!detail::find<false, Char>(it, end, '%', it)) {
it = end;
}
if (!detail::find<false, Char>(it, end, '%', it)) {
it = end;
}
if (it == end) {
continue;
Expand Down

0 comments on commit e662999

Please sign in to comment.