/src/Thirdparty/boost.xint/libs/xint/doc/integer_8hpp_source.html
HTML | 1971 lines | 1970 code | 0 blank | 1 comment | 0 complexity | 6b8aa29e3c5a588bd16b8126dc006a39 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
- <title>The Extended Integer (XInt) Library: integer.hpp Source File</title>
- <link href="tabs.css" rel="stylesheet" type="text/css"/>
- <link href="doxygen.css" rel="stylesheet" type="text/css"/>
- </head>
- <body>
- <!-- Generated by Doxygen 1.7.1 -->
- <div class="navigation" id="top">
- <div class="tabs">
- <ul class="tablist">
- <li><a href="index.html"><span>Main Page</span></a></li>
- <li><a href="namespaces.html"><span>Namespaces</span></a></li>
- <li><a href="annotated.html"><span>Classes</span></a></li>
- <li class="current"><a href="files.html"><span>Files</span></a></li>
- </ul>
- </div>
- <div class="tabs2">
- <ul class="tablist">
- <li><a href="files.html"><span>File List</span></a></li>
- <li><a href="globals.html"><span>File Members</span></a></li>
- </ul>
- </div>
- <div class="header">
- <div class="headertitle">
- <h1>integer.hpp</h1> </div>
- </div>
- <div class="contents">
- <a href="integer_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
- <a name="l00002"></a>00002 <span class="comment">/*</span>
- <a name="l00003"></a>00003 <span class="comment"> The Extended Integer (XInt) Library</span>
- <a name="l00004"></a>00004 <span class="comment"> A fast, portable C++ library for multi-precision integer math</span>
- <a name="l00005"></a>00005 <span class="comment"> Copyright 2010 by Chad Nelson</span>
- <a name="l00006"></a>00006 <span class="comment"></span>
- <a name="l00007"></a>00007 <span class="comment"> Distributed under the Boost Software License, Version 1.0.</span>
- <a name="l00008"></a>00008 <span class="comment"> See accompanying file LICENSE_1_0.txt or copy at</span>
- <a name="l00009"></a>00009 <span class="comment"> http://www.boost.org/LICENSE_1_0.txt</span>
- <a name="l00010"></a>00010 <span class="comment"></span>
- <a name="l00011"></a>00011 <span class="comment"> See http://www.boost.org/libs/xint for library home page.</span>
- <a name="l00012"></a>00012 <span class="comment">*/</span>
- <a name="l00013"></a>00013
- <a name="l00018"></a>00018 <span class="preprocessor">#ifndef BOOST_INCLUDED_XINT_INTEGER_HPP</span>
- <a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#define BOOST_INCLUDED_XINT_INTEGER_HPP</span>
- <a name="l00020"></a>00020 <span class="preprocessor"></span>
- <a name="l00021"></a>00021 <span class="preprocessor">#ifdef _MSC_VER</span>
- <a name="l00022"></a>00022 <span class="preprocessor"></span> <span class="comment">// C4127, "conditional expression is constant". Unfortunately the policy-</span>
- <a name="l00023"></a>00023 <span class="comment">// based design of this library triggers a lot of these, even though the</span>
- <a name="l00024"></a>00024 <span class="comment">// code is correct as written.</span>
- <a name="l00025"></a>00025 <span class="preprocessor"> #pragma warning(push)</span>
- <a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor"> #pragma warning(disable: 4127)</span>
- <a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
- <a name="l00028"></a>00028 <span class="preprocessor"></span>
- <a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="internals_8hpp.html" title="Contains the internal definitions required for all XInt types.">detail/internals.hpp</a>"</span>
- <a name="l00030"></a>00030 <span class="preprocessor">#include "<a class="code" href="random_8hpp.html" title="Declares items relating to random numbers.">random.hpp</a>"</span>
- <a name="l00031"></a>00031
- <a name="l00032"></a>00032 <span class="keyword">namespace </span>boost {
- <a name="l00033"></a>00033 <span class="keyword">namespace </span>xint {
- <a name="l00034"></a>00034
- <a name="l00079"></a>00079 <span class="keyword">template</span><BOOST_XINT_INITIAL_APARAMS>
- <a name="l00080"></a>00080 <span class="keyword">class </span>integer_t: <span class="keyword">virtual</span> <span class="keyword">public</span> detail::integer_t_data<BOOST_XINT_APARAMS>,
- <a name="l00081"></a>00081 <span class="keyword">public</span> detail::nan_functions<detail::integer_t_data<BOOST_XINT_APARAMS>::
- <a name="l00082"></a>00082 NothrowType::value, integer_t<BOOST_XINT_APARAMS>, BOOST_XINT_APARAMS>,
- <a name="l00083"></a>00083 <span class="keyword">public</span> detail::fixed_functions<detail::integer_t_data<BOOST_XINT_APARAMS>::
- <a name="l00084"></a>00084 BitsType::value, integer_t<BOOST_XINT_APARAMS>, BOOST_XINT_APARAMS>, <span class="keyword">public</span>
- <a name="l00085"></a>00085 detail::unsigned_negative_functions<detail::integer_t_data<
- <a name="l00086"></a>00086 BOOST_XINT_APARAMS>::SignType::value, BOOST_XINT_APARAMS>
- <a name="l00087"></a>00087 {
- <a name="l00088"></a>00088 <span class="keyword">typedef</span> <span class="keyword">typename</span> detail::integer_t_data<BOOST_XINT_APARAMS>::BitsType
- <a name="l00089"></a>00089 BitsType;
- <a name="l00090"></a>00090 <span class="keyword">typedef</span> <span class="keyword">typename</span> detail::integer_t_data<BOOST_XINT_APARAMS>::SecureType
- <a name="l00091"></a>00091 SecureType;
- <a name="l00092"></a>00092 <span class="keyword">typedef</span> <span class="keyword">typename</span> detail::integer_t_data<BOOST_XINT_APARAMS>::SignType
- <a name="l00093"></a>00093 SignType;
- <a name="l00094"></a>00094 <span class="keyword">typedef</span> <span class="keyword">typename</span> detail::integer_t_data<BOOST_XINT_APARAMS>::Alloc Alloc;
- <a name="l00095"></a>00095
- <a name="l00096"></a>00096 <span class="keyword">public</span>:
- <a name="l00097"></a>00097 <span class="preprocessor"> #ifndef BOOST_XINT_DOXYGEN_IGNORE</span>
- <a name="l00098"></a>00098 <span class="preprocessor"></span> <span class="keyword">typedef</span> integer_t<BOOST_XINT_APARAMS> type;
- <a name="l00099"></a>00099 <span class="keyword">typedef</span> void (integer_t<BOOST_XINT_APARAMS>::*safe_bool_type)() <span class="keyword">const</span>;
- <a name="l00100"></a><a class="code" href="classboost_1_1xint_1_1integer__t.html#aa596f21475c016ead49722d887a97ab4">00100</a> <span class="keywordtype">void</span> this_is_a_safe_bool_type()<span class="keyword"> const </span>{ }
- <a name="l00101"></a>00101
- <a name="l00102"></a><a class="code" href="classboost_1_1xint_1_1integer__t.html#a130f5eeae0a95847b7bb5cb56e443480">00102</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> detail::integer_t_data<BOOST_XINT_APARAMS>::datatype
- <a name="l00103"></a>00103 datatype;
- <a name="l00104"></a>00104
- <a name="l00105"></a><a class="code" href="classboost_1_1xint_1_1integer__t.html#abe691a26ef01695197d98d01822ea764">00105</a> <span class="keyword">using</span> detail::integer_t_data<BOOST_XINT_APARAMS>::Threadsafe;
- <a name="l00106"></a>00106 <span class="keyword">using</span> detail::integer_t_data<BOOST_XINT_APARAMS>::Nothrow;
- <a name="l00107"></a><a class="code" href="classboost_1_1xint_1_1integer__t.html#ac15850352ec856e1a380209214cf8563">00107</a> <span class="keyword">using</span> detail::integer_t_data<BOOST_XINT_APARAMS>::Signed;
- <a name="l00108"></a>00108
- <a name="l00109"></a><a class="code" href="classboost_1_1xint_1_1integer__t.html#aa7bc0f108496999a375d55ad26e40dcf">00109</a> <span class="keyword">using</span> detail::integer_t_data<BOOST_XINT_APARAMS>::data;
- <a name="l00110"></a><a class="code" href="classboost_1_1xint_1_1integer__t.html#a9754bfd54c9e30e071b0e5bc1b099f8b">00110</a> <span class="keyword">using</span> detail::integer_t_data<BOOST_XINT_APARAMS>::_data;
- <a name="l00111"></a>00111
- <a name="l00112"></a>00112 <span class="keyword">using</span> detail::nan_functions<detail::integer_t_data<
- <a name="l00113"></a>00113 <a class="code" href="options_8hpp.html#aa350afa46bc87068c0cefb1925130b6c">BOOST_XINT_APARAMS</a>>::NothrowType::value, <a class="code" href="classboost_1_1xint_1_1integer__t.html" title="The integer_t class template.">integer_t</a><
- <a name="l00114"></a>00114 <a class="code" href="options_8hpp.html#aa350afa46bc87068c0cefb1925130b6c">BOOST_XINT_APARAMS</a>>, <a class="code" href="options_8hpp.html#aa350afa46bc87068c0cefb1925130b6c">BOOST_XINT_APARAMS</a>>::is_nan;
- <a name="l00115"></a>00115
- <a name="l00116"></a>00116 <span class="keyword">using</span> detail::unsigned_negative_functions<detail::integer_t_data<
- <a name="l00117"></a>00117 <a class="code" href="options_8hpp.html#aa350afa46bc87068c0cefb1925130b6c">BOOST_XINT_APARAMS</a>>::SignType::value, <a class="code" href="options_8hpp.html#aa350afa46bc87068c0cefb1925130b6c">BOOST_XINT_APARAMS</a>>::
- <a name="l00118"></a>00118 _fix_negative_unsigned;
- <a name="l00119"></a>00119 <span class="preprocessor"> #endif // BOOST_XINT_DOXYGEN_IGNORE</span>
- <a name="l00120"></a>00120 <span class="preprocessor"></span>
- <a name="l00123"></a>00123 <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t</a>();
- <a name="l00124"></a>00124 <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t</a>(<span class="keyword">const</span> <a class="code" href="classboost_1_1xint_1_1integer__t.html" title="The integer_t class template.">integer_t<BOOST_XINT_APARAMS></a> &b, <span class="keywordtype">bool</span> force_thread_safety =
- <a name="l00125"></a>00125 <span class="keyword">false</span>);
- <a name="l00127"></a>00127 <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t</a>(<a class="code" href="basic__types__and__includes_8hpp.html#a0533c283bce9e4d9468ea9b3a5ab509b">BOOST_XINT_RV_REF</a>(type) i) { _swap(i); }
- <a name="l00128"></a>00128 <span class="keyword">template</span> <<span class="keyword">typename</span> <span class="keywordtype">char</span>T>
- <a name="l00129"></a>00129 <span class="keyword">explicit</span> <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t</a>(<span class="keyword">const</span> charT *str, std::size_t base = 10);
- <a name="l00130"></a>00130 <span class="keyword">template</span> <<span class="keyword">typename</span> <span class="keywordtype">char</span>T>
- <a name="l00131"></a>00131 <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t</a>(<span class="keyword">const</span> charT *str, <span class="keyword">const</span> charT *&endptr, std::size_t base = 10);
- <a name="l00132"></a>00132 <span class="keyword">template</span> <<span class="keyword">typename</span> <span class="keywordtype">char</span>T, <span class="keyword">typename</span> traitsT, <span class="keyword">typename</span> allocT>
- <a name="l00133"></a>00133 <span class="keyword">explicit</span> <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t</a>(<span class="keyword">const</span> std::basic_string<charT, traitsT, allocT> &str,
- <a name="l00134"></a>00134 std::size_t base = 10);
- <a name="l00135"></a>00135 <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t</a>(<span class="keyword">const</span> <a class="code" href="namespaceboost_1_1xint.html#aae3128529370506165793f2771834e58" title="The format for the binary representations of integers.">xint::binary_t</a> &b, <a class="code" href="namespaceboost_1_1xint.html#ae9f6d103df04ad19a841ed3f8b94a764" title="This makes it easier to tell when an item is measured in bits.">bitsize_t</a> bits = 0);
- <a name="l00136"></a>00136 <span class="keyword">template</span> <BOOST_XINT_CLASS_BPARAMS> <span class="keyword">explicit</span> <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t</a>(<span class="keyword">const</span>
- <a name="l00137"></a>00137 <a class="code" href="classboost_1_1xint_1_1integer__t.html" title="The integer_t class template.">integer_t<BOOST_XINT_BPARAMS></a> &other, <span class="keywordtype">bool</span> force_thread_safety = <span class="keyword">false</span>);
- <a name="l00138"></a>00138 <span class="keyword">template</span> <<span class="keyword">typename</span> Type> <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t</a>(<span class="keyword">const</span> Type n, <span class="keyword">typename</span>
- <a name="l00139"></a>00139 boost::enable_if<boost::is_integral<Type> >::type* = 0);
- <a name="l00140"></a>00140
- <a name="l00141"></a>00141 <span class="preprocessor"> #ifndef BOOST_XINT_DOXYGEN_IGNORE</span>
- <a name="l00142"></a>00142 <span class="preprocessor"></span>
- <a name="l00143"></a>00143 <span class="keyword">explicit</span> <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t</a>(<span class="keyword">const</span> detail::raw_integer_t<BitsType::value,
- <a name="l00144"></a>00144 SecureType::value, Alloc> &c):
- <a name="l00145"></a>00145 detail::integer_t_data<<a class="code" href="options_8hpp.html#aa350afa46bc87068c0cefb1925130b6c">BOOST_XINT_APARAMS</a>>(c) { <span class="keywordflow">if</span> (Threadsafe == <span class="keyword">true</span>)
- <a name="l00146"></a>00146 _data().make_unique(); }
- <a name="l00147"></a>00147 <span class="preprocessor"> #endif // BOOST_XINT_DOXYGEN_IGNORE</span>
- <a name="l00148"></a>00148 <span class="preprocessor"></span>
- <a name="l00149"></a>00149
- <a name="l00155"></a>00155 integer_t<BOOST_XINT_APARAMS>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#a7388d85a6b1509c214b981bc730f7c7f">operator=</a>(<a class="code" href="basic__types__and__includes_8hpp.html#a8177a6a6c68ea042f7e644d8ef7128f9">BOOST_XINT_COPY_ASSIGN_REF</a>(type)
- <a name="l00156"></a><a class="code" href="classboost_1_1xint_1_1integer__t.html#ab7a2481c7347c73bd927286879404bba">00156</a> c);
- <a name="l00157"></a>00157 <a class="code" href="classboost_1_1xint_1_1integer__t.html" title="The integer_t class template.">integer_t<BOOST_XINT_APARAMS></a>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#a7388d85a6b1509c214b981bc730f7c7f">operator=</a>(<a class="code" href="basic__types__and__includes_8hpp.html#a0533c283bce9e4d9468ea9b3a5ab509b">BOOST_XINT_RV_REF</a>(type) c) {
- <a name="l00158"></a>00158 _swap(c); <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
- <a name="l00159"></a>00159 <span class="keyword">template</span> <<span class="keyword">typename</span> Type> <a class="code" href="classboost_1_1xint_1_1integer__t.html" title="The integer_t class template.">integer_t<BOOST_XINT_APARAMS></a>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#a7388d85a6b1509c214b981bc730f7c7f">operator=</a>(<span class="keyword">const</span> Type
- <a name="l00160"></a>00160 n) { <a class="code" href="classboost_1_1xint_1_1integer__t.html" title="The integer_t class template.">integer_t<BOOST_XINT_APARAMS></a> nn(n); _swap(nn); <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
- <a name="l00161"></a>00161
- <a name="l00162"></a>00162 <a class="code" href="classboost_1_1xint_1_1integer__t.html#abe691a26ef01695197d98d01822ea764">operator safe_bool_type</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (data.is_zero() ? 0 :
- <a name="l00163"></a>00163 &integer_t<BOOST_XINT_APARAMS>::this_is_a_safe_bool_type); }
- <a name="l00164"></a>00164 <span class="keywordtype">bool</span> <a class="code" href="classboost_1_1xint_1_1integer__t.html#ac15850352ec856e1a380209214cf8563">operator!</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data.is_zero(); }
- <a name="l00165"></a>00165 integer_t<BOOST_XINT_APARAMS> <a class="code" href="classboost_1_1xint_1_1integer__t.html#a31ef623fef7944861c458bcd2c9b0001" title="Return the additive inverse of an integer.">operator-</a>() <span class="keyword">const</span>;
- <a name="l00166"></a>00166 integer_t<BOOST_XINT_APARAMS>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#aa7bc0f108496999a375d55ad26e40dcf">operator+</a>() { <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
- <a name="l00167"></a>00167 <span class="keyword">const</span> integer_t<BOOST_XINT_APARAMS>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#aa7bc0f108496999a375d55ad26e40dcf">operator+</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
- <a name="l00168"></a>00168
- <a name="l00169"></a>00169 <span class="preprocessor"> #ifdef BOOST_XINT_DOXYGEN_IGNORE // inherited, only here for doxygen</span>
- <a name="l00170"></a>00170 <span class="preprocessor"></span> integer_t<BOOST_XINT_APARAMS> <a class="code" href="classboost_1_1xint_1_1integer__t.html#ad200ae35a1bb12061b9a230f9e42550d" title="The Bitwise Ones Complement (i.e. bitwise NOT) operator.">operator~</a>() <span class="keyword">const</span>;
- <a name="l00171"></a>00171 <span class="preprocessor"> #endif</span>
- <a name="l00172"></a>00172 <span class="preprocessor"></span>
- <a name="l00173"></a>00173 integer_t<BOOST_XINT_APARAMS>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#a117a5f7325a2f1a77b0d5dd31fd920c6">operator+=</a>(<span class="keyword">const</span>
- <a name="l00174"></a>00174 integer_t<BOOST_XINT_APARAMS> &b);
- <a name="l00175"></a>00175 integer_t<BOOST_XINT_APARAMS>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#a67009eed89894e082b609b0890e371cd">operator-=</a>(<span class="keyword">const</span>
- <a name="l00176"></a>00176 integer_t<BOOST_XINT_APARAMS> &b);
- <a name="l00177"></a>00177 integer_t<BOOST_XINT_APARAMS>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#a1932ceee3f8344c15059732250bac0df">operator*=</a>(<span class="keyword">const</span>
- <a name="l00178"></a>00178 integer_t<BOOST_XINT_APARAMS> &b);
- <a name="l00179"></a>00179 integer_t<BOOST_XINT_APARAMS>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#a582f45204112c860bd4884fa51c25aad">operator/=</a>(<span class="keyword">const</span>
- <a name="l00180"></a>00180 integer_t<BOOST_XINT_APARAMS> &b);
- <a name="l00181"></a>00181 integer_t<BOOST_XINT_APARAMS>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#ac05bea273dfad811ba2addd164d1042b">operator%=</a>(<span class="keyword">const</span>
- <a name="l00182"></a>00182 integer_t<BOOST_XINT_APARAMS> &b);
- <a name="l00183"></a>00183
- <a name="l00184"></a>00184 integer_t<BOOST_XINT_APARAMS>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#a719c2966d9e29521eb95863eaa2ec570">operator++</a>();
- <a name="l00185"></a>00185 integer_t<BOOST_XINT_APARAMS>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#abdbcf3ae2ff508e5fc9467b85f9e917c">operator--</a>();
- <a name="l00186"></a>00186 integer_t<BOOST_XINT_APARAMS> <a class="code" href="classboost_1_1xint_1_1integer__t.html#a719c2966d9e29521eb95863eaa2ec570">operator++</a>(<span class="keywordtype">int</span>);
- <a name="l00187"></a>00187 integer_t<BOOST_XINT_APARAMS> <a class="code" href="classboost_1_1xint_1_1integer__t.html#abdbcf3ae2ff508e5fc9467b85f9e917c">operator--</a>(<span class="keywordtype">int</span>);
- <a name="l00188"></a>00188
- <a name="l00189"></a>00189 integer_t<BOOST_XINT_APARAMS>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#a395d69ce8b4a4fa5e8967f3b658de8ea">operator&=</a>(<span class="keyword">const</span>
- <a name="l00190"></a>00190 integer_t<BOOST_XINT_APARAMS> &n);
- <a name="l00191"></a>00191 integer_t<BOOST_XINT_APARAMS>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#a7a92ce81071327d56d0c21a6b37f62d9">operator|=</a>(<span class="keyword">const</span>
- <a name="l00192"></a>00192 integer_t<BOOST_XINT_APARAMS> &n);
- <a name="l00193"></a>00193 integer_t<BOOST_XINT_APARAMS>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#a194e4dbdffddde2704de6267f271f53a">operator^=</a>(<span class="keyword">const</span>
- <a name="l00194"></a>00194 integer_t<BOOST_XINT_APARAMS> &n);
- <a name="l00195"></a>00195 integer_t<BOOST_XINT_APARAMS> <a class="code" href="classboost_1_1xint_1_1integer__t.html#aee68d28e7f5803902ad153dbfab2e8ad" title="Left-shift an integer by a specified number of bits.">operator<<</a>(<a class="code" href="namespaceboost_1_1xint.html#ae9f6d103df04ad19a841ed3f8b94a764" title="This makes it easier to tell when an item is measured in bits.">bitsize_t</a> shift) <span class="keyword">const</span>;
- <a name="l00196"></a>00196 integer_t<BOOST_XINT_APARAMS> <a class="code" href="classboost_1_1xint_1_1integer__t.html#afe9a935bb9de506b29f043b439a196ae" title="Right-shift an integer by a specified number of bits.">operator>></a>(<a class="code" href="namespaceboost_1_1xint.html#ae9f6d103df04ad19a841ed3f8b94a764" title="This makes it easier to tell when an item is measured in bits.">bitsize_t</a> shift) <span class="keyword">const</span>;
- <a name="l00197"></a>00197 integer_t<BOOST_XINT_APARAMS>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#a516ce52ae1a8332a1de8711baaea0943">operator<<=</a>(<a class="code" href="namespaceboost_1_1xint.html#ae9f6d103df04ad19a841ed3f8b94a764" title="This makes it easier to tell when an item is measured in bits.">bitsize_t</a> shift);
- <a name="l00198"></a>00198 integer_t<BOOST_XINT_APARAMS>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#aa67123e331f61cd7c54e6fb84e09609f">operator>>=</a>(<a class="code" href="namespaceboost_1_1xint.html#ae9f6d103df04ad19a841ed3f8b94a764" title="This makes it easier to tell when an item is measured in bits.">bitsize_t</a> shift);
- <a name="l00200"></a>00200
- <a name="l00203"></a>00203 <span class="keywordtype">bool</span> <a class="code" href="classboost_1_1xint_1_1integer__t.html#a28c1cf2549da47e36ada1e3a2a020654" title="Tests the lowest bit of *this to determine oddness.">is_odd</a>() <span class="keyword">const</span>;
- <a name="l00204"></a>00204 <span class="keywordtype">bool</span> <a class="code" href="classboost_1_1xint_1_1integer__t.html#af7d57cc73521c4d72bc853435127b790" title="Tests the lowest bit of *this to determine evenness.">is_even</a>() <span class="keyword">const</span>;
- <a name="l00205"></a>00205 <span class="keywordtype">int</span> <a class="code" href="classboost_1_1xint_1_1integer__t.html#aa278c48753019fe3deaa623eecdb16b3" title="Tests the sign of *this.">sign</a>(<span class="keywordtype">bool</span> signed_zero = <span class="keyword">false</span>) <span class="keyword">const</span>;
- <a name="l00206"></a>00206 std::size_t <a class="code" href="classboost_1_1xint_1_1integer__t.html#a6575f1fd58be6bf73145459b4b46afbb" title="Tells you roughly how large *this is.">hex_digits</a>() <span class="keyword">const</span>;
- <a name="l00207"></a>00207
- <a name="l00208"></a>00208 <span class="preprocessor"> #ifdef BOOST_XINT_DOXYGEN_IGNORE // inherited, only here for doxygen</span>
- <a name="l00209"></a>00209 <span class="preprocessor"></span> <span class="keywordtype">bool</span> <a class="code" href="classboost_1_1xint_1_1integer__t.html#a9afdf728b490f4fea0f6bd4805e96bd5" title="Tests whether the object is a Not-a-Number.">is_nan</a>() <span class="keyword">const</span>;
- <a name="l00210"></a>00210 <span class="preprocessor"> #endif</span>
- <a name="l00211"></a>00211 <span class="preprocessor"></span>
- <a name="l00212"></a>00212
- <a name="l00213"></a>00213 <span class="keyword">typedef</span> base_divide_t<integer_t<BOOST_XINT_APARAMS> > divide_t;
- <a name="l00214"></a>00214
- <a name="l00222"></a>00222
- <a name="l00223"></a>00223 <span class="keyword">static</span> integer_t<BOOST_XINT_APARAMS> <a class="code" href="classboost_1_1xint_1_1integer__t.html#a22a32f5e1926ced95b9400e87dfe9349" title="Calculate the value of 2e">pow2</a>(std::size_t exponent);
- <a name="l00224"></a>00224 <span class="keyword">static</span> integer_t<BOOST_XINT_APARAMS> <a class="code" href="classboost_1_1xint_1_1integer__t.html#a16b836e12f76f2560ee697fb399dbc2e" title="Calculate the value of n! ">factorial</a>(std::size_t n);
- <a name="l00225"></a>00225
- <a name="l00226"></a>00226 <span class="preprocessor"> #ifdef BOOST_XINT_DOXYGEN_IGNORE // inherited, only here for doxygen</span>
- <a name="l00227"></a>00227 <span class="preprocessor"></span> <span class="keyword">static</span> integer_t<BOOST_XINT_APARAMS> <a class="code" href="classboost_1_1xint_1_1integer__t.html#a26cf36c3ec3664dc91b8aaa86748247d" title="Returns a Not-a-Number value, for types that support it.">nan</a>();
- <a name="l00228"></a>00228 <span class="preprocessor"> #endif</span>
- <a name="l00229"></a>00229 <span class="preprocessor"></span>
- <a name="l00230"></a>00230 <span class="keyword">template</span> <<span class="keyword">class</span> Type> <span class="keyword">static</span> integer_t<BOOST_XINT_APARAMS>
- <a name="l00231"></a>00231 <a class="code" href="classboost_1_1xint_1_1integer__t.html#a1d7c4d0ae13e84bbac07e6c6eb01334e" title="Generates a random integer with specific attributes.">random_by_size</a>(Type &gen, <a class="code" href="namespaceboost_1_1xint.html#ae9f6d103df04ad19a841ed3f8b94a764" title="This makes it easier to tell when an item is measured in bits.">bitsize_t</a> size_in_bits, <span class="keywordtype">bool</span> high_bit_on =
- <a name="l00232"></a>00232 <span class="keyword">false</span>, <span class="keywordtype">bool</span> low_bit_on = <span class="keyword">false</span>, <span class="keywordtype">bool</span> can_be_negative = <span class="keyword">false</span>);
- <a name="l00233"></a>00233 <span class="keyword">template</span> <<span class="keyword">class</span> Type> <span class="keyword">static</span> integer_t<BOOST_XINT_APARAMS>
- <a name="l00234"></a>00234 <a class="code" href="classboost_1_1xint_1_1integer__t.html#afbbf1fba0d65e5348b1771003ba40ae1" title="Generate a randomly-generated prime number of a particular bit-size.">random_prime</a>(Type &gen, <a class="code" href="namespaceboost_1_1xint.html#ae9f6d103df04ad19a841ed3f8b94a764" title="This makes it easier to tell when an item is measured in bits.">bitsize_t</a> size_in_bits, <a class="code" href="namespaceboost_1_1xint.html#a48deb76c9c428a4b3a50177b1b0cb547" title="A callback function takes no parameters and returns a bool.">callback_t</a> callback =
- <a name="l00235"></a>00235 <a class="code" href="namespaceboost_1_1xint.html#a758d415a476a5eeed28dc6b5869b1696" title="An empty callback_t, used as a default parameter for some functions.">no_callback</a>);
- <a name="l00237"></a>00237
- <a name="l00238"></a>00238 <span class="preprocessor"> #ifndef BOOST_XINT_DOXYGEN_IGNORE</span>
- <a name="l00239"></a>00239 <span class="preprocessor"></span>
- <a name="l00240"></a>00240
- <a name="l00241"></a>00241 <span class="keywordtype">void</span> _swap(integer_t<BOOST_XINT_APARAMS> &s) { <span class="keyword">using</span> std::swap;
- <a name="l00242"></a>00242 <a class="code" href="namespaceboost_1_1xint.html#aecbaaf9b2c679d8b6f220224a6bab8dc">swap</a>(data, s.data); }
- <a name="l00244"></a>00244 <span class="preprocessor"> #endif</span>
- <a name="l00245"></a>00245 <span class="preprocessor"></span>
- <a name="l00246"></a>00246 <span class="keyword">private</span>:
- <a name="l00247"></a>00247 <a class="code" href="basic__types__and__includes_8hpp.html#a5f5634ec80010f0f87b93320fa3419f9">BOOST_XINT_COPYABLE_AND_MOVABLE</a>(type)
- <a name="l00248"></a>00248 };
- <a name="l00249"></a>00249
- <a name="l00251"></a>00251 <span class="comment">// Member function template definitions</span>
- <a name="l00252"></a><a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb">00252</a>
- <a name="l00254"></a>00254 <span class="keyword">template</span><BOOST_XINT_CLASS_APARAMS>
- <a name="l00255"></a>00255 <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t<BOOST_XINT_APARAMS>::integer_t</a>() {
- <a name="l00256"></a>00256 <span class="comment">// Don't need to do anything, already preinitialized to zero.</span>
- <a name="l00257"></a>00257 }
- <a name="l00258"></a>00258
- <a name="l00269"></a>00269 <span class="keyword">template</span><BOOST_XINT_CLASS_APARAMS>
- <a name="l00270"></a>00270 <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t<BOOST_XINT_APARAMS>::integer_t</a>(<span class="keyword">const</span> <a class="code" href="classboost_1_1xint_1_1integer__t.html" title="The integer_t class template.">integer_t<BOOST_XINT_APARAMS></a> &i,
- <a name="l00271"></a>00271 <span class="keywordtype">bool</span> force_thread_safety)
- <a name="l00272"></a>00272 {
- <a name="l00273"></a>00273 <span class="keywordflow">if</span> (Nothrow) {
- <a name="l00274"></a>00274 <a class="code" href="internals_8hpp.html#a693c4f473d303c632864f6084c394f03">BOOST_XINT_TRY</a> {
- <a name="l00275"></a>00275 data = i.data;
- <a name="l00276"></a>00276 <span class="keywordflow">if</span> (!data.is_nan()) {
- <a name="l00277"></a>00277 <span class="keywordflow">if</span> (force_thread_safety || Threadsafe == <span class="keyword">true</span>)
- <a name="l00278"></a>00278 data.make_unique();
- <a name="l00279"></a>00279 }
- <a name="l00280"></a>00280 } <a class="code" href="internals_8hpp.html#a5117d87820df153f9c26dd5ff8ac318a">BOOST_XINT_CATCH</a> {
- <a name="l00281"></a>00281 data.make_nan();
- <a name="l00282"></a>00282 }
- <a name="l00283"></a>00283 } <span class="keywordflow">else</span> {
- <a name="l00284"></a>00284 data = i.data;
- <a name="l00285"></a>00285 <span class="keywordflow">if</span> (force_thread_safety || Threadsafe == <span class="keyword">true</span>) data.make_unique();
- <a name="l00286"></a>00286 }
- <a name="l00287"></a>00287 }
- <a name="l00288"></a>00288
- <a name="l00290"></a>00290 <span class="keyword">template</span><BOOST_XINT_CLASS_APARAMS>
- <a name="l00291"></a>00291 <span class="keyword">template</span> <<span class="keyword">typename</span> <span class="keywordtype">char</span>T>
- <a name="l00292"></a>00292 <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t<BOOST_XINT_APARAMS>::integer_t</a>(<span class="keyword">const</span> charT *str, std::size_t base) {
- <a name="l00293"></a>00293 <span class="keywordflow">if</span> (Nothrow) {
- <a name="l00294"></a>00294 <a class="code" href="internals_8hpp.html#a693c4f473d303c632864f6084c394f03">BOOST_XINT_TRY</a> {
- <a name="l00295"></a>00295 <span class="keyword">const</span> std::basic_string<charT> &tnan = detail::nan_text<charT>();
- <a name="l00296"></a>00296 <span class="keywordflow">if</span> (str[0] == tnan[0] && std::basic_string<charT>(str) == tnan) {
- <a name="l00297"></a>00297 data.make_nan();
- <a name="l00298"></a>00298 } <span class="keywordflow">else</span> {
- <a name="l00299"></a>00299 data.from_string(str, base);
- <a name="l00300"></a>00300 <span class="keywordflow">if</span> (!Signed && data.negative) _fix_negative_unsigned();
- <a name="l00301"></a>00301 }
- <a name="l00302"></a>00302 } <a class="code" href="internals_8hpp.html#a5117d87820df153f9c26dd5ff8ac318a">BOOST_XINT_CATCH</a> {
- <a name="l00303"></a>00303 data.make_nan();
- <a name="l00304"></a>00304 }
- <a name="l00305"></a>00305 } <span class="keywordflow">else</span> {
- <a name="l00306"></a>00306 data.from_string(str, base);
- <a name="l00307"></a>00307 <span class="keywordflow">if</span> (!Signed && data.negative) _fix_negative_unsigned();
- <a name="l00308"></a>00308 }
- <a name="l00309"></a>00309 }
- <a name="l00310"></a>00310
- <a name="l00339"></a>00339 <span class="keyword">template</span><BOOST_XINT_CLASS_APARAMS>
- <a name="l00340"></a>00340 <span class="keyword">template</span> <<span class="keyword">typename</span> <span class="keywordtype">char</span>T>
- <a name="l00341"></a>00341 <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t<BOOST_XINT_APARAMS>::integer_t</a>(<span class="keyword">const</span> charT *str, <span class="keyword">const</span> charT *&endptr,
- <a name="l00342"></a>00342 std::size_t base)
- <a name="l00343"></a>00343 {
- <a name="l00344"></a>00344 <span class="keywordflow">if</span> (Nothrow) {
- <a name="l00345"></a>00345 <a class="code" href="internals_8hpp.html#a693c4f473d303c632864f6084c394f03">BOOST_XINT_TRY</a> {
- <a name="l00346"></a>00346 <span class="keyword">const</span> std::basic_string<charT> &tnan = detail::nan_text<charT>();
- <a name="l00347"></a>00347 <span class="keywordflow">if</span> (str[0] == tnan[0]) {
- <a name="l00348"></a>00348 std::basic_string<charT> s(str);
- <a name="l00349"></a>00349 <span class="keywordflow">if</span> (s.substr(0, tnan.length()) == tnan) {
- <a name="l00350"></a>00350 data.make_nan();
- <a name="l00351"></a>00351 endptr = str + tnan.length();
- <a name="l00352"></a>00352 <span class="keywordflow">return</span>;
- <a name="l00353"></a>00353 }
- <a name="l00354"></a>00354 }
- <a name="l00355"></a>00355 data.from_string(str, endptr, base);
- <a name="l00356"></a>00356 <span class="keywordflow">if</span> (!Signed && data.negative) _fix_negative_unsigned();
- <a name="l00357"></a>00357 } <a class="code" href="internals_8hpp.html#a5117d87820df153f9c26dd5ff8ac318a">BOOST_XINT_CATCH</a> {
- <a name="l00358"></a>00358 data.make_nan();
- <a name="l00359"></a>00359 }
- <a name="l00360"></a>00360 } <span class="keywordflow">else</span> {
- <a name="l00361"></a>00361 data.from_string(str, endptr, base);
- <a name="l00362"></a>00362 <span class="keywordflow">if</span> (!Signed && data.negative) _fix_negative_unsigned();
- <a name="l00363"></a>00363 }
- <a name="l00364"></a>00364 }
- <a name="l00365"></a>00365
- <a name="l00390"></a>00390 <span class="keyword">template</span><BOOST_XINT_CLASS_APARAMS>
- <a name="l00391"></a>00391 <span class="keyword">template</span> <<span class="keyword">typename</span> <span class="keywordtype">char</span>T, <span class="keyword">typename</span> traitsT, <span class="keyword">typename</span> allocT>
- <a name="l00392"></a>00392 <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t<BOOST_XINT_APARAMS>::integer_t</a>(<span class="keyword">const</span> std::basic_string<charT, traitsT,
- <a name="l00393"></a>00393 allocT> &str, std::size_t base)
- <a name="l00394"></a>00394 {
- <a name="l00395"></a>00395 <span class="keywordflow">if</span> (Nothrow) {
- <a name="l00396"></a>00396 <a class="code" href="internals_8hpp.html#a693c4f473d303c632864f6084c394f03">BOOST_XINT_TRY</a> {
- <a name="l00397"></a>00397 <span class="keywordflow">if</span> (str == detail::nan_text<charT>()) data.make_nan();
- <a name="l00398"></a>00398 <span class="keywordflow">else</span> {
- <a name="l00399"></a>00399 data.from_string(str, base);
- <a name="l00400"></a>00400 <span class="keywordflow">if</span> (!Signed && data.negative) _fix_negative_unsigned();
- <a name="l00401"></a>00401 }
- <a name="l00402"></a>00402 } <a class="code" href="internals_8hpp.html#a5117d87820df153f9c26dd5ff8ac318a">BOOST_XINT_CATCH</a> {
- <a name="l00403"></a>00403 data.make_nan();
- <a name="l00404"></a>00404 }
- <a name="l00405"></a>00405 } <span class="keywordflow">else</span> {
- <a name="l00406"></a>00406 data.from_string(str, base);
- <a name="l00407"></a>00407 <span class="keywordflow">if</span> (!Signed && data.negative) _fix_negative_unsigned();
- <a name="l00408"></a>00408 }
- <a name="l00409"></a>00409 }
- <a name="l00410"></a>00410
- <a name="l00432"></a>00432 <span class="keyword">template</span><BOOST_XINT_CLASS_APARAMS>
- <a name="l00433"></a>00433 <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t<BOOST_XINT_APARAMS>::integer_t</a>(<span class="keyword">const</span> <a class="code" href="namespaceboost_1_1xint.html#aae3128529370506165793f2771834e58" title="The format for the binary representations of integers.">xint::binary_t</a> &i, <a class="code" href="namespaceboost_1_1xint.html#ae9f6d103df04ad19a841ed3f8b94a764" title="This makes it easier to tell when an item is measured in bits.">bitsize_t</a>
- <a name="l00434"></a>00434 bits)
- <a name="l00435"></a>00435 {
- <a name="l00436"></a>00436 <span class="keywordflow">if</span> (Nothrow) {
- <a name="l00437"></a>00437 <a class="code" href="internals_8hpp.html#a693c4f473d303c632864f6084c394f03">BOOST_XINT_TRY</a> {
- <a name="l00438"></a>00438 data.from_binary(i, bits);
- <a name="l00439"></a>00439 } <a class="code" href="internals_8hpp.html#a5117d87820df153f9c26dd5ff8ac318a">BOOST_XINT_CATCH</a> {
- <a name="l00440"></a>00440 data.make_nan();
- <a name="l00441"></a>00441 }
- <a name="l00442"></a>00442 } <span class="keywordflow">else</span> {
- <a name="l00443"></a>00443 data.from_binary(i, bits);
- <a name="l00444"></a>00444 }
- <a name="l00445"></a>00445 }
- <a name="l00446"></a>00446
- <a name="l00459"></a>00459 <span class="keyword">template</span><BOOST_XINT_CLASS_APARAMS>
- <a name="l00460"></a>00460 <span class="keyword">template</span> <BOOST_XINT_CLASS_BPARAMS>
- <a name="l00461"></a>00461 <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t<BOOST_XINT_APARAMS>::integer_t</a>(<span class="keyword">const</span> integer_t<BOOST_XINT_BPARAMS> &i,
- <a name="l00462"></a>00462 <span class="keywordtype">bool</span> force_thread_safety)
- <a name="l00463"></a>00463 {
- <a name="l00464"></a>00464 <span class="keywordflow">if</span> (Nothrow) {
- <a name="l00465"></a>00465 <a class="code" href="internals_8hpp.html#a693c4f473d303c632864f6084c394f03">BOOST_XINT_TRY</a> {
- <a name="l00466"></a>00466 <span class="keywordflow">if</span> (i.is_nan()) {
- <a name="l00467"></a>00467 data.make_nan();
- <a name="l00468"></a>00468 } <span class="keywordflow">else</span> {
- <a name="l00469"></a>00469 data = i._data();
- <a name="l00470"></a>00470 <span class="keywordflow">if</span> (!data.is_nan()) {
- <a name="l00471"></a>00471 <span class="keywordflow">if</span> (force_thread_safety || Threadsafe == <span class="keyword">true</span>)
- <a name="l00472"></a>00472 data.make_unique();
- <a name="l00473"></a>00473 <span class="keywordflow">if</span> (!Signed && data.negative) _fix_negative_unsigned();
- <a name="l00474"></a>00474 }
- <a name="l00475"></a>00475 }
- <a name="l00476"></a>00476 } <a class="code" href="internals_8hpp.html#a5117d87820df153f9c26dd5ff8ac318a">BOOST_XINT_CATCH</a> {
- <a name="l00477"></a>00477 data.make_nan();
- <a name="l00478"></a>00478 }
- <a name="l00479"></a>00479 } <span class="keywordflow">else</span> {
- <a name="l00480"></a>00480 <span class="keywordflow">if</span> (i._data().is_nan()) detail::exception_handler<>::call(__FILE__,
- <a name="l00481"></a>00481 __LINE__, exceptions::not_a_number());
- <a name="l00482"></a>00482 data = i._data();
- <a name="l00483"></a>00483 <span class="keywordflow">if</span> (force_thread_safety || Threadsafe == <span class="keyword">true</span>) data.make_unique();
- <a name="l00484"></a>00484 <span class="keywordflow">if</span> (!Signed && data.negative) _fix_negative_unsigned();
- <a name="l00485"></a>00485 }
- <a name="l00486"></a>00486 }
- <a name="l00487"></a>00487
- <a name="l00500"></a>00500 <span class="keyword">template</span><BOOST_XINT_CLASS_APARAMS>
- <a name="l00501"></a>00501 <span class="keyword">template</span> <<span class="keyword">typename</span> Type> <a class="code" href="classboost_1_1xint_1_1integer__t.html#adc039392b5197a0ebd69b5744ee420eb" title="Creates a new integer with an initial value of zero.">integer_t<BOOST_XINT_APARAMS>::integer_t</a>(<span class="keyword">const</span> Type n,
- <a name="l00502"></a>00502 <span class="keyword">typename</span> boost::enable_if<boost::is_integral<Type> >::type*)
- <a name="l00503"></a>00503 {
- <a name="l00504"></a>00504 <span class="keywordflow">if</span> (Nothrow) {
- <a name="l00505"></a>00505 <a class="code" href="internals_8hpp.html#a693c4f473d303c632864f6084c394f03">BOOST_XINT_TRY</a> {
- <a name="l00506"></a>00506 <span class="keywordflow">if</span> (std::numeric_limits<Type>::is_signed) {
- <a name="l00507"></a>00507 data.set_signed(n);
- <a name="l00508"></a>00508 <span class="keywordflow">if</span> (!Signed && data.negative) _fix_negative_unsigned();
- <a name="l00509"></a>00509 } <span class="keywordflow">else</span> data.set_unsigned(n);
- <a name="l00510"></a>00510 } <a class="code" href="internals_8hpp.html#a5117d87820df153f9c26dd5ff8ac318a">BOOST_XINT_CATCH</a> {
- <a name="l00511"></a>00511 data.make_nan();
- <a name="l00512"></a>00512 }
- <a name="l00513"></a>00513 } <span class="keywordflow">else</span> {
- <a name="l00514"></a>00514 <span class="keywordflow">if</span> (std::numeric_limits<Type>::is_signed) {
- <a name="l00515"></a>00515 data.set_signed(n);
- <a name="l00516"></a>00516 <span class="keywordflow">if</span> (!Signed && data.negative) _fix_negative_unsigned();
- <a name="l00517"></a>00517 } <span class="keywordflow">else</span> data.set_unsigned(n);
- <a name="l00518"></a>00518 }
- <a name="l00519"></a>00519 }
- <a name="l00520"></a><a class="code" href="classboost_1_1xint_1_1integer__t.html#a7388d85a6b1509c214b981bc730f7c7f">00520</a>
- <a name="l00521"></a>00521 <span class="keyword">template</span><BOOST_XINT_CLASS_APARAMS>
- <a name="l00522"></a>00522 <a class="code" href="classboost_1_1xint_1_1integer__t.html" title="The integer_t class template.">integer_t<BOOST_XINT_APARAMS></a>& <a class="code" href="classboost_1_1xint_1_1integer__t.html#a7388d85a6b1509c214b981bc730f7c7f">integer_t<BOOST_XINT_APARAMS>::</a>
- <a name="l00523"></a>00523 <a class="code" href="classboost_1_1xint_1_1integer__t.html#a7388d85a6b1509c214b981bc730f7c7f"> operator=</a>(<a class="code" href="basic__types__and__includes_8hpp.html#a8177a6a6c68ea042f7e644d8ef7128f9">BOOST_XINT_COPY_ASSIGN_REF</a>(type) c)
- <a name="l00524"></a>00524 {
- <a name="l00525"></a>00525 <span class="keywordflow">if</span> (Nothrow) {
- <a name="l00526"></a>00526 <span class="keywordflow">if</span> (c._data().is_nan()) data.make_nan();
- <a name="l00527"></a>00527 <span class="keywordflow">else</span> {
- <a name="l00528"></a>00528 <a class="code" href="internals_8hpp.html#a693c4f473d303c632864f6084c394f03">BOOST_XINT_TRY</a> {
- <a name="l00529"></a>00529 data = c.data;
- <a name="l00530"></a>00530 <span class="keywordflow">if</span> (Threadsafe == <span class="keyword">true</span>) data.make_unique();
- <a name="l00531"></a>00531 } <a class="code" href="internals_8hpp.html#a5117d87820df153f9c26dd5ff8ac318a">BOOST_XINT_CATCH</a> {
- <a name="l00532"></a>00532 data.make_nan();
- <a name="l00533"></a>00533 }
- <a name="l00534"></a>00534 }
- <a name="l00535"></a>00535 } <span class="keywordflow">else</span> {
- <a name="l00536"></a>00536 data = c.data;
- <a name="l00537"></a>00537 <span class="keywordflow">if</span> (Threadsafe == <span class="keyword">true</span>) data.make_unique();
- <a name="l00538"></a>00538 }
- <a name="l00539"></a>00539 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
- <a name="l00540"></a>00540 }
- <a name="l00541"></a>00541
- <a name="l00542"></a>00542 <span class="preprocessor">#ifdef BOOST_XINT_DOXYGEN_IGNORE // Doesn't really exist, this is here for docs</span>
- <a name="l00543"></a>00543 <span class="preprocessor"></span>
- <a name="l00559"></a>00559 <span class="keyword">template</span><BOOST_XINT_CLASS_APARAMS>
- <a name="l00560"></a>00560 <a class="code" href="classboost_1_1xint_1_1integer__t.html" title="The integer_t class template.">integer_t<BOOST_XINT_APARAMS></a> <a class="code" href="classboost_1_1xint_1_1integer__t.html#ad200ae35a1bb12061b9a230f9e42550d" title="The Bitwise Ones Complement (i.e. bitwise NOT) operator.">integer_t<BOOST_XINT_APARAMS>::operator~</a>() <span class="keyword">const</span>;
- <a name="l00561"></a>00561 <span class="preprocessor">#endif // BOOST_XINT_DOXYGEN_IGNORE</span>
- <a name="l00562"></a>00562 <span class="preprocessor"></span>
- <a name="l00569"></a>00569 <span class="keyword">template</span><BOOST_XINT_CLASS_APARAMS>
- <a name="l00570"></a>00570 <a class="code" href="classboost_1_1xint_1_1integer__t.html" title="The integer_t class template.">integer_t<BOOST_XINT_APARAMS></a> <a class="code" href="classboost_1_1xint_1_1integer__t.html#a31ef623fef7944861c458bcd2c9b0001" title="Return the additive inverse of an integer.">integer_t<BOOST_XINT_APARAMS>::operator-</a>()<span class="keyword"> const </span>{
- <a name="l00571"></a>00571 <span class="keywordflow">if</span> (Nothrow) {
- <a name="l00572"></a>00572 <span class="keywordflow">if</span> (<a class="code" href="classboost_1_1xint_1_1integer__t.html#a9afdf728b490f4fea0f6bd4805e96bd5" title="Tests whether the object is a Not-a-Number.">is_nan</a>()) <span class="keywordflow">return</span> *<span class="keyword">this</span>;
- <a name="l00573"></a>00573 <a class="code" href="internals_8hpp.html#a693c4f473d303c632864f6084c394f03">BOOST_XINT_TRY</a> {
- <a name="l00574"></a>00574 <a class="code" href="classboost_1_1xint_1_1integer__t.html" title="The integer_t class template.">integer_t<BOOST_XINT_APARAMS></a> r(*<span class="keyword">this</span>);
- <a name="l00575"></a>00575 <span class="keywordflow">if</span> (Threadsafe == <span class="keyword">true</span>) r._make_unique();
- <a name="l00576"></a>00576 r.data = -r.data;
- <a name="l00577"></a>00577 <span class="keywordflow">if</span> (!Signed && r.data.negative) r._fix_negative_unsigned();
- <a name="l00578"></a>00578 <span class="keywordflow">return</span> <a class="code" href="basic__types__and__includes_8hpp.html#a73c3b02410381da656b7cb59c7ba9314">BOOST_XINT_MOVE</a>(r);
- <a name="l00579"></a>00579 } <a class="code" href="internals_8hpp.html#a5117d87820df153f9c26dd5ff8ac318a">BOOST_XINT_CATCH</a> {
- <a name="l00580"></a>00580 <span class="keywordflow">return</span> detail::get_nan<integer_t<BOOST_XINT_APARAMS> >();
- <a name="l00581"></a>00581 }
- <a name="l00582"></a>00582 } <span class=…
Large files files are truncated, but you can click here to view the full file