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

浏览该文件的源代码.

函数

static double bench_div (mp_size_t a, mp_size_t b, const bench_options *o)
 Copyright (C) 2026 HJimmyK (Jericho Knox)
int main (void)
static void run_div (void)

函数说明

◆ bench_div()

double bench_div ( mp_size_t a,
mp_size_t b,
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.c 第 26 行定义.

26 {
27 if (a < b) {
28 mp_size_t t = a;
29 a = b;
30 b = t;
31 }
32 mp_ptr numa = alloc_limbs(a), numb = alloc_limbs(b);
33 mp_ptr q = alloc_limbs(a - b + 1), r = alloc_limbs(b);
34 fill_random(numa, a, 0x0123456789abcdefull + a * 31 + b);
35 fill_random(numb, b, 0xfedcba9876543210ull + b * 17 + a);
36 double us;
37 BENCH_MEASURE(us, o, lmmp_div_(q, r, numa, a, numb, b););
38 lmmp_free(numa);
40 lmmp_free(q);
41 lmmp_free(r);
42 return us;
43}
mp_limb_t * mp_ptr
定义 lmmp.h:96
uint64_t mp_size_t
定义 lmmp.h:93
void lmmp_free(void *ptr)
内存释放函数(调用lmmp_heap_free_fn)
void lmmp_div_(mp_ptr dstq, mp_ptr dstr, mp_srcptr numa, mp_size_t na, mp_srcptr numb, mp_size_t nb)
除法和取模操作
定义 div.c:85
#define t
#define numb
#define BENCH_MEASURE(result, options,...)
定义 perf.h:93

引用了 bench_div(), BENCH_MEASURE, lmmp_div_(), lmmp_free(), numb , 以及 t.

被这些函数引用 bench_div() , 以及 run_div().

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

◆ main()

int main ( void )

在文件 div.c 第 51 行定义.

51 {
52 setvbuf(stdout, NULL, _IONBF, 0);
54 puts("[lmmpn/div/div]");
55 run_div();
57 return 0;
58}
void lmmp_global_init(void)
全局初始化函数(线程局部的)
void lmmp_global_deinit(void)
全局释放函数(线程局部的)
static void run_div(void)
定义 div.c:45

引用了 lmmp_global_deinit(), lmmp_global_init(), main() , 以及 run_div().

函数调用图:

◆ run_div()

void run_div ( void )
static

在文件 div.c 第 45 行定义.

45 {
46 report_ab("div", 2000, 1000, bench_div(2000, 1000, &bench_default), 0);
47 report_ab("div", 1000, 7, bench_div(1000, 7, &bench_default), 0);
48 report_ab("div", 10000, 700, bench_div(10000, 700, &bench_default), 0);
49}
static double bench_div(mp_size_t a, mp_size_t b, const bench_options *o)
Copyright (C) 2026 HJimmyK (Jericho Knox)
定义 div.c:26

引用了 bench_div() , 以及 run_div().

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

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