| 172 | |
| 173 | template<CharFn fn> |
| 174 | inline int32_t strCmp(const char* _lhs, int32_t _lhsMax, const char* _rhs, int32_t _rhsMax) |
| 175 | { |
| 176 | int32_t max = min(_lhsMax, _rhsMax); |
| 177 | |
| 178 | for ( |
| 179 | ; 0 < max && fn(*_lhs) == fn(*_rhs) |
| 180 | ; ++_lhs, ++_rhs, --max |
| 181 | ) |
| 182 | { |
| 183 | if (*_lhs == '\0' |
| 184 | || *_rhs == '\0') |
| 185 | { |
| 186 | break; |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | if (0 == max) |
| 191 | { |
| 192 | return _lhsMax == _rhsMax ? 0 : _lhsMax > _rhsMax ? 1 : -1; |
| 193 | } |
| 194 | |
| 195 | return fn(*_lhs) - fn(*_rhs); |
| 196 | } |
| 197 | |
| 198 | int32_t strCmp(const StringView& _lhs, const StringView& _rhs, int32_t _max) |
| 199 | { |
no test coverage detected