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
6 changes: 5 additions & 1 deletion md5/src/compress/soft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ fn op_f(w: u32, x: u32, y: u32, z: u32, m: u32, c: u32, s: u32) -> u32 {
}
#[inline(always)]
fn op_g(w: u32, x: u32, y: u32, z: u32, m: u32, c: u32, s: u32) -> u32 {
((x & z) | (y & !z))
// We replace the logical OR in `(x & z) | (y & !z)` with addition.
// Since masked bits do not overlap, the expressions are equivalent;
// however, addition results in better performance on high-end CPUs,
// likely due to improved ALU utilization.
((x & z).wrapping_add(y & !z))
.wrapping_add(w)
.wrapping_add(m)
.wrapping_add(c)
Expand Down