LAMMP
4.1.0
Lamina High-Precision Arithmetic Library
载入中...
搜索中...
未找到
not.c
浏览该文件的文档.
1
/*
2
* LAMMP - Copyright (C) 2025-2026 HJimmyK(Jericho Knox)
3
* This file is part of lammp, under the GNU LGPL v2 license.
4
* See LICENSE in the project root for the full license text.
5
*/
6
7
#include "../../../include/lammp/lmmpn.h"
8
9
void
lmmp_not_
(
mp_ptr
restrict dst,
mp_srcptr
restrict numa,
mp_size_t
na) {
10
if
(dst == numa) {
11
for
(
mp_size_t
i = 0; i < na; i++) {
12
dst[i] = ~dst[i];
13
}
14
}
else
{
15
for
(
mp_size_t
i = 0; i < na; i++) {
16
dst[i] = ~numa[i];
17
}
18
}
19
}
20
21
mp_limb_t
lmmp_shlnot_
(
mp_ptr
restrict dst,
mp_srcptr
restrict numa,
mp_size_t
na,
mp_size_t
shl) {
22
if
(shl == 0) {
23
lmmp_not_
(dst, numa, na);
24
return
0;
25
}
else
if
(dst == numa) {
26
mp_limb_t
t, m, n;
27
t = dst[0] << shl;
28
m = dst[0] >> (
LIMB_BITS
- shl);
29
dst[0] = ~t;
30
for
(
mp_size_t
i = 1; i < na; i++) {
31
t = dst[i] << shl;
32
n = dst[i] >> (
LIMB_BITS
- shl);
33
dst[i] = ~(t | m);
34
m = n;
35
}
36
return
m;
37
}
else
{
38
/* seq(dst,numa) */
39
mp_limb_t
t, m, n;
40
t = numa[0] << shl;
41
m = numa[0] >> (
LIMB_BITS
- shl);
42
dst[0] = ~t;
43
for
(
mp_size_t
i = 1; i < na; i++) {
44
t = numa[i] << shl;
45
n = numa[i] >> (
LIMB_BITS
- shl);
46
dst[i] = ~(t | m);
47
m = n;
48
}
49
return
m;
50
}
51
}
mp_ptr
mp_limb_t * mp_ptr
Definition
lmmp.h:215
mp_size_t
uint64_t mp_size_t
Definition
lmmp.h:212
mp_srcptr
const mp_limb_t * mp_srcptr
Definition
lmmp.h:216
mp_limb_t
uint64_t mp_limb_t
Definition
lmmp.h:211
LIMB_BITS
#define LIMB_BITS
Definition
lmmp.h:221
lmmp_shlnot_
mp_limb_t lmmp_shlnot_(mp_ptr restrict dst, mp_srcptr restrict numa, mp_size_t na, mp_size_t shl)
Definition
not.c:21
lmmp_not_
void lmmp_not_(mp_ptr restrict dst, mp_srcptr restrict numa, mp_size_t na)
Definition
not.c:9
src
lammp
generic
not.c
生成于 2026年 五月 24日 星期日 20:48:59 , 为 LAMMP使用
1.9.8