Macaulay2 Engine
Loading...
Searching...
No Matches

◆ ntl_ZZ_to_mpz()

void ntl_ZZ_to_mpz ( mpz_t result,
const NTL::ZZ & a )
extern

Definition at line 12 of file ntl-internal.cpp.

19{
20 if (a == 0)
21 {
22 mpz_set_ui(result, 0);
23 return;
24 }
25
26 long len = NTL::NumBytes(a);
27 unsigned char *byte_array = new unsigned char[len];
28 bool is_neg = (a < 0);
29 NTL::BytesFromZZ(byte_array, a, len);
30 mpz_import(result, len, -1, sizeof(byte_array[0]), 0, 0, byte_array);
31 delete[] byte_array;
32 if (is_neg) mpz_neg(result, result);
33}
VALGRIND_MAKE_MEM_DEFINED & result(result)

References result().

Referenced by mat_ZZ_get_entry().