The nonempty char array P represents a valid non-negative decimal integer. ENDP points just after the last char in P. Adjust the array to describe the next-larger integer and return whether this grows the array by one on the left. */
| 413 | Adjust the array to describe the next-larger integer and return |
| 414 | whether this grows the array by one on the left. */ |
| 415 | static bool |
| 416 | incr_grows (char *p, char *endp) |
| 417 | { |
| 418 | do |
| 419 | { |
| 420 | endp--; |
| 421 | if (*endp < '9') |
| 422 | { |
| 423 | (*endp)++; |
| 424 | return false; |
| 425 | } |
| 426 | *endp = '0'; |
| 427 | } |
| 428 | while (p < endp); |
| 429 | |
| 430 | p[-1] = '1'; |
| 431 | return true; |
| 432 | } |
| 433 | |
| 434 | /* Compare A and B with lengths A_LEN and B_LEN. A and B are integers |
| 435 | represented by nonempty arrays of digits without redundant leading '0'. |