hermann on Mon, 19 Jun 2023 02:19:57 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: void mpz_set_GEN(mpz_ptr z, GEN x) and GEN mpz_get_GEN(mpz_srcptr z)


On 2023-06-19 01:19, Max Alekseyev wrote:
For the time being I've been using the code from Karim, which is
available at
https://pari.math.u-bordeaux.fr/archives/pari-users-0712/msg00001.html

Regards,
Max

Thank you.
After adding missing semicolon, variable declaration and return statement, g++ compiled. I did some more changes to make cpplimt happy, as gist for investigating the unmap() error:
https://gist.github.com/Hermann-SW/6abf2866af5446a4b01ca0af7a45d99b

While it works, there is an unmap error on freeing resources.
How to fix that?

(I will not fix the >=80 character cpplint warnings for the 500000-digit oneline numbers in code)


pi@pi400-64:~/RSA_numbers_factored/c++ $ f=sqrtm1.smallest_known_1million_digit_prime pi@pi400-64:~/RSA_numbers_factored/c++ $ g++ $f.cc -lgmp -lgmpxx -O3 -o $f -lpari -DPARI
pi@pi400-64:~/RSA_numbers_factored/c++ $ ./$f
a = y^(-1) (mod p) [powm]; a *= x; a %= p
1.38958s
[M,V] = halfgcdii(sqrtm1, p)
1.58387s
[x,y] = [V[2], M[2,1]]
3e-06s
done
munmap_chunk(): invalid pointer
Aborted
pi@pi400-64:~/RSA_numbers_factored/c++ $ cpplint --filter=-legal/copyright sqrtm1.smallest_known_1million_digit_prime.cc sqrtm1.smallest_known_1million_digit_prime.cc:46: Lines should be <= 80 characters long [whitespace/line_length] [2] sqrtm1.smallest_known_1million_digit_prime.cc:47: Lines should be <= 80 characters long [whitespace/line_length] [2]
Done processing sqrtm1.smallest_known_1million_digit_prime.cc
Total errors found: 2
pi@pi400-64:~/RSA_numbers_factored/c++ $


Regards,

Hermann.