MCPcopy Create free account
hub / github.com/bytedance/sonic-cpp / PrefixIsLess

Function PrefixIsLess

include/sonic/internal/atof_native.h:1122–1134  ·  view source on GitHub ↗

Compare the leading prefix, if b is lexicographically less, return 0 */

Source from the content-addressed store, hash-verified

1120
1121/* Compare the leading prefix, if b is lexicographically less, return 0 */
1122static sonic_force_inline bool PrefixIsLess(const char *b, const char *s,
1123 uint64_t bn) {
1124 size_t i = 0;
1125 for (; i < bn; i++) {
1126 if (s[i] == '\0') {
1127 return false;
1128 }
1129 if (b[i] != s[i]) {
1130 return b[i] < s[i];
1131 }
1132 }
1133 return s[i] != '\0';
1134}
1135
1136/* Binary shift left (* 2) by k bits. k <= maxShift to avoid overflow */
1137static sonic_force_inline void LeftShift(Decimal *d, uint32_t k) {

Callers 1

LeftShiftFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected