LAMMP 4.2.0
Lamina High-Precision Arithmetic Library
载入中...
搜索中...
未找到
gcd_1.c 文件参考
+ gcd_1.c 的引用(Include)关系图:

浏览源代码.

函数

mp_limb_t lmmp_gcd_11_ (mp_limb_t u, mp_limb_t v)
 Copyright (C) 2026 HJimmyK(Jericho Knox)
 
mp_limb_t lmmp_gcd_1_ (mp_srcptr up, mp_size_t un, mp_limb_t vlimb)
 计算两个无符号整数的最大公约数
 

函数说明

◆ lmmp_gcd_11_()

mp_limb_t lmmp_gcd_11_ ( mp_limb_t  u,
mp_limb_t  v 
)

Copyright (C) 2026 HJimmyK(Jericho Knox)

计算两个无符号整数的最大公约数

This file is part of LAMMP.

LAMMP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed WITHOUT ANY WARRANTY.

See https://www.gnu.org/licenses/.

在文件 gcd_1.c24 行定义.

24 {
25 lmmp_param_assert(u > 0 && v > 0);
26 int count, k;
30 while (u != v) {
31 if (u > v) {
32 u -= v;
34 u >>= count;
35 } else {
36 v -= u;
38 v >>= count;
39 }
40 }
41 return u << k;
42}
#define k
#define lmmp_tailing_zeros_
Definition inlines.h:161
#define lmmp_param_assert(x)
Definition lmmp.h:401
#define n

引用了 k, lmmp_param_assert, lmmp_tailing_zeros_ , 以及 n.

被这些函数引用 lmmp_gcd_1_(), lmmp_gcd_22_() , 以及 lmmp_gcd_lehmer_().

+ 这是这个函数的调用关系图:

◆ lmmp_gcd_1_()

mp_limb_t lmmp_gcd_1_ ( mp_srcptr  up,
mp_size_t  un,
mp_limb_t  vlimb 
)

计算两个无符号整数的最大公约数

参数
up第一个无符号整数指针
un第一个无符号整数的 limb 长度
v第二个无符号整数
警告
v!=0, up!=NULL, un>0
返回
最大公约数

在文件 gcd_1.c44 行定义.

44 {
48 if (un == 1) {
49 ulimb = up[0];
50 } else {
52 }
53 if (ulimb == 0)
54 return vlimb;
55 else
56 return lmmp_gcd_11_(ulimb, vlimb);
57}
mp_limb_t lmmp_gcd_11_(mp_limb_t u, mp_limb_t v)
Copyright (C) 2026 HJimmyK(Jericho Knox)
Definition gcd_1.c:24
uint64_t mp_limb_t
Definition lmmp.h:76
mp_limb_t lmmp_mod_1_(mp_srcptr numa, mp_size_t na, mp_limb_t x)
单精度数取余
Definition div.c:31

引用了 lmmp_gcd_11_(), lmmp_mod_1_(), lmmp_param_assert , 以及 n.

被这些函数引用 lmmp_gcd_lehmer_().

+ 函数调用图:
+ 这是这个函数的调用关系图: