From ba0fcd743244f65f4ab8a3872b1675f5246b8d97 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 30 Aug 2025 19:11:25 -0500 Subject: [PATCH] reorganize files and format --- include/bmath/bmath.hh | 6 ++++++ include/{bmath.hh => bmath/mint.hh} | 14 +++++++------- tests/test_bmath.cc | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 include/bmath/bmath.hh rename include/{bmath.hh => bmath/mint.hh} (95%) diff --git a/include/bmath/bmath.hh b/include/bmath/bmath.hh new file mode 100644 index 0000000..8c1b6d3 --- /dev/null +++ b/include/bmath/bmath.hh @@ -0,0 +1,6 @@ +#ifndef BMATH_BMATH_HH +#define BMATH_BMATH_HH + +#include "bmath/mint.hh" + +#endif diff --git a/include/bmath.hh b/include/bmath/mint.hh similarity index 95% rename from include/bmath.hh rename to include/bmath/mint.hh index 6e7881d..fc73e2c 100644 --- a/include/bmath.hh +++ b/include/bmath/mint.hh @@ -1,5 +1,7 @@ -#ifndef BMATH_HEADER_ONLY_MATH_LIB -#define BMATH_HEADER_ONLY_MATH_LIB +#ifndef BMATH_MINT_HH +#define BMATH_MINT_HH + +namespace bmath { #include #include @@ -7,11 +9,9 @@ #include #include -namespace bmath { - inline constexpr uint64_t DEFAULT_MOD = 1'000'000'007; -template (DEFAULT_MOD)> +template (DEFAULT_MOD)> requires(M > 0 && DEFAULT_MOD <= std::numeric_limits::max()) class mint { public: @@ -140,7 +140,7 @@ class mint { } }; -template +template requires(M > 0) [[nodiscard]] static constexpr bmath::mint pow(mint base, U exponent) { @@ -175,7 +175,7 @@ template return t; } -template +template requires(M > 0) [[nodiscard]] std::string to_string(mint const number) { return std::to_string(number.get()); diff --git a/tests/test_bmath.cc b/tests/test_bmath.cc index 2fd829c..8f0eb62 100644 --- a/tests/test_bmath.cc +++ b/tests/test_bmath.cc @@ -3,7 +3,7 @@ #include #include -#include "../include/bmath.hh" +#include "../include/bmath/bmath.hh" using namespace bmath;