num icon indicating copy to clipboard operation
num copied to clipboard

Trait size of number in bits

Open Stargateur opened this issue 4 years ago • 1 comments

I'm interest in having a trait that return the number of bits of T, std only have associated constant, u8::BITS. Similar to num::Bounded.

Alternative, let n_bits = std::mem::size_of::<T>() * u8::BITS as usize;.

Stargateur avatar Dec 30 '21 10:12 Stargateur

This would be insanely useful for bit manipulation, second this.

taitep avatar Jan 06 '25 19:01 taitep