ComputeFHE 1.0
General-Purpose Privacy-Preserving Computation Library for TFHE
Loading...
Searching...
No Matches
ConditionManager.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026 Faris Serdar Taşel <fst@cankaya.edu.tr>
3 * SPDX-FileCopyrightText: 2026 Efe Çiftci <efeciftci@cankaya.edu.tr>
4 *
5 * SPDX-License-Identifier: MIT
6 */
7
14#pragma once
16#include <stack>
17#include <unordered_map>
18
19using namespace std;
20
47#define Eif(cond) \
48 for (ConditionManager _m((cond).getData()[0]); !_m.done(); \
49 _m.next_state()) \
50 if (_m.if_state())
51
52namespace computefhe {
61 typedef struct {
62 FixedPoint prev_value;
63 FixedPoint if_value;
64 FixedPoint else_value;
65 FixedPoint *data;
67
77 private:
78 int state;
79 BinaryDigit cond;
80 unordered_map<void *, ConditionalVar> registry;
81
82 public:
83 ConditionManager(const BinaryDigit &condition);
85 static void register_variable(void *var_instance, FixedPoint *data);
86 static void unregister_variable(void *var_instance);
87 void next_state();
88 bool done();
89 bool if_state();
90
91 static bool conditional_mode();
92 };
93} // namespace computefhe
Defines the fundamental bit-level and bit-vector data structures for FHE operations.
Manages conditional execution state and variable multiplexing.
Definition ConditionManager.h:76
A proxy-object representing a single bit that can behave as either a ciphertext or a plaintext.
Definition FixedPoint.h:35
Internal tracking structure for encrypted variables in conditional blocks.
Definition ConditionManager.h:61
A bit-vector representation of an encrypted or plaintext word.
Definition FixedPoint.h:118