mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-29 07:25:51 +00:00
deploy: 023f5704d0
This commit is contained in:
@@ -94,147 +94,144 @@ $(function() {
|
||||
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  </div>
|
||||
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="keyword">namespace </span><a class="code" href="namespaceripple.html">ripple</a> {</div>
|
||||
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  </div>
|
||||
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> Quality::Quality (<a class="codeRef" href="http://en.cppreference.com/w/cpp/types/integer.html">std::uint64_t</a> value)</div>
|
||||
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  : m_value (value)</div>
|
||||
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> {</div>
|
||||
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span> }</div>
|
||||
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  </div>
|
||||
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span> Quality::Quality (Amounts <span class="keyword">const</span>& amount)</div>
|
||||
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  : m_value (<a class="code" href="namespaceripple.html#a73cc988e7ba5d5ee0fd9db53740917ec">getRate</a> (amount.<a class="code" href="namespaceripple.html#a7cc64e12723fbc9606d85442a2569fedac68271a63ddbc431c307beb7d2918275">out</a>, amount.<a class="code" href="namespaceripple.html#a7cc64e12723fbc9606d85442a2569feda13b5bfe96f3e2fe411c9f66f4a582adf">in</a>))</div>
|
||||
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span> {</div>
|
||||
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span> }</div>
|
||||
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  </div>
|
||||
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span> Quality&</div>
|
||||
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span> Quality::operator++()</div>
|
||||
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span> {</div>
|
||||
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  assert (m_value > 0);</div>
|
||||
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  --m_value;</div>
|
||||
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
|
||||
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span> }</div>
|
||||
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  </div>
|
||||
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span> Quality</div>
|
||||
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span> Quality::operator++ (<span class="keywordtype">int</span>)</div>
|
||||
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span> {</div>
|
||||
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  Quality <a class="codeRef" href="http://en.cppreference.com/w/cpp/iterator/prev.html">prev</a> (*<span class="keyword">this</span>);</div>
|
||||
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  ++*<span class="keyword">this</span>;</div>
|
||||
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="keywordflow">return</span> <a class="codeRef" href="http://en.cppreference.com/w/cpp/iterator/prev.html">prev</a>;</div>
|
||||
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span> }</div>
|
||||
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  </div>
|
||||
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span> Quality&</div>
|
||||
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span> Quality::operator--()</div>
|
||||
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span> {</div>
|
||||
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  assert (m_value < <a class="codeRef" href="http://en.cppreference.com/w/cpp/types/numeric_limits.html">std::numeric_limits<value_type>::max</a>());</div>
|
||||
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  ++m_value;</div>
|
||||
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
|
||||
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span> }</div>
|
||||
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  </div>
|
||||
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span> Quality</div>
|
||||
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span> Quality::operator-- (<span class="keywordtype">int</span>)</div>
|
||||
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span> {</div>
|
||||
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  Quality <a class="codeRef" href="http://en.cppreference.com/w/cpp/iterator/prev.html">prev</a> (*<span class="keyword">this</span>);</div>
|
||||
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  --*<span class="keyword">this</span>;</div>
|
||||
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="keywordflow">return</span> <a class="codeRef" href="http://en.cppreference.com/w/cpp/iterator/prev.html">prev</a>;</div>
|
||||
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span> }</div>
|
||||
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  </div>
|
||||
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span> Amounts</div>
|
||||
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span> Quality::ceil_in (Amounts <span class="keyword">const</span>& amount, STAmount <span class="keyword">const</span>& limit)<span class="keyword"> const</span></div>
|
||||
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span> <span class="keyword"></span>{</div>
|
||||
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <span class="keywordflow">if</span> (amount.in > limit)</div>
|
||||
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  {</div>
|
||||
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  Amounts result (limit, <a class="code" href="namespaceripple.html#a47b15adfd6fb69767c64f50d860a11cc">divRound</a> (</div>
|
||||
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  limit, <a class="code" href="namespaceripple_1_1test_1_1jtx.html#a8e8d814b8820ce0b6979abde0d6a2618">rate</a>(), amount.out.issue (), <span class="keyword">true</span>));</div>
|
||||
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="comment">// Clamp out</span></div>
|
||||
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keywordflow">if</span> (result.out > amount.out)</div>
|
||||
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  result.out = amount.out;</div>
|
||||
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  assert (result.in == limit);</div>
|
||||
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keywordflow">return</span> result;</div>
|
||||
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  }</div>
|
||||
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  assert (amount.in <= limit);</div>
|
||||
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordflow">return</span> amount;</div>
|
||||
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span> }</div>
|
||||
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  </div>
|
||||
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span> Amounts</div>
|
||||
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span> Quality::ceil_out (Amounts <span class="keyword">const</span>& amount, STAmount <span class="keyword">const</span>& limit)<span class="keyword"> const</span></div>
|
||||
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span> <span class="keyword"></span>{</div>
|
||||
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keywordflow">if</span> (amount.out > limit)</div>
|
||||
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  {</div>
|
||||
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  Amounts result (<a class="code" href="namespaceripple.html#a7806e73f2a04df365821602cfcf89ff2">mulRound</a> (</div>
|
||||
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  limit, <a class="code" href="namespaceripple_1_1test_1_1jtx.html#a8e8d814b8820ce0b6979abde0d6a2618">rate</a>(), amount.in.issue (), <span class="keyword">true</span>), limit);</div>
|
||||
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <span class="comment">// Clamp in</span></div>
|
||||
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="keywordflow">if</span> (result.in > amount.in)</div>
|
||||
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  result.in = amount.in;</div>
|
||||
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  assert (result.out == limit);</div>
|
||||
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="keywordflow">return</span> result;</div>
|
||||
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  }</div>
|
||||
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  assert (amount.out <= limit);</div>
|
||||
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <span class="keywordflow">return</span> amount;</div>
|
||||
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span> }</div>
|
||||
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  </div>
|
||||
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span> Quality</div>
|
||||
<div class="line"><a name="l00103"></a><span class="lineno"><a class="line" href="namespaceripple.html#a7c8945b5034bba5f9df719cff2503495"> 103</a></span> <a class="code" href="namespaceripple.html#a7c8945b5034bba5f9df719cff2503495">composed_quality</a> (Quality <span class="keyword">const</span>& lhs, Quality <span class="keyword">const</span>& rhs)</div>
|
||||
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span> {</div>
|
||||
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <a class="code" href="classripple_1_1STAmount.html">STAmount</a> <span class="keyword">const</span> lhs_rate (lhs.rate ());</div>
|
||||
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  assert (lhs_rate != beast::zero);</div>
|
||||
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  </div>
|
||||
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <a class="code" href="classripple_1_1STAmount.html">STAmount</a> <span class="keyword">const</span> rhs_rate (rhs.rate ());</div>
|
||||
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  assert (rhs_rate != beast::zero);</div>
|
||||
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> Quality::Quality(<a class="codeRef" href="http://en.cppreference.com/w/cpp/types/integer.html">std::uint64_t</a> value) : m_value(value)</div>
|
||||
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> {</div>
|
||||
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> }</div>
|
||||
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  </div>
|
||||
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> Quality::Quality(Amounts <span class="keyword">const</span>& amount)</div>
|
||||
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  : m_value(<a class="code" href="namespaceripple.html#a73cc988e7ba5d5ee0fd9db53740917ec">getRate</a>(amount.<a class="code" href="namespaceripple.html#a7cc64e12723fbc9606d85442a2569fedac68271a63ddbc431c307beb7d2918275">out</a>, amount.<a class="code" href="namespaceripple.html#a7cc64e12723fbc9606d85442a2569feda13b5bfe96f3e2fe411c9f66f4a582adf">in</a>))</div>
|
||||
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span> {</div>
|
||||
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span> }</div>
|
||||
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  </div>
|
||||
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span> Quality&</div>
|
||||
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span> Quality::operator++()</div>
|
||||
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span> {</div>
|
||||
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  assert(m_value > 0);</div>
|
||||
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  --m_value;</div>
|
||||
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
|
||||
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span> }</div>
|
||||
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  </div>
|
||||
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span> Quality</div>
|
||||
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span> Quality::operator++(<span class="keywordtype">int</span>)</div>
|
||||
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span> {</div>
|
||||
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  Quality <a class="codeRef" href="http://en.cppreference.com/w/cpp/iterator/prev.html">prev</a>(*<span class="keyword">this</span>);</div>
|
||||
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  ++*<span class="keyword">this</span>;</div>
|
||||
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keywordflow">return</span> <a class="codeRef" href="http://en.cppreference.com/w/cpp/iterator/prev.html">prev</a>;</div>
|
||||
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span> }</div>
|
||||
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  </div>
|
||||
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span> Quality&</div>
|
||||
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span> Quality::operator--()</div>
|
||||
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span> {</div>
|
||||
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  assert(m_value < <a class="codeRef" href="http://en.cppreference.com/w/cpp/types/numeric_limits.html">std::numeric_limits<value_type>::max</a>());</div>
|
||||
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  ++m_value;</div>
|
||||
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
|
||||
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span> }</div>
|
||||
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  </div>
|
||||
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span> Quality</div>
|
||||
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span> Quality::operator--(<span class="keywordtype">int</span>)</div>
|
||||
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span> {</div>
|
||||
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  Quality <a class="codeRef" href="http://en.cppreference.com/w/cpp/iterator/prev.html">prev</a>(*<span class="keyword">this</span>);</div>
|
||||
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  --*<span class="keyword">this</span>;</div>
|
||||
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="keywordflow">return</span> <a class="codeRef" href="http://en.cppreference.com/w/cpp/iterator/prev.html">prev</a>;</div>
|
||||
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span> }</div>
|
||||
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  </div>
|
||||
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span> Amounts</div>
|
||||
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span> Quality::ceil_in(Amounts <span class="keyword">const</span>& amount, STAmount <span class="keyword">const</span>& limit)<span class="keyword"> const</span></div>
|
||||
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span> <span class="keyword"></span>{</div>
|
||||
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="keywordflow">if</span> (amount.in > limit)</div>
|
||||
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  {</div>
|
||||
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  Amounts result(</div>
|
||||
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  limit, <a class="code" href="namespaceripple.html#a47b15adfd6fb69767c64f50d860a11cc">divRound</a>(limit, <a class="code" href="namespaceripple_1_1test_1_1jtx.html#a8e8d814b8820ce0b6979abde0d6a2618">rate</a>(), amount.out.issue(), <span class="keyword">true</span>));</div>
|
||||
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <span class="comment">// Clamp out</span></div>
|
||||
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="keywordflow">if</span> (result.out > amount.out)</div>
|
||||
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  result.out = amount.out;</div>
|
||||
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  assert(result.in == limit);</div>
|
||||
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="keywordflow">return</span> result;</div>
|
||||
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  }</div>
|
||||
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  assert(amount.in <= limit);</div>
|
||||
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <span class="keywordflow">return</span> amount;</div>
|
||||
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span> }</div>
|
||||
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  </div>
|
||||
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span> Amounts</div>
|
||||
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span> Quality::ceil_out(Amounts <span class="keyword">const</span>& amount, STAmount <span class="keyword">const</span>& limit)<span class="keyword"> const</span></div>
|
||||
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span> <span class="keyword"></span>{</div>
|
||||
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <span class="keywordflow">if</span> (amount.out > limit)</div>
|
||||
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  {</div>
|
||||
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  Amounts result(<a class="code" href="namespaceripple.html#a7806e73f2a04df365821602cfcf89ff2">mulRound</a>(limit, <a class="code" href="namespaceripple_1_1test_1_1jtx.html#a8e8d814b8820ce0b6979abde0d6a2618">rate</a>(), amount.in.issue(), <span class="keyword">true</span>), limit);</div>
|
||||
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <span class="comment">// Clamp in</span></div>
|
||||
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="keywordflow">if</span> (result.in > amount.in)</div>
|
||||
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  result.in = amount.in;</div>
|
||||
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  assert(result.out == limit);</div>
|
||||
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="keywordflow">return</span> result;</div>
|
||||
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  }</div>
|
||||
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  assert(amount.out <= limit);</div>
|
||||
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <span class="keywordflow">return</span> amount;</div>
|
||||
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span> }</div>
|
||||
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  </div>
|
||||
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span> Quality</div>
|
||||
<div class="line"><a name="l00101"></a><span class="lineno"><a class="line" href="namespaceripple.html#a7c8945b5034bba5f9df719cff2503495"> 101</a></span> <a class="code" href="namespaceripple.html#a7c8945b5034bba5f9df719cff2503495">composed_quality</a>(Quality <span class="keyword">const</span>& lhs, Quality <span class="keyword">const</span>& rhs)</div>
|
||||
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span> {</div>
|
||||
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <a class="code" href="classripple_1_1STAmount.html">STAmount</a> <span class="keyword">const</span> lhs_rate(lhs.rate());</div>
|
||||
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  assert(lhs_rate != beast::zero);</div>
|
||||
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  </div>
|
||||
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <a class="code" href="classripple_1_1STAmount.html">STAmount</a> <span class="keyword">const</span> rhs_rate(rhs.rate());</div>
|
||||
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  assert(rhs_rate != beast::zero);</div>
|
||||
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  </div>
|
||||
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <a class="code" href="classripple_1_1STAmount.html">STAmount</a> <span class="keyword">const</span> rate(<a class="code" href="namespaceripple.html#a7806e73f2a04df365821602cfcf89ff2">mulRound</a>(lhs_rate, rhs_rate, lhs_rate.<a class="code" href="classripple_1_1STAmount.html#a60d8449d2915fa495f12994f56ceca34">issue</a>(), <span class="keyword">true</span>));</div>
|
||||
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  </div>
|
||||
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <a class="code" href="classripple_1_1STAmount.html">STAmount</a> <span class="keyword">const</span> rate (<a class="code" href="namespaceripple.html#a7806e73f2a04df365821602cfcf89ff2">mulRound</a> (</div>
|
||||
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  lhs_rate, rhs_rate, lhs_rate.<a class="code" href="classripple_1_1STAmount.html#a60d8449d2915fa495f12994f56ceca34">issue</a> (), <span class="keyword">true</span>));</div>
|
||||
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <a class="codeRef" href="http://en.cppreference.com/w/cpp/types/integer.html">std::uint64_t</a> <span class="keyword">const</span> stored_exponent(rate.exponent() + 100);</div>
|
||||
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <a class="codeRef" href="http://en.cppreference.com/w/cpp/types/integer.html">std::uint64_t</a> <span class="keyword">const</span> stored_mantissa(rate.mantissa());</div>
|
||||
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  </div>
|
||||
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <a class="codeRef" href="http://en.cppreference.com/w/cpp/types/integer.html">std::uint64_t</a> <span class="keyword">const</span> stored_exponent (rate.exponent () + 100);</div>
|
||||
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <a class="codeRef" href="http://en.cppreference.com/w/cpp/types/integer.html">std::uint64_t</a> <span class="keyword">const</span> stored_mantissa (rate.mantissa());</div>
|
||||
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  </div>
|
||||
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  assert ((stored_exponent > 0) && (stored_exponent <= 255));</div>
|
||||
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  assert((stored_exponent > 0) && (stored_exponent <= 255));</div>
|
||||
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  </div>
|
||||
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keywordflow">return</span> Quality((stored_exponent << (64 - 8)) | stored_mantissa);</div>
|
||||
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span> }</div>
|
||||
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  </div>
|
||||
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <span class="keywordflow">return</span> Quality ((stored_exponent << (64 - 8)) | stored_mantissa);</div>
|
||||
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span> }</div>
|
||||
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  </div>
|
||||
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span> Quality</div>
|
||||
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span> Quality::round (<span class="keywordtype">int</span> digits)<span class="keyword"> const</span></div>
|
||||
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span> <span class="keyword"></span>{</div>
|
||||
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <span class="comment">// Modulus for mantissa</span></div>
|
||||
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="keyword">static</span> <span class="keyword">const</span> <a class="codeRef" href="http://en.cppreference.com/w/cpp/types/integer.html">std::uint64_t</a> mod[17] = {</div>
|
||||
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="comment">/* 0 */</span> 10000000000000000,</div>
|
||||
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="comment">/* 1 */</span> 1000000000000000,</div>
|
||||
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="comment">/* 2 */</span> 100000000000000,</div>
|
||||
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <span class="comment">/* 3 */</span> 10000000000000,</div>
|
||||
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  <span class="comment">/* 4 */</span> 1000000000000,</div>
|
||||
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="comment">/* 5 */</span> 100000000000,</div>
|
||||
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="comment">/* 6 */</span> 10000000000,</div>
|
||||
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <span class="comment">/* 7 */</span> 1000000000,</div>
|
||||
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="comment">/* 8 */</span> 100000000,</div>
|
||||
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  <span class="comment">/* 9 */</span> 10000000,</div>
|
||||
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  <span class="comment">/* 10 */</span> 1000000,</div>
|
||||
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="comment">/* 11 */</span> 100000,</div>
|
||||
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  <span class="comment">/* 12 */</span> 10000,</div>
|
||||
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  <span class="comment">/* 13 */</span> 1000,</div>
|
||||
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  <span class="comment">/* 14 */</span> 100,</div>
|
||||
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  <span class="comment">/* 15 */</span> 10,</div>
|
||||
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <span class="comment">/* 16 */</span> 1,</div>
|
||||
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  };</div>
|
||||
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  </div>
|
||||
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  <span class="keyword">auto</span> exponent = m_value >> (64 - 8);</div>
|
||||
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  <span class="keyword">auto</span> mantissa = m_value & 0x00ffffffffffffffULL;</div>
|
||||
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  mantissa += mod[digits] - 1;</div>
|
||||
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  mantissa -= (mantissa % mod[digits]);</div>
|
||||
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span> Quality</div>
|
||||
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span> Quality::round(<span class="keywordtype">int</span> digits)<span class="keyword"> const</span></div>
|
||||
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span> <span class="keyword"></span>{</div>
|
||||
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  <span class="comment">// Modulus for mantissa</span></div>
|
||||
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="keyword">static</span> <span class="keyword">const</span> <a class="codeRef" href="http://en.cppreference.com/w/cpp/types/integer.html">std::uint64_t</a> mod[17] = {</div>
|
||||
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <span class="comment">/* 0 */</span> 10000000000000000,</div>
|
||||
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <span class="comment">/* 1 */</span> 1000000000000000,</div>
|
||||
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="comment">/* 2 */</span> 100000000000000,</div>
|
||||
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="comment">/* 3 */</span> 10000000000000,</div>
|
||||
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="comment">/* 4 */</span> 1000000000000,</div>
|
||||
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="comment">/* 5 */</span> 100000000000,</div>
|
||||
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <span class="comment">/* 6 */</span> 10000000000,</div>
|
||||
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  <span class="comment">/* 7 */</span> 1000000000,</div>
|
||||
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="comment">/* 8 */</span> 100000000,</div>
|
||||
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="comment">/* 9 */</span> 10000000,</div>
|
||||
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <span class="comment">/* 10 */</span> 1000000,</div>
|
||||
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="comment">/* 11 */</span> 100000,</div>
|
||||
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  <span class="comment">/* 12 */</span> 10000,</div>
|
||||
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  <span class="comment">/* 13 */</span> 1000,</div>
|
||||
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="comment">/* 14 */</span> 100,</div>
|
||||
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  <span class="comment">/* 15 */</span> 10,</div>
|
||||
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  <span class="comment">/* 16 */</span> 1,</div>
|
||||
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  };</div>
|
||||
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  </div>
|
||||
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <span class="keyword">auto</span> exponent = m_value >> (64 - 8);</div>
|
||||
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  <span class="keyword">auto</span> mantissa = m_value & 0x00ffffffffffffffULL;</div>
|
||||
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  mantissa += mod[digits] - 1;</div>
|
||||
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  mantissa -= (mantissa % mod[digits]);</div>
|
||||
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  </div>
|
||||
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  <span class="keywordflow">return</span> Quality{(exponent << (64 - 8)) | mantissa};</div>
|
||||
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span> }</div>
|
||||
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  </div>
|
||||
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  <span class="keywordflow">return</span> Quality{(exponent << (64 - 8)) | mantissa};</div>
|
||||
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span> }</div>
|
||||
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  </div>
|
||||
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span> }</div>
|
||||
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span> } <span class="comment">// namespace ripple</span></div>
|
||||
</div><!-- fragment --></div><!-- contents -->
|
||||
<div class="ttc" id="anamespaceripple_html_a7c8945b5034bba5f9df719cff2503495"><div class="ttname"><a href="namespaceripple.html#a7c8945b5034bba5f9df719cff2503495">ripple::composed_quality</a></div><div class="ttdeci">Quality composed_quality(Quality const &lhs, Quality const &rhs)</div><div class="ttdef"><b>Definition:</b> <a href="Quality_8cpp_source.html#l00103">Quality.cpp:103</a></div></div>
|
||||
<div class="ttc" id="anamespaceripple_html_a7c8945b5034bba5f9df719cff2503495"><div class="ttname"><a href="namespaceripple.html#a7c8945b5034bba5f9df719cff2503495">ripple::composed_quality</a></div><div class="ttdeci">Quality composed_quality(Quality const &lhs, Quality const &rhs)</div><div class="ttdef"><b>Definition:</b> <a href="Quality_8cpp_source.html#l00101">Quality.cpp:101</a></div></div>
|
||||
<div class="ttc" id="anamespaceripple_html_a7cc64e12723fbc9606d85442a2569feda13b5bfe96f3e2fe411c9f66f4a582adf"><div class="ttname"><a href="namespaceripple.html#a7cc64e12723fbc9606d85442a2569feda13b5bfe96f3e2fe411c9f66f4a582adf">ripple::QualityDirection::in</a></div><div class="ttdeci">@ in</div></div>
|
||||
<div class="ttc" id="anamespaceripple_html_a7806e73f2a04df365821602cfcf89ff2"><div class="ttname"><a href="namespaceripple.html#a7806e73f2a04df365821602cfcf89ff2">ripple::mulRound</a></div><div class="ttdeci">STAmount mulRound(STAmount const &v1, STAmount const &v2, Issue const &issue, bool roundUp)</div><div class="ttdef"><b>Definition:</b> <a href="STAmount_8cpp_source.html#l01173">STAmount.cpp:1173</a></div></div>
|
||||
<div class="ttc" id="anamespaceripple_html_a73cc988e7ba5d5ee0fd9db53740917ec"><div class="ttname"><a href="namespaceripple.html#a73cc988e7ba5d5ee0fd9db53740917ec">ripple::getRate</a></div><div class="ttdeci">std::uint64_t getRate(STAmount const &offerOut, STAmount const &offerIn)</div><div class="ttdef"><b>Definition:</b> <a href="STAmount_8cpp_source.html#l00423">STAmount.cpp:423</a></div></div>
|
||||
<div class="ttc" id="anamespaceripple_html_a7806e73f2a04df365821602cfcf89ff2"><div class="ttname"><a href="namespaceripple.html#a7806e73f2a04df365821602cfcf89ff2">ripple::mulRound</a></div><div class="ttdeci">STAmount mulRound(STAmount const &v1, STAmount const &v2, Issue const &issue, bool roundUp)</div><div class="ttdef"><b>Definition:</b> <a href="STAmount_8cpp_source.html#l01199">STAmount.cpp:1199</a></div></div>
|
||||
<div class="ttc" id="anamespaceripple_html_a73cc988e7ba5d5ee0fd9db53740917ec"><div class="ttname"><a href="namespaceripple.html#a73cc988e7ba5d5ee0fd9db53740917ec">ripple::getRate</a></div><div class="ttdeci">std::uint64_t getRate(STAmount const &offerOut, STAmount const &offerIn)</div><div class="ttdef"><b>Definition:</b> <a href="STAmount_8cpp_source.html#l00440">STAmount.cpp:440</a></div></div>
|
||||
<div class="ttc" id="anamespaceripple_html_a7cc64e12723fbc9606d85442a2569fedac68271a63ddbc431c307beb7d2918275"><div class="ttname"><a href="namespaceripple.html#a7cc64e12723fbc9606d85442a2569fedac68271a63ddbc431c307beb7d2918275">ripple::QualityDirection::out</a></div><div class="ttdeci">@ out</div></div>
|
||||
<div class="ttc" id="anamespaceripple_html_a47b15adfd6fb69767c64f50d860a11cc"><div class="ttname"><a href="namespaceripple.html#a47b15adfd6fb69767c64f50d860a11cc">ripple::divRound</a></div><div class="ttdeci">STAmount divRound(STAmount const &num, STAmount const &den, Issue const &issue, bool roundUp)</div><div class="ttdef"><b>Definition:</b> <a href="STAmount_8cpp_source.html#l01257">STAmount.cpp:1257</a></div></div>
|
||||
<div class="ttc" id="anamespaceripple_html_a47b15adfd6fb69767c64f50d860a11cc"><div class="ttname"><a href="namespaceripple.html#a47b15adfd6fb69767c64f50d860a11cc">ripple::divRound</a></div><div class="ttdeci">STAmount divRound(STAmount const &num, STAmount const &den, Issue const &issue, bool roundUp)</div><div class="ttdef"><b>Definition:</b> <a href="STAmount_8cpp_source.html#l01285">STAmount.cpp:1285</a></div></div>
|
||||
<div class="ttc" id="aclassripple_1_1STAmount_html"><div class="ttname"><a href="classripple_1_1STAmount.html">ripple::STAmount</a></div><div class="ttdef"><b>Definition:</b> <a href="STAmount_8h_source.html#l00042">STAmount.h:42</a></div></div>
|
||||
<div class="ttc" id="ainteger_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/types/integer.html">std::uint64_t</a></div></div>
|
||||
<div class="ttc" id="anamespaceripple_html"><div class="ttname"><a href="namespaceripple.html">ripple</a></div><div class="ttdoc">Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.</div><div class="ttdef"><b>Definition:</b> <a href="RCLCensorshipDetector_8h_source.html#l00029">RCLCensorshipDetector.h:29</a></div></div>
|
||||
<div class="ttc" id="alimits_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/header/limits.html">limits</a></div></div>
|
||||
<div class="ttc" id="aclassripple_1_1STAmount_html_a60d8449d2915fa495f12994f56ceca34"><div class="ttname"><a href="classripple_1_1STAmount.html#a60d8449d2915fa495f12994f56ceca34">ripple::STAmount::issue</a></div><div class="ttdeci">Issue const & issue() const</div><div class="ttdef"><b>Definition:</b> <a href="STAmount_8h_source.html#l00156">STAmount.h:156</a></div></div>
|
||||
<div class="ttc" id="aclassripple_1_1STAmount_html_a60d8449d2915fa495f12994f56ceca34"><div class="ttname"><a href="classripple_1_1STAmount.html#a60d8449d2915fa495f12994f56ceca34">ripple::STAmount::issue</a></div><div class="ttdeci">Issue const & issue() const</div><div class="ttdef"><b>Definition:</b> <a href="STAmount_8h_source.html#l00197">STAmount.h:197</a></div></div>
|
||||
<div class="ttc" id="acassert_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/header/cassert.html">cassert</a></div></div>
|
||||
<div class="ttc" id="aprev_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/iterator/prev.html">std::prev</a></div><div class="ttdeci">T prev(T... args)</div></div>
|
||||
<div class="ttc" id="anumeric_limits_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/types/numeric_limits.html">std::numeric_limits</a></div></div>
|
||||
|
||||
Reference in New Issue
Block a user