Skip to content

Instantly share code, notes, and snippets.

@zao

zao/foo.cc Secret

Created May 19, 2017 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zao/2d24ac9c64eced8cba383021656ddfa1 to your computer and use it in GitHub Desktop.
Save zao/2d24ac9c64eced8cba383021656ddfa1 to your computer and use it in GitHub Desktop.
gmp internal test
#include <gmp.h>
#include <iostream>
int main() {
char const* num_txt = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
mpz_t val;
mpz_init(val);
mpz_set_str(val, num_txt, 10);
std::cout << val->_mp_alloc << " " << val->_mp_size;
for (int i = 0; i < val->_mp_size; ++i) {
std::cout << " " << val->_mp_d[i];
}
std::cout << std::endl;
mpz_clear(val);
}
# linux x64
8 7 12452437124710337234 2611262471272132939 15630345249402087766 9339789103780865020 14754621954512757346 5621736131476475232 31332614993508
# freebsd pi2
15 14 3460238034 2899308950 4017877323 607981921 4082329942 3639223344 2683053052 2174589108 2313790050 3435328126 4053945696 1308912441 828569188 7295
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment