1 |
758 |
jeremybenn |
|
2 |
|
|
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
3 |
|
|
|
4 |
|
|
#ifndef __java_math_BigInteger__
|
5 |
|
|
#define __java_math_BigInteger__
|
6 |
|
|
|
7 |
|
|
#pragma interface
|
8 |
|
|
|
9 |
|
|
#include <java/lang/Number.h>
|
10 |
|
|
#include <gcj/array.h>
|
11 |
|
|
|
12 |
|
|
extern "Java"
|
13 |
|
|
{
|
14 |
|
|
namespace gnu
|
15 |
|
|
{
|
16 |
|
|
namespace java
|
17 |
|
|
{
|
18 |
|
|
namespace lang
|
19 |
|
|
{
|
20 |
|
|
class CPStringBuilder;
|
21 |
|
|
}
|
22 |
|
|
namespace math
|
23 |
|
|
{
|
24 |
|
|
class GMP;
|
25 |
|
|
}
|
26 |
|
|
}
|
27 |
|
|
}
|
28 |
|
|
namespace java
|
29 |
|
|
{
|
30 |
|
|
namespace math
|
31 |
|
|
{
|
32 |
|
|
class BigInteger;
|
33 |
|
|
}
|
34 |
|
|
}
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
class java::math::BigInteger : public ::java::lang::Number
|
38 |
|
|
{
|
39 |
|
|
|
40 |
|
|
BigInteger();
|
41 |
|
|
BigInteger(jint);
|
42 |
|
|
public:
|
43 |
|
|
BigInteger(::java::lang::String *, jint);
|
44 |
|
|
BigInteger(::java::lang::String *);
|
45 |
|
|
BigInteger(JArray< jbyte > *);
|
46 |
|
|
BigInteger(jint, JArray< jbyte > *);
|
47 |
|
|
BigInteger(jint, ::java::util::Random *);
|
48 |
|
|
private:
|
49 |
|
|
void init(jint, ::java::util::Random *);
|
50 |
|
|
public:
|
51 |
|
|
BigInteger(jint, jint, ::java::util::Random *);
|
52 |
|
|
static ::java::math::BigInteger * probablePrime(jint, ::java::util::Random *);
|
53 |
|
|
static ::java::math::BigInteger * valueOf(jlong);
|
54 |
|
|
private:
|
55 |
|
|
static jboolean initializeLibrary();
|
56 |
|
|
static ::java::math::BigInteger * make(JArray< jint > *, jint);
|
57 |
|
|
static JArray< jint > * byteArrayToIntArray(JArray< jbyte > *, jint);
|
58 |
|
|
static ::java::math::BigInteger * alloc(jint);
|
59 |
|
|
void realloc(jint);
|
60 |
|
|
jboolean isNegative();
|
61 |
|
|
public:
|
62 |
|
|
virtual jint signum();
|
63 |
|
|
private:
|
64 |
|
|
static jint compareTo(::java::math::BigInteger *, ::java::math::BigInteger *);
|
65 |
|
|
public:
|
66 |
|
|
virtual jint BigInteger$compareTo(::java::math::BigInteger *);
|
67 |
|
|
virtual ::java::math::BigInteger * min(::java::math::BigInteger *);
|
68 |
|
|
virtual ::java::math::BigInteger * max(::java::math::BigInteger *);
|
69 |
|
|
private:
|
70 |
|
|
jboolean isZero();
|
71 |
|
|
jboolean isOne();
|
72 |
|
|
static jint wordsNeeded(JArray< jint > *, jint);
|
73 |
|
|
::java::math::BigInteger * canonicalize();
|
74 |
|
|
static ::java::math::BigInteger * add(jint, jint);
|
75 |
|
|
static ::java::math::BigInteger * add(::java::math::BigInteger *, jint);
|
76 |
|
|
void setAdd(::java::math::BigInteger *, jint);
|
77 |
|
|
void setAdd(jint);
|
78 |
|
|
void set(jlong);
|
79 |
|
|
void set(JArray< jint > *, jint);
|
80 |
|
|
void set(::java::math::BigInteger *);
|
81 |
|
|
static ::java::math::BigInteger * add(::java::math::BigInteger *, ::java::math::BigInteger *, jint);
|
82 |
|
|
public:
|
83 |
|
|
virtual ::java::math::BigInteger * add(::java::math::BigInteger *);
|
84 |
|
|
virtual ::java::math::BigInteger * subtract(::java::math::BigInteger *);
|
85 |
|
|
private:
|
86 |
|
|
static ::java::math::BigInteger * times(::java::math::BigInteger *, jint);
|
87 |
|
|
static ::java::math::BigInteger * times(::java::math::BigInteger *, ::java::math::BigInteger *);
|
88 |
|
|
public:
|
89 |
|
|
virtual ::java::math::BigInteger * multiply(::java::math::BigInteger *);
|
90 |
|
|
private:
|
91 |
|
|
static void divide(jlong, jlong, ::java::math::BigInteger *, ::java::math::BigInteger *, jint);
|
92 |
|
|
static void divide(::java::math::BigInteger *, ::java::math::BigInteger *, ::java::math::BigInteger *, ::java::math::BigInteger *, jint);
|
93 |
|
|
public:
|
94 |
|
|
virtual ::java::math::BigInteger * divide(::java::math::BigInteger *);
|
95 |
|
|
virtual ::java::math::BigInteger * remainder(::java::math::BigInteger *);
|
96 |
|
|
virtual JArray< ::java::math::BigInteger * > * divideAndRemainder(::java::math::BigInteger *);
|
97 |
|
|
virtual ::java::math::BigInteger * mod(::java::math::BigInteger *);
|
98 |
|
|
virtual ::java::math::BigInteger * pow(jint);
|
99 |
|
|
private:
|
100 |
|
|
static JArray< jint > * euclidInv(jint, jint, jint);
|
101 |
|
|
static void euclidInv(::java::math::BigInteger *, ::java::math::BigInteger *, ::java::math::BigInteger *, JArray< ::java::math::BigInteger * > *);
|
102 |
|
|
public:
|
103 |
|
|
virtual ::java::math::BigInteger * modInverse(::java::math::BigInteger *);
|
104 |
|
|
virtual ::java::math::BigInteger * modPow(::java::math::BigInteger *, ::java::math::BigInteger *);
|
105 |
|
|
private:
|
106 |
|
|
static jint gcd(jint, jint);
|
107 |
|
|
public:
|
108 |
|
|
virtual ::java::math::BigInteger * gcd(::java::math::BigInteger *);
|
109 |
|
|
virtual jboolean isProbablePrime(jint);
|
110 |
|
|
private:
|
111 |
|
|
void setInvert();
|
112 |
|
|
void setShiftLeft(::java::math::BigInteger *, jint);
|
113 |
|
|
void setShiftRight(::java::math::BigInteger *, jint);
|
114 |
|
|
void setShift(::java::math::BigInteger *, jint);
|
115 |
|
|
static ::java::math::BigInteger * shift(::java::math::BigInteger *, jint);
|
116 |
|
|
public:
|
117 |
|
|
virtual ::java::math::BigInteger * shiftLeft(jint);
|
118 |
|
|
virtual ::java::math::BigInteger * shiftRight(jint);
|
119 |
|
|
private:
|
120 |
|
|
void format(jint, ::gnu::java::lang::CPStringBuilder *);
|
121 |
|
|
public:
|
122 |
|
|
virtual ::java::lang::String * toString();
|
123 |
|
|
virtual ::java::lang::String * toString(jint);
|
124 |
|
|
virtual jint intValue();
|
125 |
|
|
virtual jlong longValue();
|
126 |
|
|
virtual jint hashCode();
|
127 |
|
|
private:
|
128 |
|
|
static jboolean equals(::java::math::BigInteger *, ::java::math::BigInteger *);
|
129 |
|
|
public:
|
130 |
|
|
virtual jboolean equals(::java::lang::Object *);
|
131 |
|
|
private:
|
132 |
|
|
static ::java::math::BigInteger * valueOf(JArray< jbyte > *, jint, jboolean, jint);
|
133 |
|
|
public:
|
134 |
|
|
virtual jdouble doubleValue();
|
135 |
|
|
virtual jfloat floatValue();
|
136 |
|
|
private:
|
137 |
|
|
jboolean checkBits(jint);
|
138 |
|
|
jdouble roundToDouble(jint, jboolean, jboolean);
|
139 |
|
|
void getAbsolute(JArray< jint > *);
|
140 |
|
|
static jboolean negate(JArray< jint > *, JArray< jint > *, jint);
|
141 |
|
|
void setNegative(::java::math::BigInteger *);
|
142 |
|
|
void setNegative();
|
143 |
|
|
static ::java::math::BigInteger * abs(::java::math::BigInteger *);
|
144 |
|
|
public:
|
145 |
|
|
virtual ::java::math::BigInteger * abs();
|
146 |
|
|
private:
|
147 |
|
|
static ::java::math::BigInteger * neg(::java::math::BigInteger *);
|
148 |
|
|
public:
|
149 |
|
|
virtual ::java::math::BigInteger * negate();
|
150 |
|
|
virtual jint bitLength();
|
151 |
|
|
virtual JArray< jbyte > * toByteArray();
|
152 |
|
|
private:
|
153 |
|
|
static jint swappedOp(jint);
|
154 |
|
|
static ::java::math::BigInteger * bitOp(jint, ::java::math::BigInteger *, ::java::math::BigInteger *);
|
155 |
|
|
static void setBitOp(::java::math::BigInteger *, jint, ::java::math::BigInteger *, ::java::math::BigInteger *);
|
156 |
|
|
static ::java::math::BigInteger * and$(::java::math::BigInteger *, jint);
|
157 |
|
|
public:
|
158 |
|
|
virtual ::java::math::BigInteger * and$(::java::math::BigInteger *);
|
159 |
|
|
virtual ::java::math::BigInteger * or$(::java::math::BigInteger *);
|
160 |
|
|
virtual ::java::math::BigInteger * xor$(::java::math::BigInteger *);
|
161 |
|
|
virtual ::java::math::BigInteger * not$();
|
162 |
|
|
virtual ::java::math::BigInteger * andNot(::java::math::BigInteger *);
|
163 |
|
|
virtual ::java::math::BigInteger * clearBit(jint);
|
164 |
|
|
virtual ::java::math::BigInteger * setBit(jint);
|
165 |
|
|
virtual jboolean testBit(jint);
|
166 |
|
|
virtual ::java::math::BigInteger * flipBit(jint);
|
167 |
|
|
virtual jint getLowestSetBit();
|
168 |
|
|
private:
|
169 |
|
|
static jint bitCount(jint);
|
170 |
|
|
static jint bitCount(JArray< jint > *, jint);
|
171 |
|
|
public:
|
172 |
|
|
virtual jint bitCount();
|
173 |
|
|
private:
|
174 |
|
|
void readObject(::java::io::ObjectInputStream *);
|
175 |
|
|
void writeObject(::java::io::ObjectOutputStream *);
|
176 |
|
|
public:
|
177 |
|
|
virtual jint compareTo(::java::lang::Object *);
|
178 |
|
|
private:
|
179 |
|
|
static ::java::util::logging::Logger * log;
|
180 |
|
|
jint __attribute__((aligned(__alignof__( ::java::lang::Number)))) ival;
|
181 |
|
|
JArray< jint > * words;
|
182 |
|
|
jint bitCount__;
|
183 |
|
|
jint bitLength__;
|
184 |
|
|
jint lowestSetBit;
|
185 |
|
|
JArray< jbyte > * magnitude;
|
186 |
|
|
jint signum__;
|
187 |
|
|
static const jlong serialVersionUID = -8287574255936472291LL;
|
188 |
|
|
static const jint minFixNum = -100;
|
189 |
|
|
static const jint maxFixNum = 1024;
|
190 |
|
|
static const jint numFixNum = 1125;
|
191 |
|
|
static JArray< ::java::math::BigInteger * > * smallFixNums;
|
192 |
|
|
::gnu::java::math::GMP * mpz;
|
193 |
|
|
static jboolean USING_NATIVE;
|
194 |
|
|
public:
|
195 |
|
|
static ::java::math::BigInteger * ZERO;
|
196 |
|
|
static ::java::math::BigInteger * ONE;
|
197 |
|
|
static ::java::math::BigInteger * TEN;
|
198 |
|
|
private:
|
199 |
|
|
static const jint FLOOR = 1;
|
200 |
|
|
static const jint CEILING = 2;
|
201 |
|
|
static const jint TRUNCATE = 3;
|
202 |
|
|
static const jint ROUND = 4;
|
203 |
|
|
static JArray< jint > * primes;
|
204 |
|
|
static JArray< jint > * k;
|
205 |
|
|
static JArray< jint > * t;
|
206 |
|
|
static JArray< jbyte > * bit4_count;
|
207 |
|
|
public:
|
208 |
|
|
static ::java::lang::Class class$;
|
209 |
|
|
};
|
210 |
|
|
|
211 |
|
|
#endif // __java_math_BigInteger__
|