FS#8961 - Anti-Aliased Fonts.
[kugel-rb.git] / utils / zenutils / libraries / beecrypt-4.1.2 / beecrypt / mpnumber.h
blobf42e82a80fc590efcb2d2be9bd93805f888737d3
1 /*
2 * Copyright (c) 2003 Bob Deblier
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 /*!\file mpnumber.h
21 * \brief Multi-precision numbers, headers.
22 * \author Bob Deblier <bob.deblier@pandora.be>
23 * \ingroup MP_m
26 #ifndef _MPNUMBER_H
27 #define _MPNUMBER_H
29 #include "beecrypt/mp.h"
31 #ifdef __cplusplus
32 # include <iostream>
33 #endif
35 #ifdef __cplusplus
36 struct BEECRYPTAPI mpnumber
37 #else
38 struct _mpnumber
39 #endif
41 size_t size;
42 mpw* data;
44 #ifdef __cplusplus
45 static const mpnumber ZERO;
46 static const mpnumber ONE;
48 mpnumber();
49 mpnumber(unsigned int);
50 mpnumber(const mpnumber&);
51 ~mpnumber();
53 const mpnumber& operator=(const mpnumber&);
54 bool operator==(const mpnumber&) const throw ();
55 bool operator!=(const mpnumber&) const throw ();
57 void wipe();
59 size_t bitlength() const throw ();
60 #endif
63 #ifndef __cplusplus
64 typedef struct _mpnumber mpnumber;
65 #else
66 BEECRYPTAPI
67 std::ostream& operator<<(std::ostream&, const mpnumber&);
69 BEECRYPTAPI
70 std::istream& operator>>(std::istream&, mpnumber&);
72 #endif
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
78 BEECRYPTAPI
79 void mpnzero(mpnumber*);
80 BEECRYPTAPI
81 void mpnsize(mpnumber*, size_t);
82 BEECRYPTAPI
83 void mpninit(mpnumber*, size_t, const mpw*);
84 BEECRYPTAPI
85 void mpnfree(mpnumber*);
86 BEECRYPTAPI
87 void mpncopy(mpnumber*, const mpnumber*);
88 BEECRYPTAPI
89 void mpnwipe(mpnumber*);
91 BEECRYPTAPI
92 void mpnset (mpnumber*, size_t, const mpw*);
93 BEECRYPTAPI
94 void mpnsetw (mpnumber*, mpw);
96 BEECRYPTAPI
97 int mpnsetbin(mpnumber*, const byte*, size_t);
98 BEECRYPTAPI
99 int mpnsethex(mpnumber*, const char*);
101 BEECRYPTAPI
102 int mpninv(mpnumber*, const mpnumber*, const mpnumber*);
104 /*!\brief Truncate the mpnumber to the specified number of (least significant) bits.
106 BEECRYPTAPI
107 size_t mpntrbits(mpnumber*, size_t);
108 BEECRYPTAPI
109 size_t mpnbits(const mpnumber*);
111 #ifdef __cplusplus
113 #endif
115 #endif