| 1579 | // ---------------------------------------------------------------------------------------- |
| 1580 | |
| 1581 | void bigint_kernel_2:: |
| 1582 | shift_left ( |
| 1583 | const data_record* data, |
| 1584 | data_record* result, |
| 1585 | uint32 shift_amount |
| 1586 | ) const |
| 1587 | { |
| 1588 | uint32 offset = shift_amount/16; |
| 1589 | shift_amount &= 0xf; // same as shift_amount %= 16; |
| 1590 | |
| 1591 | uint16* r = result->number + data->digits_used + offset; // result |
| 1592 | uint16* end = data->number; |
| 1593 | uint16* s = end + data->digits_used; // source |
| 1594 | const uint32 temp = 16 - shift_amount; |
| 1595 | |
| 1596 | *r = (*(--s) >> temp); |
| 1597 | // set the number of digits used in the result |
| 1598 | // if the upper bits from *s were zero then don't count this first word |
| 1599 | if (*r == 0) |
| 1600 | { |
| 1601 | result->digits_used = data->digits_used + offset; |
| 1602 | } |
| 1603 | else |
| 1604 | { |
| 1605 | result->digits_used = data->digits_used + offset + 1; |
| 1606 | } |
| 1607 | --r; |
| 1608 | |
| 1609 | while (s != end) |
| 1610 | { |
| 1611 | *r = ((*s << shift_amount) | ( *(s-1) >> temp)); |
| 1612 | --r; |
| 1613 | --s; |
| 1614 | } |
| 1615 | *r = *s << shift_amount; |
| 1616 | |
| 1617 | // now zero the rest of the result |
| 1618 | end = result->number; |
| 1619 | while (r != end) |
| 1620 | *(--r) = 0; |
| 1621 | |
| 1622 | } |
| 1623 | |
| 1624 | // ---------------------------------------------------------------------------------------- |
| 1625 |
nothing calls this directly
no outgoing calls
no test coverage detected