mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-07 22:04:10 -05:00
feat: Add IfThenZero impl for Cpu
This commit is contained in:
committed by
Pierre Gardrat
parent
569abd9a3b
commit
e645ee3397
@@ -28,13 +28,11 @@ pub fn transfer_whitepaper<FheType>(
|
||||
amount: &FheType,
|
||||
) -> (FheType, FheType)
|
||||
where
|
||||
FheType: Add<Output = FheType> + for<'a> FheOrd<&'a FheType> + FheTrivialEncrypt<u64>,
|
||||
FheType: Add<Output = FheType> + for<'a> FheOrd<&'a FheType>,
|
||||
FheBool: IfThenZero<FheType>,
|
||||
for<'a> &'a FheType: Add<Output = FheType> + Sub<Output = FheType>,
|
||||
{
|
||||
let has_enough_funds = (from_amount).ge(amount);
|
||||
//let zero_amount = FheType::encrypt_trivial(0u64);
|
||||
//let amount_to_transfer = has_enough_funds.select(amount, &zero_amount);
|
||||
let amount_to_transfer = has_enough_funds.if_then_zero(amount);
|
||||
|
||||
let new_to_amount = to_amount + &amount_to_transfer;
|
||||
|
||||
Reference in New Issue
Block a user