we don't have access to int_cf.h and int_int.h from factory, so the following commented-out code won't compile; but it might have worked.
171{
174
175
176
177
178
179
180
181
182 static const unsigned int base = 1 << 16;
184 int sign;
185 {
187 int RationalMode = isOn(SW_RATIONAL) ? (Off(SW_RATIONAL), 1) : 0;
188 if (h < 0)
189 {
190 sign = -1;
191 h = -h;
192 }
193 else
194 sign = 1;
195 while (h != 0)
196 {
197 CanonicalForm k = h % (
int)
base;
198 vec.push_back(static_cast<int>(k.intval()));
200 }
201 if (RationalMode) On(SW_RATIONAL);
202 }
205 for (int i = vec.size() - 1; i >= 0; i--)
206 {
208 mpz_add_ui(
x,
x,
static_cast<unsigned>(vec[i]));
209 }
210 if (sign == -1) mpz_neg(
x,
x);
212}
static CanonicalForm base
typename std::vector< T, gc_allocator< T > > gc_vector
a version of the STL vector, which allocates its backing memory with gc.