Intel HEXL
Intel Homomorphic Encryption Acceleration Library, accelerating the modular arithmetic operations used in homomorphic encryption.
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 namespace intel {
7 namespace hexl {
8 
9 #undef TRUE // MSVC defines TRUE
10 #undef FALSE // MSVC defines FALSE
11 
14 enum class CMPINT {
15  EQ = 0,
16  LT = 1,
17  LE = 2,
18  FALSE = 3,
19  NE = 4,
20  NLT = 5,
21  NLE = 6,
22  TRUE = 7
23 };
24 
27 inline CMPINT Not(CMPINT cmp) {
28  switch (cmp) {
29  case CMPINT::EQ:
30  return CMPINT::NE;
31  case CMPINT::LT:
32  return CMPINT::NLT;
33  case CMPINT::LE:
34  return CMPINT::NLE;
35  case CMPINT::FALSE:
36  return CMPINT::TRUE;
37  case CMPINT::NE:
38  return CMPINT::EQ;
39  case CMPINT::NLT:
40  return CMPINT::LT;
41  case CMPINT::NLE:
42  return CMPINT::LE;
43  case CMPINT::TRUE:
44  return CMPINT::FALSE;
45  default:
46  return CMPINT::FALSE;
47  }
48 }
49 
50 } // namespace hexl
51 } // namespace intel
intel::hexl::CMPINT::LT
@ LT
Less than.
intel::hexl::CMPINT::NLT
@ NLT
Not less than.
intel::hexl::CMPINT::NLE
@ NLE
Not less than or equal.
intel::hexl::CMPINT::NE
@ NE
Not equal.
intel::hexl::CMPINT
CMPINT
Represents binary operations between two boolean values.
Definition: util.hpp:14
intel::hexl::Not
CMPINT Not(CMPINT cmp)
Returns the logical negation of a binary operation.
Definition: util.hpp:27
intel::hexl::CMPINT::LE
@ LE
Less than or equal.
intel
Definition: eltwise-add-mod.hpp:8
intel::hexl::CMPINT::EQ
@ EQ
Equal.
intel::hexl::CMPINT::TRUE
@ TRUE
True.
intel::hexl::CMPINT::FALSE
@ FALSE
False.