Motr  M0
parity_ops.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2012-2021 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_SNS_PARITY_OPS_H__
26 #define __MOTR_SNS_PARITY_OPS_H__
27 
28 #ifndef __KERNEL__
29 #include <isa-l.h>
30 #endif /* __KERNEL__ */
31 #include "lib/assert.h"
32 
33 #define M0_PARITY_ZERO (0)
34 #define M0_PARITY_GALOIS_W (8)
35 
36 typedef int m0_parity_elem_t;
37 
40 
42 {
43  return x ^ y;
44 }
45 
47 {
48  return x ^ y;
49 }
50 
52 {
53 #ifndef __KERNEL__
54  return gf_mul(x, y);
55 #else
56  return 0;
57 #endif /* __KERNEL__ */
58 }
59 
61 {
62 #ifndef __KERNEL__
63  return gf_mul(x, gf_inv(y));
64 #else
65  return 0;
66 #endif /* __KERNEL__ */
67 }
68 
70 {
71  return x < y;
72 }
73 
75 {
76  return x > y;
77 }
78 
79 /* __MOTR_SNS_PARITY_OPS_H__ */
80 #endif
81 
82 /*
83  * Local variables:
84  * c-indentation-style: "K&R"
85  * c-basic-offset: 8
86  * tab-width: 8
87  * fill-column: 80
88  * scroll-step: 1
89  * End:
90  */
M0_INTERNAL m0_parity_elem_t m0_parity_pow(m0_parity_elem_t x, m0_parity_elem_t p)
Definition: parity_ops.c:30
static m0_parity_elem_t m0_parity_add(m0_parity_elem_t x, m0_parity_elem_t y)
Definition: parity_ops.h:41
static struct m0_addb2_philter p
Definition: consumer.c:40
static bool x
Definition: sm.c:168
static m0_parity_elem_t m0_parity_lt(m0_parity_elem_t x, m0_parity_elem_t y)
Definition: parity_ops.h:69
static m0_parity_elem_t m0_parity_gt(m0_parity_elem_t x, m0_parity_elem_t y)
Definition: parity_ops.h:74
static m0_parity_elem_t m0_parity_div(m0_parity_elem_t x, m0_parity_elem_t y)
Definition: parity_ops.h:60
int m0_parity_elem_t
Definition: parity_ops.h:36
static m0_parity_elem_t m0_parity_sub(m0_parity_elem_t x, m0_parity_elem_t y)
Definition: parity_ops.h:46
static m0_parity_elem_t m0_parity_mul(m0_parity_elem_t x, m0_parity_elem_t y)
Definition: parity_ops.h:51