pub(crate) fn black_box<T: Copy>(input: T) -> T
Expand description
This function is a best-effort attempt to prevent the compiler from knowing
anything about the value of the returned u8
, other than its type.
Because we want to support stable Rust, we don’t have access to inline assembly or test::black_box, so we use the fact that volatile values will never be elided to register values.
Note: Rust’s notion of “volatile” is subject to change over time. While this code may break in a non-destructive way in the future, “constant-time” code is a continually moving target, and this is better than doing nothing.