LAMMP
4.2.0
Lamina High-Precision Arithmetic Library
载入中...
搜索中...
未找到
not.c
浏览该文件的文档.
1
/**
2
* Copyright (C) 2026 HJimmyK(Jericho Knox)
3
*
4
* This file is part of LAMMP.
5
*
6
* LAMMP is free software: you can redistribute it and/or modify it under
7
* the terms of the GNU Lesser General Public License (LGPL) as published
8
* by the Free Software Foundation; either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed WITHOUT ANY WARRANTY.
12
*
13
* See <https://www.gnu.org/licenses/>.
14
*/
15
16
#include "../../../../include/lammp/lmmpn.h"
17
18
19
void
lmmp_not_
(
mp_ptr
restrict
dst
,
mp_srcptr
restrict
numa
,
mp_size_t
na
) {
20
if
(
dst
==
numa
) {
21
for
(
mp_size_t
i
= 0;
i
<
na
;
i
++) {
22
dst
[
i
] =
~dst
[
i
];
23
}
24
}
else
{
25
for
(
mp_size_t
i
= 0;
i
<
na
;
i
++) {
26
dst
[
i
] =
~numa
[
i
];
27
}
28
}
29
}
30
31
mp_limb_t
lmmp_shlnot_
(
mp_ptr
restrict
dst
,
mp_srcptr
restrict
numa
,
mp_size_t
na
,
mp_size_t
shl
) {
32
if
(
shl
== 0) {
33
lmmp_not_
(
dst
,
numa
,
na
);
34
return
0;
35
}
else
if
(
dst
==
numa
) {
36
mp_limb_t
t
,
m
,
n
;
37
t
=
dst
[0] <<
shl
;
38
m
=
dst
[0] >> (
LIMB_BITS
-
shl
);
39
dst
[0] =
~t
;
40
for
(
mp_size_t
i
= 1;
i
<
na
;
i
++) {
41
t
=
dst
[
i
] <<
shl
;
42
n
=
dst
[
i
] >> (
LIMB_BITS
-
shl
);
43
dst
[
i
] = ~(
t
|
m
);
44
m
=
n
;
45
}
46
return
m
;
47
}
else
{
48
/* seq(dst,numa) */
49
mp_limb_t
t
,
m
,
n
;
50
t
=
numa
[0] <<
shl
;
51
m
=
numa
[0] >> (
LIMB_BITS
-
shl
);
52
dst
[0] =
~t
;
53
for
(
mp_size_t
i
= 1;
i
<
na
;
i
++) {
54
t
=
numa
[
i
] <<
shl
;
55
n
=
numa
[
i
] >> (
LIMB_BITS
-
shl
);
56
dst
[
i
] = ~(
t
|
m
);
57
m
=
n
;
58
}
59
return
m
;
60
}
61
}
mp_ptr
mp_limb_t * mp_ptr
Definition
lmmp.h:80
mp_size_t
uint64_t mp_size_t
Definition
lmmp.h:77
mp_srcptr
const mp_limb_t * mp_srcptr
Definition
lmmp.h:81
mp_limb_t
uint64_t mp_limb_t
Definition
lmmp.h:76
LIMB_BITS
#define LIMB_BITS
Definition
lmmp.h:86
t
#define t
n
#define n
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:31
lmmp_not_
void lmmp_not_(mp_ptr restrict dst, mp_srcptr restrict numa, mp_size_t na)
Copyright (C) 2026 HJimmyK(Jericho Knox)
Definition
not.c:19
src
lammp
lmmpn
generic
not.c
生成于 2026年 七月 12日 星期日 17:45:47 , 为 LAMMP使用
1.9.8