|
LMMP 4.3.0
Lamina High-Precision Arithmetic Library
|
#include "impl/inlines.h"#include "impl/longlong.h"#include "mparam.h"#include "lmmp/lmmpn.h"#include "lmmp/numth.h"宏定义 | |
| #define | MONT63_MAX ((ulong)(0x7fffffffffffffff)) |
| Copyright (C) 2026 HJimmyK (Jericho Knox) | |
函数 | |
| static ulong | from_mont63 (ulong x, ulong m, ulong m_inv) |
| static ulong | from_mont64 (ulong x, ulong m, ulong m_inv) |
| uint | lmmp_powmod_uint_odd_ (uint base, ulong exp, uint mod) |
| 计算 base^exp 对 mod 取模 | |
| ulong | lmmp_powmod_ulong_odd_ (ulong base, ulong exp, ulong mod) |
| 计算 base^exp 对 mod 取模 | |
| static ulong | mont63_mul (ulong a, ulong b, ulong m, ulong m_inv) |
| static ulong | mont63_R2 (ulong m) |
| static ulong | mont63_reduce (u128 t, ulong m, ulong m_inv) |
| static ulong | mont64_mul (ulong a, ulong b, ulong m, ulong m_inv) |
| static ulong | mont64_R2 (ulong m) |
| static ulong | mont64_reduce (u128 t, ulong m, ulong m_inv) |
| static ulong | mont_R2 (ulong m) |
| static ulong | to_mont63 (ulong x, ulong R2, ulong m, ulong m_inv) |
| static ulong | to_mont64 (ulong x, ulong R2, ulong m, ulong m_inv) |
| #define MONT63_MAX ((ulong)(0x7fffffffffffffff)) |
Copyright (C) 2026 HJimmyK (Jericho Knox)
This file is part of LMMP.
LMMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library. If not, see https://www.gnu.org/licenses/.
SPDX-License-Identifier: LGPL-3.0-or-later
在文件 powmod_ulong.c 第 35 行定义.
在文件 powmod_ulong.c 第 86 行定义.
引用了 from_mont63() , 以及 mont63_reduce().
被这些函数引用 from_mont63() , 以及 lmmp_powmod_ulong_odd_().
在文件 powmod_ulong.c 第 62 行定义.
引用了 from_mont64() , 以及 mont64_reduce().
被这些函数引用 from_mont64() , 以及 lmmp_powmod_ulong_odd_().
计算 base^exp 对 mod 取模
| base | 底数 |
| exp | 指数 |
| mod | 模数 |
在文件 powmod_ulong.c 第 94 行定义.
引用了 _udiv64_gen(), _udiv64by64_q_preinv(), lmmp_param_assert , 以及 lmmp_powmod_uint_odd_().
被这些函数引用 lmmp_mulmod_ulong_(), lmmp_powmod_uint_odd_(), lmmp_powmod_ulong_odd_() , 以及 TEST_CASE().
计算 base^exp 对 mod 取模
| base | 底数 |
| exp | 指数 |
| mod | 模数 |
在文件 powmod_ulong.c 第 118 行定义.
引用了 from_mont63(), from_mont64(), lmmp_binvert_ulong_(), lmmp_param_assert, lmmp_powmod_uint_odd_(), lmmp_powmod_ulong_odd_(), MONT63_MAX, mont63_mul(), mont63_R2(), mont64_mul(), mont64_R2(), MP_UINT_MAX, to_mont63() , 以及 to_mont64().
被这些函数引用 lmmp_mulmod_ulong_(), lmmp_powmod_ulong_odd_() , 以及 TEST_CASE().
在文件 powmod_ulong.c 第 37 行定义.
引用了 k, mont64_reduce() , 以及 t.
在文件 powmod_ulong.c 第 48 行定义.
引用了 _bpow_preinv_(), clz_shl_u64, lmmp_inv_1_() , 以及 mont_R2().