Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/sun/security/ec/impl/mplogic.h
38918 views
1
/*
2
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
3
* Use is subject to license terms.
4
*
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
9
*
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public License
16
* along with this library; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/* *********************************************************************
25
*
26
* The Original Code is the MPI Arbitrary Precision Integer Arithmetic library.
27
*
28
* The Initial Developer of the Original Code is
29
* Michael J. Fromberger.
30
* Portions created by the Initial Developer are Copyright (C) 1998
31
* the Initial Developer. All Rights Reserved.
32
*
33
* Contributor(s):
34
*
35
*********************************************************************** */
36
37
/* Bitwise logical operations on MPI values */
38
39
#ifndef _MPLOGIC_H
40
#define _MPLOGIC_H
41
42
/* $Id: mplogic.h,v 1.7 2004/04/27 23:04:36 gerv%gerv.net Exp $ */
43
44
#include "mpi.h"
45
46
/*
47
The logical operations treat an mp_int as if it were a bit vector,
48
without regard to its sign (an mp_int is represented in a signed
49
magnitude format). Values are treated as if they had an infinite
50
string of zeros left of the most-significant bit.
51
*/
52
53
/* Parity results */
54
55
#define MP_EVEN MP_YES
56
#define MP_ODD MP_NO
57
58
/* Bitwise functions */
59
60
mp_err mpl_not(mp_int *a, mp_int *b); /* one's complement */
61
mp_err mpl_and(mp_int *a, mp_int *b, mp_int *c); /* bitwise AND */
62
mp_err mpl_or(mp_int *a, mp_int *b, mp_int *c); /* bitwise OR */
63
mp_err mpl_xor(mp_int *a, mp_int *b, mp_int *c); /* bitwise XOR */
64
65
/* Shift functions */
66
67
mp_err mpl_rsh(const mp_int *a, mp_int *b, mp_digit d); /* right shift */
68
mp_err mpl_lsh(const mp_int *a, mp_int *b, mp_digit d); /* left shift */
69
70
/* Bit count and parity */
71
72
mp_err mpl_num_set(mp_int *a, int *num); /* count set bits */
73
mp_err mpl_num_clear(mp_int *a, int *num); /* count clear bits */
74
mp_err mpl_parity(mp_int *a); /* determine parity */
75
76
/* Get & Set the value of a bit */
77
78
mp_err mpl_set_bit(mp_int *a, mp_size bitNum, mp_size value);
79
mp_err mpl_get_bit(const mp_int *a, mp_size bitNum);
80
mp_err mpl_get_bits(const mp_int *a, mp_size lsbNum, mp_size numBits);
81
mp_err mpl_significant_bits(const mp_int *a);
82
83
#endif /* _MPLOGIC_H */
84
85