Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ where
let mod_mask = Scalar::MAX >> (Scalar::BITS - rep_bit_count);
res &= mod_mask;
// Control bit about whether we should balance the state
// This is equivalent to res > 2^(base_log * l) || (res == 2^(base_log * l) && random == 1)
// This is equivalent to:
// res > B / 2 || (res == B / 2 && random == 1)
// with B = 2^(base_log * l)
let need_balance = balanced_rounding_condition_bit_trick(res, rep_bit_count, rounding_bit);
// Balance depending on the control bit
res.wrapping_sub(need_balance << rep_bit_count)
Expand Down
Loading