compiler_builtins 0.1.160

Compiler intrinsics used by the Rust compiler.
Documentation
1
2
3
4
5
6
7
8
9
10
11
use crate::support::Float;

/// Copy the sign of `y` to `x`.
#[inline]
pub fn copysign<F: Float>(x: F, y: F) -> F {
    let mut ux = x.to_bits();
    let uy = y.to_bits();
    ux &= !F::SIGN_MASK;
    ux |= uy & F::SIGN_MASK;
    F::from_bits(ux)
}