LMMP 4.3.0
Lamina High-Precision Arithmetic Library
载入中...
搜索中...
未找到
div_1.c 文件参考
#include "limb_sizes.h"
#include "mparam.h"
div_1.c 的引用(Include)关系图:

浏览该文件的源代码.

函数

static double bench_div_1 (mp_size_t n, const bench_options *o)
 Copyright (C) 2026 HJimmyK (Jericho Knox)
static double bench_div_1_s (mp_size_t n, const bench_options *o)
static double bench_mod_1 (mp_size_t n, const bench_options *o)
int main (void)

函数说明

◆ bench_div_1()

double bench_div_1 ( mp_size_t n,
const bench_options * o )
static

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

在文件 div_1.c 第 26 行定义.

26 {
27 mp_ptr a = alloc_limbs(n), q = alloc_limbs(n + 1);
28 fill_random(a, n, 0x0123456789abcdefull + n);
29 mp_limb_t x = 0x9e3779b97f4a7c15ull;
30 double us;
31 BENCH_MEASURE(us, o, bench_sink += lmmp_div_1_(q, a, n, x););
32 lmmp_free(a);
33 lmmp_free(q);
34 return us;
35}
mp_limb_t * mp_ptr
定义 lmmp.h:96
void lmmp_free(void *ptr)
内存释放函数(调用lmmp_heap_free_fn)
uint64_t mp_limb_t
定义 lmmp.h:92
mp_limb_t lmmp_div_1_(mp_ptr dstq, mp_srcptr numa, mp_size_t na, mp_limb_t x)
单精度数除法
定义 div.c:137
#define n
#define BENCH_MEASURE(result, options,...)
定义 perf.h:93

引用了 bench_div_1(), BENCH_MEASURE, lmmp_div_1_(), lmmp_free() , 以及 n.

被这些函数引用 bench_div_1() , 以及 main().

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

◆ bench_div_1_s()

double bench_div_1_s ( mp_size_t n,
const bench_options * o )
static

在文件 div_1.c 第 37 行定义.

37 {
38 mp_ptr a = alloc_limbs(n), q = alloc_limbs(n + 1);
39 fill_random(a, n, 0x0123456789abcdf1ull + n);
40 mp_limb_t x = 0x9e3779b97f4a7c15ull | LIMB_B_2;
41 double us;
42 BENCH_MEASURE(us, o,
43 mp_limb_t save = a[0];
44 bench_sink += lmmp_div_1_s_(q, a, n, x);
45 a[0] = save;
46 );
47 lmmp_free(a);
48 lmmp_free(q);
49 return us;
50}
#define LIMB_B_2
mp_limb_t lmmp_div_1_s_(mp_ptr dstq, mp_ptr numa, mp_size_t na, mp_limb_t x)
单精度数除法(除数为1个limb)

引用了 bench_div_1_s(), BENCH_MEASURE, LIMB_B_2, lmmp_div_1_s_(), lmmp_free() , 以及 n.

被这些函数引用 bench_div_1_s() , 以及 main().

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

◆ bench_mod_1()

double bench_mod_1 ( mp_size_t n,
const bench_options * o )
static

在文件 div_1.c 第 52 行定义.

52 {
53 mp_ptr a = alloc_limbs(n);
54 fill_random(a, n, 0x3141592653589793ull + n);
55 mp_limb_t x = 0x9e3779b97f4a7c15ull;
56 double us;
57 BENCH_MEASURE(us, o, bench_sink += lmmp_mod_1_(a, n, x););
58 lmmp_free(a);
59 return us;
60}
mp_limb_t lmmp_mod_1_(mp_srcptr numa, mp_size_t na, mp_limb_t x)
单精度数取余
定义 div.c:38

引用了 BENCH_MEASURE, bench_mod_1(), lmmp_free(), lmmp_mod_1_() , 以及 n.

被这些函数引用 bench_mod_1() , 以及 main().

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

◆ main()

int main ( void )

在文件 div_1.c 第 62 行定义.

62 {
63 setvbuf(stdout, NULL, _IONBF, 0);
65 puts("[lmmpn/div_1]");
66 run_limb_sizes("div_1", bench_div_1);
67 run_limb_sizes("div_1_s", bench_div_1_s);
68 run_limb_sizes("mod_1", bench_mod_1);
70 return 0;
71}
static double bench_mod_1(mp_size_t n, const bench_options *o)
定义 div_1.c:52
static double bench_div_1(mp_size_t n, const bench_options *o)
Copyright (C) 2026 HJimmyK (Jericho Knox)
定义 div_1.c:26
static double bench_div_1_s(mp_size_t n, const bench_options *o)
定义 div_1.c:37
void lmmp_global_init(void)
全局初始化函数(线程局部的)
void lmmp_global_deinit(void)
全局释放函数(线程局部的)

引用了 bench_div_1(), bench_div_1_s(), bench_mod_1(), lmmp_global_deinit(), lmmp_global_init() , 以及 main().

函数调用图: