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

Method ct_swap

ctutils/src/traits/ct_select.rs:34–38  ·  view source on GitHub ↗

Conditionally swap `self` and `other` if `choice` is [`Choice::TRUE`].

(&mut self, other: &mut Self, choice: Choice)

Source from the content-addressed store, hash-verified

32
33 /// Conditionally swap `self` and `other` if `choice` is [`Choice::TRUE`].
34 fn ct_swap(&mut self, other: &mut Self, choice: Choice) {
35 let tmp = self.ct_select(other, choice);
36 *other = Self::ct_select(other, self, choice);
37 *self = tmp;
38 }
39}
40
41/// Implementing this trait enables use of the [`CtSelect`] trait to construct `[T; N]` where `T`

Callers

nothing calls this directly

Implementers 2

ct_option.rsctutils/src/ct_option.rs
ct_select.rsctutils/src/traits/ct_select.rs

Calls 2

ct_selectFunction · 0.50
ct_selectMethod · 0.45

Tested by

no test coverage detected