Intel HEXL
Intel Homomorphic Encryption Acceleration Library, accelerating the modular arithmetic operations used in homomorphic encryption.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
util.hpp
Go to the documentation of this file.
1 // Copyright (C) 2020-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 
4 #pragma once
5 
6 #include <cstddef>
7 
8 namespace intel {
9 namespace hexl {
10 
11 #undef TRUE // MSVC defines TRUE
12 #undef FALSE // MSVC defines FALSE
13 
16 enum class CMPINT {
17  EQ = 0,
18  LT = 1,
19  LE = 2,
20  FALSE = 3,
21  NE = 4,
22  NLT = 5,
23  NLE = 6,
24  TRUE = 7
25 };
26 
29 inline CMPINT Not(CMPINT cmp) {
30  switch (cmp) {
31  case CMPINT::EQ:
32  return CMPINT::NE;
33  case CMPINT::LT:
34  return CMPINT::NLT;
35  case CMPINT::LE:
36  return CMPINT::NLE;
37  case CMPINT::FALSE:
38  return CMPINT::TRUE;
39  case CMPINT::NE:
40  return CMPINT::EQ;
41  case CMPINT::NLT:
42  return CMPINT::LT;
43  case CMPINT::NLE:
44  return CMPINT::LE;
45  case CMPINT::TRUE:
46  return CMPINT::FALSE;
47  default:
48  return CMPINT::FALSE;
49  }
50 }
51 
52 } // namespace hexl
53 } // namespace intel
CMPINT
Represents binary operations between two boolean values.
Definition: util.hpp:16
CMPINT Not(CMPINT cmp)
Returns the logical negation of a binary operation.
Definition: util.hpp:29
Definition: eltwise-add-mod.hpp:8
Not less than or equal.
Less than or equal.