credit: @the-moisrex recommended a table-based approach
| 11988 | }(); |
| 11989 | // credit: @the-moisrex recommended a table-based approach |
| 11990 | ada_really_inline size_t |
| 11991 | find_authority_delimiter(std::string_view view) noexcept { |
| 11992 | // performance note: we might be able to gain further performance |
| 11993 | // with SIMD instrinsics. |
| 11994 | for (auto pos = view.begin(); pos != view.end(); ++pos) { |
| 11995 | if (authority_delimiter[(uint8_t)*pos]) { |
| 11996 | return pos - view.begin(); |
| 11997 | } |
| 11998 | } |
| 11999 | return size_t(view.size()); |
| 12000 | } |
| 12001 | |
| 12002 | } // namespace ada::helpers |
| 12003 |
no test coverage detected