Skip to content

Commit

Permalink
fix(compiler): remove hardcoded datakind and construct it from desc
Browse files Browse the repository at this point in the history
  • Loading branch information
youben11 committed Sep 3, 2024
1 parent feac6e8 commit 19242e8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions backends/concrete-cpu/implementation/src/c_api/fheint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ impl TfhersFheIntDescription {
},
)
}

/// Get DataKind
fn data_kind(&self) -> tfhe::integer::ciphertext::DataKind {
match self.is_signed {
true => tfhe::integer::ciphertext::DataKind::Signed(self.width),
false => tfhe::integer::ciphertext::DataKind::Unsigned(self.width),
}
}
}

#[no_mangle]
Expand Down Expand Up @@ -193,10 +201,7 @@ pub unsafe extern "C" fn concrete_cpu_lwe_array_to_tfhers_uint8(
);
blocks.push(fheuint_desc.ct_from_lwe(lwe_ct));
}
let fheuint = match FheUint8::from_expanded_blocks(
blocks,
tfhe::integer::ciphertext::DataKind::Unsigned(4),
) {
let fheuint = match FheUint8::from_expanded_blocks(blocks, fheuint_desc.data_kind()) {
Ok(value) => value,
Err(_) => {
return 0;
Expand Down

0 comments on commit 19242e8

Please sign in to comment.