Skip to content

Commit

Permalink
address pr feedback
Browse files Browse the repository at this point in the history
- add comment for black_box
  • Loading branch information
jmayclin committed Aug 22, 2024
1 parent e430d44 commit c349ee0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bindings/rust/bench/benches/constant_time_equals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ fn comparison(criterion: &mut Criterion) {
group.bench_function("memcmp", |bencher| {
bencher.iter(|| {
for e in pathological_data.iter() {
// use "black box" to prevent the compiler from optimizing out the
// memcmp operation
std::hint::black_box(memcmp(e, &a));
}
})
Expand Down

0 comments on commit c349ee0

Please sign in to comment.