devela::sys::mem

Macro cswap

Source
macro_rules! cswap {
    (
        // swaps two values using a temporary variable
        $a:expr, $b:expr) => { ... };
    (
        // swaps two `T: PartialEq + BitXorAssign` values without a temporary variable
        xor $a:expr, $b:expr) => { ... };
}
Expand description

Swaps two mutable variables in a compile-time friendly manner.

For that it uses either a temporary variable or the xor swap method.