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

Function select_vartime

ctutils/src/ct_option.rs:693–695  ·  view source on GitHub ↗
(a: &u8, b: &u8, choice: Choice)

Source from the content-addressed store, hash-verified

691 // Don't actually use this! It's just a test function implemented in variable-time
692 #[allow(clippy::trivially_copy_pass_by_ref)]
693 const fn select_vartime(a: &u8, b: &u8, choice: Choice) -> u8 {
694 if choice.to_bool() { *b } else { *a }
695 }
696
697 assert_eq!(
698 unwrap_or!(NONE, OTHER.unwrap(), select_vartime),

Callers

nothing calls this directly

Calls 1

to_boolMethod · 0.80

Tested by

no test coverage detected