MCPcopy Create free account
hub / github.com/RustCrypto/utils / Cmov

Interface Cmov

cmov/src/lib.rs:38–51  ·  view source on GitHub ↗

Conditional move

Source from the content-addressed store, hash-verified

36
37/// Conditional move
38pub trait Cmov {
39 /// Move if non-zero.
40 ///
41 /// Moves `value` to `self` in constant-time if `condition` is non-zero.
42 fn cmovnz(&mut self, value: &Self, condition: Condition);
43
44 /// Move if zero.
45 ///
46 /// Moves `value` to `self` in constant-time if `condition` is equal to zero.
47 fn cmovz(&mut self, value: &Self, condition: Condition) {
48 let nz = masknz!(condition: Condition);
49 self.cmovnz(value, !nz);
50 }
51}
52
53/// Conditional move with equality comparison
54pub trait CmovEq {

Callers

nothing calls this directly

Implementers 6

lib.rscmov/src/lib.rs
slice.rscmov/src/slice.rs
array.rscmov/src/array.rs
soft.rscmov/src/backends/soft.rs
aarch64.rscmov/src/backends/aarch64.rs
x86.rscmov/src/backends/x86.rs

Calls

no outgoing calls

Tested by

no test coverage detected