Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try refactor distances #322

Merged
merged 15 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions examples/example008_miller_rabin_prime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,19 @@ namespace local_example008_miller_rabin_prime

auto example008_miller_rabin_prime_check_known_primes() -> bool
{
#if (defined(_MSC_VER) && defined(_DEBUG))
using known_primes_array_type = std::array<wide_integer_type, static_cast<std::size_t>(UINT8_C(4))>;
#else
using known_primes_array_type = std::array<wide_integer_type, static_cast<std::size_t>(UINT8_C(28))>;
#endif

const known_primes_array_type known_primes =
{
wide_integer_type("1350668399695862095705378871871078275422204299410029680022807229578447177486838048356600483814274341298941322922278646278082691661579262242972653147843881"),
wide_integer_type("6316533715112802448288092604478054524383926634811945757057640178392735989589363869889681632218704486270766492727631128625563552112105808239098327091824521"),
wide_integer_type("4858586217250992689079636758246308353014067931891277522662097117263017348927716654355835947116278934662184099633799310227887262043463022049904058963602113"),
wide_integer_type("6019419207947545798517327619748393618031791796951797411174747320842950599875485354843571998416270218797959087329922954007679373990444302239974053043273173"),
#if !(defined(_MSC_VER) && defined(_DEBUG))
wide_integer_type("2623115045263242825415413671896042727657332322988674224271913776550889477454553016178535650310812678634291673863620916079255756983038819930429300055323617"),
wide_integer_type("3003848015480415325081996052076028272879191508991266945638241025854760400469061295504211346716924852976586414875652009123799821021749062743721323009536589"),
wide_integer_type("5568337324913975213045841890066332347573591111951280366169746765603974031759890673193278087261510160253710813073898966574448941498158599660295718450413969"),
Expand All @@ -136,6 +141,7 @@ namespace local_example008_miller_rabin_prime
wide_integer_type("6297032304320012154880388332146509431687962719889593388307760834122241251586999352542604072606959905346551948057937113980815914420810768937615250771878461"),
wide_integer_type("6128722501467469312821769346772700466471416838690252468887811095595451174847178063191879577266340073924505285489011360630545669076007556359186484284685741"),
wide_integer_type("5334118887555315545538097460404232946047447099403008196978701351362864400468260258361331949883359663365575253347639015242447351434717477630139194429944273")
#endif
};

random_engine1_type generator(time_point<typename random_engine1_type::result_type>());
Expand Down Expand Up @@ -165,14 +171,18 @@ auto ::math::wide_integer::example008_miller_rabin_prime() -> bool
#endif
{
auto result_is_ok = true;

for(auto i = static_cast<unsigned>(UINT8_C(0));
#if (defined(_MSC_VER) && defined(_DEBUG))
i < static_cast<unsigned>(UINT8_C(1));
#else
i < static_cast<unsigned>(UINT8_C(8));
#endif
++i)
{
const auto result_prime_run_is_ok =
local_example008_miller_rabin_prime::example008_miller_rabin_prime_run();

result_is_ok = (result_prime_run_is_ok && result_is_ok);
}

Expand Down
3 changes: 3 additions & 0 deletions examples/example008a_miller_rabin_prime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
#if (defined(__GNUC__) && !defined(__clang__) && (__GNUC__ >= 12))
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wrestrict"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif

#if (BOOST_VERSION < 108000)
Expand Down Expand Up @@ -210,6 +212,7 @@ auto main() -> int // NOLINT(bugprone-exception-escape)

#if (defined(__GNUC__) && !defined(__clang__) && (__GNUC__ >= 12))
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
#endif

#if (BOOST_VERSION < 108000)
Expand Down
Loading