Skip to main content

IsolateHighestOne

Trait IsolateHighestOne 

Source
pub trait IsolateHighestOne: Sized {
    type Output;

    // Required method
    fn isolate_highest_one(self) -> Self::Output;
}
Expand description

Isolates the highest one-bit, branchlessly.

Required Associated Types§

Source

type Output

Returns self with only its highest one-bit kept, or 0 if the value is zero.

use const_num_traits::IsolateHighestOne;

assert_eq!(IsolateHighestOne::isolate_highest_one(0b0101_0000u8), 0b0100_0000);

Required Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl IsolateHighestOne for i8

Source§

impl IsolateHighestOne for i16

Source§

impl IsolateHighestOne for i32

Source§

impl IsolateHighestOne for i64

Source§

impl IsolateHighestOne for i128

Source§

impl IsolateHighestOne for isize

Source§

impl IsolateHighestOne for u8

Source§

impl IsolateHighestOne for u16

Source§

impl IsolateHighestOne for u32

Source§

impl IsolateHighestOne for u64

Source§

impl IsolateHighestOne for u128

Source§

impl IsolateHighestOne for usize

Implementors§