! return values: 0 - none has to be done 1 - division by zero 2 - division should be made */
| 1594 | 2 - division should be made |
| 1595 | */ |
| 1596 | uint Div_StandardTest( const UInt<value_size> & v, |
| 1597 | uint & m, uint & n, |
| 1598 | UInt<value_size> * remainder = 0) |
| 1599 | { |
| 1600 | switch( Div_CalculatingSize(v, m, n) ) |
| 1601 | { |
| 1602 | case 4: // 'this' is equal v |
| 1603 | if( remainder ) |
| 1604 | remainder->SetZero(); |
| 1605 | |
| 1606 | SetOne(); |
| 1607 | TTMATH_LOG("UInt::Div_StandardTest") |
| 1608 | return 0; |
| 1609 | |
| 1610 | case 3: // 'this' is smaller than v |
| 1611 | if( remainder ) |
| 1612 | *remainder = *this; |
| 1613 | |
| 1614 | SetZero(); |
| 1615 | TTMATH_LOG("UInt::Div_StandardTest") |
| 1616 | return 0; |
| 1617 | |
| 1618 | case 2: // 'this' is zero |
| 1619 | if( remainder ) |
| 1620 | remainder->SetZero(); |
| 1621 | |
| 1622 | SetZero(); |
| 1623 | TTMATH_LOG("UInt::Div_StandardTest") |
| 1624 | return 0; |
| 1625 | |
| 1626 | case 1: // v is zero |
| 1627 | TTMATH_LOG("UInt::Div_StandardTest") |
| 1628 | return 1; |
| 1629 | } |
| 1630 | |
| 1631 | TTMATH_LOG("UInt::Div_StandardTest") |
| 1632 | |
| 1633 | return 2; |
| 1634 | } |
| 1635 | |
| 1636 | |
| 1637 |