Lexicographically compare two strings (possibly containing nulls), and return true if the first is less than the second.
| 77 | // Lexicographically compare two strings (possibly containing nulls), and |
| 78 | // return true if the first is less than the second. |
| 79 | static inline bool StringLessThan(const char *a_data, uoffset_t a_size, |
| 80 | const char *b_data, uoffset_t b_size) { |
| 81 | const auto cmp = memcmp(a_data, b_data, (std::min)(a_size, b_size)); |
| 82 | return cmp == 0 ? a_size < b_size : cmp < 0; |
| 83 | } |
| 84 | |
| 85 | // When we read serialized data from memory, in the case of most scalars, |
| 86 | // we want to just read T, but in the case of Offset, we want to actually |
no outgoing calls
no test coverage detected