MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / Div1_CalculateRef

Method Div1_CalculateRef

extern/ttmath/ttmathuint.h:1734–1787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1732
1733
1734 uint Div1_CalculateRef(const UInt<value_size> & divisor, UInt<value_size> & rest)
1735 {
1736 TTMATH_REFERENCE_ASSERT( divisor )
1737
1738 sint loop;
1739 sint c;
1740
1741 rest.SetZero();
1742 loop = value_size * TTMATH_BITS_PER_UINT;
1743 c = 0;
1744
1745
1746 div_a:
1747 c = Rcl(1, c);
1748 c = rest.Add(rest,c);
1749 c = rest.Sub(divisor,c);
1750
1751 c = !c;
1752
1753 if(!c)
1754 goto div_d;
1755
1756
1757 div_b:
1758 --loop;
1759 if(loop)
1760 goto div_a;
1761
1762 c = Rcl(1, c);
1763 TTMATH_LOG("UInt::Div1_Calculate")
1764 return 0;
1765
1766
1767 div_c:
1768 c = Rcl(1, c);
1769 c = rest.Add(rest,c);
1770 c = rest.Add(divisor);
1771
1772 if(c)
1773 goto div_b;
1774
1775
1776 div_d:
1777 --loop;
1778 if(loop)
1779 goto div_c;
1780
1781 c = Rcl(1, c);
1782 c = rest.Add(divisor);
1783
1784 TTMATH_LOG("UInt::Div1_Calculate")
1785
1786 return 0;
1787 }
1788
1789
1790public:

Callers

nothing calls this directly

Calls 3

SetZeroMethod · 0.80
AddMethod · 0.45
SubMethod · 0.45

Tested by

no test coverage detected