Compare the leading prefix, if b is lexicographically less, return 0 */
| 1120 | |
| 1121 | /* Compare the leading prefix, if b is lexicographically less, return 0 */ |
| 1122 | static 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 */ |
| 1137 | static sonic_force_inline void LeftShift(Decimal *d, uint32_t k) { |