⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 integer_8h-source.html

📁 著名的密码库Crypto++的文档 C++语言的杰作。程序员必备。
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<a name="l00214"></a>00214 <span class="comment">        //! \name MANIPULATORS</span><a name="l00215"></a>00215 <span class="comment"></span><span class="comment">        //@{</span><a name="l00216"></a>00216 <span class="comment"></span><span class="comment">                //!</span><a name="l00217"></a>00217 <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp;  operator=(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp; t);<a name="l00218"></a>00218 <span class="comment"></span><a name="l00219"></a>00219 <span class="comment">                //!</span><a name="l00220"></a>00220 <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp;  operator+=(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp; t);<span class="comment"></span><a name="l00221"></a>00221 <span class="comment">                //!</span><a name="l00222"></a>00222 <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp;  operator-=(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp; t);<span class="comment"></span><a name="l00223"></a>00223 <span class="comment">                //!</span><a name="l00224"></a><a class="code" href="class_integer.html#07b76f3e219c89bc70b0fec254f415fd">00224</a> <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp;  operator*=(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp; t)  {<span class="keywordflow">return</span> *<span class="keyword">this</span> = Times(t);}<span class="comment"></span><a name="l00225"></a>00225 <span class="comment">                //!</span><a name="l00226"></a><a class="code" href="class_integer.html#80e968a9c7afc4979fe2148170ec7458">00226</a> <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp;  operator/=(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp; t)  {<span class="keywordflow">return</span> *<span class="keyword">this</span> = DividedBy(t);}<span class="comment"></span><a name="l00227"></a>00227 <span class="comment">                //!</span><a name="l00228"></a><a class="code" href="class_integer.html#468142f7860854f6e97910af4eb2b220">00228</a> <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp;  operator%=(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp; t)  {<span class="keywordflow">return</span> *<span class="keyword">this</span> = Modulo(t);}<span class="comment"></span><a name="l00229"></a>00229 <span class="comment">                //!</span><a name="l00230"></a><a class="code" href="class_integer.html#6fcad58a76f3cedc4134a18d56ebb808">00230</a> <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp;  operator/=(word t)  {<span class="keywordflow">return</span> *<span class="keyword">this</span> = DividedBy(t);}<span class="comment"></span><a name="l00231"></a>00231 <span class="comment">                //!</span><a name="l00232"></a><a class="code" href="class_integer.html#3874b6ac8979328ce532eebc8b275eab">00232</a> <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp;  operator%=(word t)  {<span class="keywordflow">return</span> *<span class="keyword">this</span> = <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>(POSITIVE, 0, Modulo(t));}<a name="l00233"></a>00233 <span class="comment"></span><a name="l00234"></a>00234 <span class="comment">                //!</span><a name="l00235"></a>00235 <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp;  operator&lt;&lt;=(<span class="keywordtype">size_t</span>);<span class="comment"></span><a name="l00236"></a>00236 <span class="comment">                //!</span><a name="l00237"></a>00237 <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp;  operator&gt;&gt;=(<span class="keywordtype">size_t</span>);<a name="l00238"></a>00238 <span class="comment"></span><a name="l00239"></a>00239 <span class="comment">                //!</span><a name="l00240"></a>00240 <span class="comment"></span>                <span class="keywordtype">void</span> Randomize(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keywordtype">size_t</span> bitcount);<span class="comment"></span><a name="l00241"></a>00241 <span class="comment">                //!</span><a name="l00242"></a>00242 <span class="comment"></span>                <span class="keywordtype">void</span> Randomize(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;min, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;max);<span class="comment"></span><a name="l00243"></a>00243 <span class="comment">                //! set this Integer to a random element of {x | min &lt;= x &lt;= max and x is of rnType and x % mod == equiv}</span><a name="l00244"></a>00244 <span class="comment"></span><span class="comment">                /*! returns false if the set is empty */</span><a name="l00245"></a>00245                 <span class="keywordtype">bool</span> Randomize(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;min, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;max, RandomNumberType rnType, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;equiv=Zero(), <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;mod=One());<a name="l00246"></a>00246 <a name="l00247"></a>00247                 <span class="keywordtype">bool</span> GenerateRandomNoThrow(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;params = g_nullNameValuePairs);<a name="l00248"></a><a class="code" href="class_integer.html#0d9a427fe64a454b11b24fe61c10dbeb">00248</a>                 <span class="keywordtype">void</span> GenerateRandom(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;params = g_nullNameValuePairs)<a name="l00249"></a>00249                 {<a name="l00250"></a>00250                         <span class="keywordflow">if</span> (!GenerateRandomNoThrow(rng, params))<a name="l00251"></a>00251                                 <span class="keywordflow">throw</span> <a class="code" href="class_integer_1_1_random_number_not_found.html">RandomNumberNotFound</a>();<a name="l00252"></a>00252                 }<a name="l00253"></a>00253 <span class="comment"></span><a name="l00254"></a>00254 <span class="comment">                //! set the n-th bit to value</span><a name="l00255"></a>00255 <span class="comment"></span>                <span class="keywordtype">void</span> SetBit(<span class="keywordtype">size_t</span> n, <span class="keywordtype">bool</span> value=1);<span class="comment"></span><a name="l00256"></a>00256 <span class="comment">                //! set the n-th byte to value</span><a name="l00257"></a>00257 <span class="comment"></span>                <span class="keywordtype">void</span> SetByte(<span class="keywordtype">size_t</span> n, byte value);<a name="l00258"></a>00258 <span class="comment"></span><a name="l00259"></a>00259 <span class="comment">                //!</span><a name="l00260"></a>00260 <span class="comment"></span>                <span class="keywordtype">void</span> Negate();<span class="comment"></span><a name="l00261"></a>00261 <span class="comment">                //!</span><a name="l00262"></a><a class="code" href="class_integer.html#8ba4496f4ae1392c3860d3bcbba586c1">00262</a> <span class="comment"></span>                <span class="keywordtype">void</span> SetPositive() {sign = POSITIVE;}<span class="comment"></span><a name="l00263"></a>00263 <span class="comment">                //!</span><a name="l00264"></a><a class="code" href="class_integer.html#860dd1318ef7089d774674f2100c8fb8">00264</a> <span class="comment"></span>                <span class="keywordtype">void</span> SetNegative() {<span class="keywordflow">if</span> (!!(*<span class="keyword">this</span>)) sign = NEGATIVE;}<a name="l00265"></a>00265 <span class="comment"></span><a name="l00266"></a>00266 <span class="comment">                //!</span><a name="l00267"></a>00267 <span class="comment"></span>                <span class="keywordtype">void</span> <a class="code" href="gf2n_8h.html#cd9c045f0b5c2a7595a8a0872dc80f59">swap</a>(<a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;a);<span class="comment"></span><a name="l00268"></a>00268 <span class="comment">        //@}</span><a name="l00269"></a>00269 <span class="comment"></span><span class="comment"></span><a name="l00270"></a>00270 <span class="comment">        //! \name UNARY OPERATORS</span><a name="l00271"></a>00271 <span class="comment"></span><span class="comment">        //@{</span><a name="l00272"></a>00272 <span class="comment"></span><span class="comment">                //!</span><a name="l00273"></a>00273 <span class="comment"></span>                <span class="keywordtype">bool</span>            operator!() <span class="keyword">const</span>;<span class="comment"></span><a name="l00274"></a>00274 <span class="comment">                //!</span><a name="l00275"></a><a class="code" href="class_integer.html#95274da93f81f1cd71a8868bba3e3b86">00275</a> <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>         <a class="code" href="gf2n_8h.html#f90f6d4d1dec04baadfc546843f8da4c">operator+</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> *<span class="keyword">this</span>;}<span class="comment"></span><a name="l00276"></a>00276 <span class="comment">                //!</span><a name="l00277"></a>00277 <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>         <a class="code" href="gf2n_8h.html#af85a1c53439d93124cf51fdefb0a717">operator-</a>() <span class="keyword">const</span>;<span class="comment"></span><a name="l00278"></a>00278 <span class="comment">                //!</span><a name="l00279"></a>00279 <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp;        operator++();<span class="comment"></span><a name="l00280"></a>00280 <span class="comment">                //!</span><a name="l00281"></a>00281 <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp;        operator--();<span class="comment"></span><a name="l00282"></a>00282 <span class="comment">                //!</span><a name="l00283"></a><a class="code" href="class_integer.html#1666444f09484e482b2f94dd263c7dc9">00283</a> <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>         operator++(<span class="keywordtype">int</span>) {<a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> temp = *<span class="keyword">this</span>; ++*<span class="keyword">this</span>; <span class="keywordflow">return</span> temp;}<span class="comment"></span><a name="l00284"></a>00284 <span class="comment">                //!</span><a name="l00285"></a><a class="code" href="class_integer.html#000120734ad8ba84af5c5ac7f5f84925">00285</a> <span class="comment"></span>                <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>         operator--(<span class="keywordtype">int</span>) {<a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> temp = *<span class="keyword">this</span>; --*<span class="keyword">this</span>; <span class="keywordflow">return</span> temp;}<span class="comment"></span><a name="l00286"></a>00286 <span class="comment">        //@}</span><a name="l00287"></a>00287 <span class="comment"></span><span class="comment"></span><a name="l00288"></a>00288 <span class="comment">        //! \name BINARY OPERATORS</span><a name="l00289"></a>00289 <span class="comment"></span><span class="comment">        //@{</span><a name="l00290"></a>00290 <span class="comment"></span><span class="comment">                //! signed comparison</span><a name="l00291"></a>00291 <span class="comment"></span><span class="comment">                /*! \retval -1 if *this &lt; a</span>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -