| 1616 | // ---------------------------------------------------------------------------------------- |
| 1617 | |
| 1618 | void bigint_kernel_1:: |
| 1619 | increment ( |
| 1620 | const data_record* source, |
| 1621 | data_record* dest |
| 1622 | ) const |
| 1623 | { |
| 1624 | uint16* s = source->number; |
| 1625 | uint16* d = dest->number; |
| 1626 | uint16* end = s + source->digits_used; |
| 1627 | while (true) |
| 1628 | { |
| 1629 | *d = *s + 1; |
| 1630 | |
| 1631 | // if there was no carry then break out of the loop |
| 1632 | if (*d != 0) |
| 1633 | { |
| 1634 | dest->digits_used = source->digits_used; |
| 1635 | |
| 1636 | // copy the rest of the digits over to d |
| 1637 | ++d; ++s; |
| 1638 | while (s != end) |
| 1639 | { |
| 1640 | *d = *s; |
| 1641 | ++d; |
| 1642 | ++s; |
| 1643 | } |
| 1644 | |
| 1645 | break; |
| 1646 | } |
| 1647 | |
| 1648 | |
| 1649 | ++s; |
| 1650 | |
| 1651 | // if we have hit the end of s and there was a carry up to this point |
| 1652 | // then just make the next digit 1 and add one to the digits used |
| 1653 | if (s == end) |
| 1654 | { |
| 1655 | ++d; |
| 1656 | dest->digits_used = source->digits_used + 1; |
| 1657 | *d = 1; |
| 1658 | break; |
| 1659 | } |
| 1660 | |
| 1661 | ++d; |
| 1662 | } |
| 1663 | } |
| 1664 | |
| 1665 | // ---------------------------------------------------------------------------------------- |
| 1666 |
nothing calls this directly
no outgoing calls
no test coverage detected