blob: f8919c9ad050008fe6f7bf9eb0e2de4112aa02d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#pragma once
#include "mod_wrapper.h"
#include <cstdint>
#include <limits>
namespace mod {
template <typename M_, M_ MOD_> struct ModBaseT {
using M = M_;
static constexpr M MOD = MOD_;
static_assert((MOD - 1) <= (std::numeric_limits<M_>::max() >> 1));
private:
using M2 = m2_t<M>;
public:
static constexpr M reduce(M2 x) { return x % MOD; }
};
template <uint64_t M> using Mod64T = ModWrapperT<ModBaseT<uint64_t, M>>;
template <uint32_t M> using ModT = ModWrapperT<ModBaseT<uint32_t, M>>;
} // namespace mod
using mod::Mod64T;
using mod::ModT;
|