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

浏览该文件的源代码.

函数

static double bench_shl (mp_size_t n, const bench_options *o)
 Copyright (C) 2026 HJimmyK (Jericho Knox)
static double bench_shlnot (mp_size_t n, const bench_options *o)
static double bench_shr (mp_size_t n, const bench_options *o)
int main (void)

函数说明

◆ bench_shl()

double bench_shl ( 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

在文件 shift.c 第 25 行定义.

25 {
26 mp_ptr a = alloc_limbs(n), d = alloc_limbs(n);
27 fill_random(a, n, 0x9192939495969798ull + n);
28 double us;
29 BENCH_MEASURE(us, o, bench_sink += lmmp_shl_(d, a, n, 13););
30 lmmp_free(a);
31 lmmp_free(d);
32 return us;
33}
mp_limb_t * mp_ptr
定义 lmmp.h:96
void lmmp_free(void *ptr)
内存释放函数(调用lmmp_heap_free_fn)
mp_limb_t lmmp_shl_(mp_ptr dst, mp_srcptr numa, mp_size_t na, mp_size_t shl)
左移操作 [dst,na] = [numa,na]<<shl,dst的低shl位填充0
定义 shl.c:26
#define n
#define BENCH_MEASURE(result, options,...)
定义 perf.h:93

引用了 BENCH_MEASURE, bench_shl(), lmmp_free(), lmmp_shl_() , 以及 n.

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

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

◆ bench_shlnot()

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

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

45 {
46 mp_ptr a = alloc_limbs(n), d = alloc_limbs(n);
47 fill_random(a, n, 0xb1b2b3b4b5b6b7b8ull + n);
48 double us;
49 BENCH_MEASURE(us, o, bench_sink += lmmp_shlnot_(d, a, n, 13););
50 lmmp_free(a);
51 lmmp_free(d);
52 return us;
53}
mp_limb_t lmmp_shlnot_(mp_ptr dst, mp_srcptr numa, mp_size_t na, mp_size_t shl)
左移后按位取反操作 [dst,na] = ~([numa,na] << shl),dst的低shl位填充1

引用了 BENCH_MEASURE, bench_shlnot(), lmmp_free(), lmmp_shlnot_() , 以及 n.

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

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

◆ bench_shr()

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

在文件 shift.c 第 35 行定义.

35 {
36 mp_ptr a = alloc_limbs(n), d = alloc_limbs(n);
37 fill_random(a, n, 0xa1a2a3a4a5a6a7a8ull + n);
38 double us;
39 BENCH_MEASURE(us, o, bench_sink += lmmp_shr_(d, a, n, 13););
40 lmmp_free(a);
41 lmmp_free(d);
42 return us;
43}
mp_limb_t lmmp_shr_(mp_ptr dst, mp_srcptr numa, mp_size_t na, mp_size_t shr)
右移操作 [dst,na] = [numa,na]>>shr,dst的高shr位填充0
定义 shr.c:26

引用了 BENCH_MEASURE, bench_shr(), lmmp_free(), lmmp_shr_() , 以及 n.

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

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

◆ main()

int main ( void )

在文件 shift.c 第 55 行定义.

55 {
56 setvbuf(stdout, NULL, _IONBF, 0);
58 puts("[lmmpn/shift]");
59 run_limb_sizes("shl", bench_shl);
60 run_limb_sizes("shr", bench_shr);
61 run_limb_sizes("shlnot", bench_shlnot);
63 return 0;
64}
void lmmp_global_init(void)
全局初始化函数(线程局部的)
void lmmp_global_deinit(void)
全局释放函数(线程局部的)
static double bench_shl(mp_size_t n, const bench_options *o)
Copyright (C) 2026 HJimmyK (Jericho Knox)
定义 shift.c:25
static double bench_shlnot(mp_size_t n, const bench_options *o)
定义 shift.c:45
static double bench_shr(mp_size_t n, const bench_options *o)
定义 shift.c:35

引用了 bench_shl(), bench_shlnot(), bench_shr(), lmmp_global_deinit(), lmmp_global_init() , 以及 main().

函数调用图: