Skip to content

Commit

Permalink
chore(fhe_strings): limit max n to improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeul-zama committed Nov 6, 2024
1 parent bcae0f1 commit e882229
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tfhe/src/strings/server_key/pattern/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ impl ServerKey {

UIntArg::Enc(enc_n) => {
// As we don't know the number n we perform the maximum number of iterations
let max = enc_n.max().unwrap_or(u16::MAX);
let max = (enc_n.max().unwrap_or(u16::MAX) as usize).min(result.len() + 1) as u16;

self.replace_n_times(max, &mut result, from, to, Some(enc_n.cipher()));
}
Expand Down

0 comments on commit e882229

Please sign in to comment.