Skip to content

Commit 16feb46

Browse files
committed
refactor(integer): use same logic for signed cmps
This makes the logic for signed cmps more similar whether the parameters are 1_1 or higher. This will make possible to reuse this part of the code for scalar comparisons
1 parent 81d82bc commit 16feb46

File tree

2 files changed

+140
-170
lines changed

2 files changed

+140
-170
lines changed

tfhe/src/integer/server_key/radix_parallel/cmux.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,15 @@ impl ServerKeyDefaultCMux<&BooleanBlock, &BooleanBlock> for ServerKey {
169169
});
170170

171171
let negated_cond = self.boolean_bitnot(condition);
172-
173172
let (mut lhs, rhs) = rayon::join(
174173
|| {
175-
let mut block = self.key.scalar_mul(&condition.0, 2);
174+
let mut block = self.key.unchecked_scalar_mul(&condition.0, 2);
176175
self.key.unchecked_add_assign(&mut block, &true_ct.0);
177176
self.key.apply_lookup_table_assign(&mut block, &zero_lut);
178177
block
179178
},
180179
|| {
181-
let mut block = self.key.scalar_mul(&negated_cond.0, 2);
180+
let mut block = self.key.unchecked_scalar_mul(&negated_cond.0, 2);
182181
self.key.unchecked_add_assign(&mut block, &false_ct.0);
183182
self.key.apply_lookup_table_assign(&mut block, &zero_lut);
184183
block

0 commit comments

Comments
 (0)