integer_8h-source.html
来自「Crypto++是一个非常强大的密码学库,主要是功能全」· HTML 代码 · 共 454 行 · 第 1/4 页
HTML
454 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Crypto++: integer.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.2 --><div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Compound List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Compound Members</a> | <a class="qindex" href="globals.html">File Members</a></div><h1>integer.h</h1><a href="integer_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="preprocessor">#ifndef CRYPTOPP_INTEGER_H</span>00002 <span class="preprocessor"></span><span class="preprocessor">#define CRYPTOPP_INTEGER_H</span>00003 <span class="preprocessor"></span><span class="comment"></span>00004 <span class="comment">/** \file */</span>00005 00006 <span class="preprocessor">#include "<a class="code" href="cryptlib_8h.html">cryptlib.h</a>"</span>00007 <span class="preprocessor">#include "secblock.h"</span>00008 00009 <span class="preprocessor">#include <iosfwd></span>00010 <span class="preprocessor">#include <algorithm></span>00011 00012 <span class="preprocessor">#ifdef _M_IX86</span>00013 <span class="preprocessor"></span><span class="preprocessor"># if (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 500)) || (defined(__ICL) && (__ICL >= 500))</span>00014 <span class="preprocessor"></span><span class="preprocessor"># define SSE2_INTRINSICS_AVAILABLE</span>00015 <span class="preprocessor"></span><span class="preprocessor"># elif defined(_MSC_VER)</span>00016 <span class="preprocessor"></span> <span class="comment">// _mm_free seems to be the only way to tell if the Processor Pack is installed or not</span>00017 <span class="preprocessor"># include <malloc.h></span>00018 <span class="preprocessor"># if defined(_mm_free)</span>00019 <span class="preprocessor"></span><span class="preprocessor"># define SSE2_INTRINSICS_AVAILABLE</span>00020 <span class="preprocessor"></span><span class="preprocessor"># endif</span>00021 <span class="preprocessor"></span><span class="preprocessor"># endif</span>00022 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00023 <span class="preprocessor"></span>00024 NAMESPACE_BEGIN(CryptoPP)00025 00026 #ifdef SSE2_INTRINSICS_AVAILABLE00027 00028 <span class="keyword">template</span> <<span class="keyword">class</span> T>00029 <span class="keyword">class </span>AlignedAllocator : <span class="keyword">public</span> AllocatorBase<T>00030 {00031 <span class="keyword">public</span>:00032 CRYPTOPP_INHERIT_ALLOCATOR_TYPES00033 00034 pointer allocate(size_type n, <span class="keyword">const</span> <span class="keywordtype">void</span> *);00035 <span class="keywordtype">void</span> deallocate(<span class="keywordtype">void</span> *p, size_type n);00036 pointer reallocate(T *p, size_type oldSize, size_type newSize, <span class="keywordtype">bool</span> preserve)00037 {00038 <span class="keywordflow">return</span> StandardReallocate(*<span class="keyword">this</span>, p, oldSize, newSize, preserve);00039 }00040 };00041 <span class="keyword">template</span> <span class="keyword">class </span>CRYPTOPP_DLL AlignedAllocator<word>;00042 <span class="keyword">typedef</span> <a class="code" href="class_sec_block.html">SecBlock<word, AlignedAllocator<word></a> > <a class="code" href="class_sec_block.html">SecAlignedWordBlock</a>;00043 00044 <span class="keywordtype">void</span> CRYPTOPP_DLL DisableSSE2();00045 00046 <span class="preprocessor">#else</span>00047 <span class="preprocessor"></span><span class="keyword">typedef</span> <a class="code" href="class_sec_block.html">SecWordBlock</a> SecAlignedWordBlock;00048 <span class="preprocessor">#endif</span>00049 <span class="preprocessor"></span><span class="comment"></span>00050 <span class="comment">//! multiple precision integer and basic arithmetics</span>00051 <span class="comment"></span><span class="comment">/*! This class can represent positive and negative integers</span>00052 <span class="comment"> with absolute value less than (256**sizeof(word)) ** (256**sizeof(int)).</span>00053 <span class="comment"> \nosubgrouping</span>00054 <span class="comment">*/</span><a name="l00055"></a><a class="code" href="class_integer.html">00055</a> <span class="keyword">class </span>CRYPTOPP_DLL Integer : <span class="keyword">public</span> <a class="code" href="class_a_s_n1_object.html">ASN1Object</a>00056 {00057 <span class="keyword">public</span>:<span class="comment"></span>00058 <span class="comment"> //! \name ENUMS, EXCEPTIONS, and TYPEDEFS</span>00059 <span class="comment"></span><span class="comment"> //@{</span>00060 <span class="comment"></span><span class="comment"> //! division by zero exception</span><a name="l00061"></a><a class="code" href="class_integer_1_1_divide_by_zero.html">00061</a> <span class="comment"></span> <span class="keyword">class </span><a class="code" href="class_integer_1_1_divide_by_zero.html">DivideByZero</a> : <span class="keyword">public</span> <a class="code" href="class_exception.html">Exception</a>00062 {00063 <span class="keyword">public</span>:00064 <a class="code" href="class_integer_1_1_divide_by_zero.html">DivideByZero</a>() : <a class="code" href="class_exception.html">Exception</a>(OTHER_ERROR, <span class="stringliteral">"Integer: division by zero"</span>) {}00065 };00066 <span class="comment"></span>00067 <span class="comment"> //!</span>00068 <span class="comment"></span> <span class="keyword">class </span>RandomNumberNotFound : <span class="keyword">public</span> <a class="code" href="class_exception.html">Exception</a>00069 {00070 <span class="keyword">public</span>:00071 RandomNumberNotFound() : <a class="code" href="class_exception.html">Exception</a>(OTHER_ERROR, "Integer: no integer satisfies the given parameters") {}00072 };00073 <span class="comment"></span>00074 <span class="comment"> //!</span>00075 <span class="comment"></span> <span class="keyword">enum</span> Signedness {<span class="comment"></span>00076 <span class="comment"> //!</span>00077 <span class="comment"></span> UNSIGNED,<span class="comment"></span>00078 <span class="comment"> //!</span>00079 <span class="comment"></span> SIGNED};00080 <span class="comment"></span>00081 <span class="comment"> //!</span>00082 <span class="comment"></span> <span class="keyword">enum</span> RandomNumberType {<span class="comment"></span>00083 <span class="comment"> //!</span>00084 <span class="comment"></span> ANY,<span class="comment"></span>00085 <span class="comment"> //!</span>00086 <span class="comment"></span> PRIME};<span class="comment"></span>00087 <span class="comment"> //@}</span>00088 <span class="comment"></span><span class="comment"></span>00089 <span class="comment"> //! \name CREATORS</span>00090 <span class="comment"></span><span class="comment"> //@{</span>00091 <span class="comment"></span><span class="comment"> //! creates the zero integer</span>00092 <span class="comment"></span> Integer();00093 <span class="comment"></span>00094 <span class="comment"> //! copy constructor</span>00095 <span class="comment"></span> Integer(<span class="keyword">const</span> Integer& t);00096 <span class="comment"></span>00097 <span class="comment"> //! convert from signed long</span>00098 <span class="comment"></span> Integer(<span class="keywordtype">signed</span> <span class="keywordtype">long</span> value);00099 <span class="comment"></span>00100 <span class="comment"> //! convert from string</span>00101 <span class="comment"></span><span class="comment"> /*! str can be in base 2, 8, 10, or 16. Base is determined by a</span>00102 <span class="comment"> case insensitive suffix of 'h', 'o', or 'b'. No suffix means base 10.</span>00103 <span class="comment"> */</span>00104 <span class="keyword">explicit</span> Integer(<span class="keyword">const</span> <span class="keywordtype">char</span> *str);00105 <span class="keyword">explicit</span> Integer(<span class="keyword">const</span> <span class="keywordtype">wchar_t</span> *str);00106 <span class="comment"></span>00107 <span class="comment"> //! convert from big-endian byte array</span>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?