Std.Bits
42 public declarations
- and
&T -> &T -> T where T: BitsBoth values' bits, kept where both are set.
- bit
&T -> Int -> T where T: BitsA value with only the bit at a position set, or nought when the position is
- bits
&T -> Array[Bool] where T: BitsThe bits of a value, lowest position first, over the type's own width.
- Bits
A type whose values are bit patterns.
- clearBit
&T -> Int -> T where T: BitsThe value with one bit cleared.
- complement
&T -> T where T: BitsEvery bit inverted, over the type's own width.
- countLeadingZeros
&T -> Int where T: BitsHow many high positions are clear before the first set bit. A value with no
- countTrailingZeros
&T -> Int where T: BitsHow many low positions are clear before the first set bit.
- extract
&T -> Int -> Int -> T where T: BitsThe bits at positions `from` up to but not including `to`, moved down.
- flipBit
&T -> Int -> T where T: BitsThe value with one bit inverted.
- highestSetBit
&T -> Option[Int] where T: BitsThe position of the highest set bit, or `None` when no bit is set.
- isSingleBit
&T -> Bool where T: BitsWhether a value has exactly one bit set, which is what a power of two is.
- lowestSetBit
&T -> Option[Int] where T: BitsThe position of the lowest set bit, or `None` when no bit is set.
- mask
&T -> Int -> T where T: BitsThe value with its low `width` bits kept and the rest cleared.
- nextPowerOfTwo
&T -> T where T: BitsThe smallest power of two that is not below the value.
- ones
&T -> T where T: BitsA value with every bit set, of the same type as the example given.
- or
&T -> &T -> T where T: BitsBoth values' bits, kept where either is set.
- popCount
&T -> Int where T: BitsHow many bits are set, counted over the type's own width.
- rotateLeft
&T -> Int -> T where T: BitsThe bits moved toward the high end, with the ones that leave reappearing at
- rotateRight
&T -> Int -> T where T: BitsThe bits moved toward the low end, with the ones that leave reappearing at
- setBit
&T -> Int -> T where T: BitsThe value with one bit set.
- shiftLeft
&T -> Int -> T where T: BitsThe bits moved toward the high end, filling with noughts.
- shiftRight
&T -> Int -> T where T: BitsThe bits moved toward the low end. A signed type keeps its sign; an unsigned
- testBit
&T -> Int -> Bool where T: BitsWhether the bit at a position is set. A position outside the type is not.
- toBinary
&T -> Str where T: BitsThe value written in binary, without a sign or a prefix, over the type's own
- toHex
&T -> Str where T: BitsThe value written in lower-case hexadecimal, without a prefix.
- width
&T -> Int where T: BitsHow many bits a value's type has.
- width
&Int -> IntOne implementation per integer width, each reporting its own. `Int` and
- width
&Int128 -> IntReturn the fixed number of bits stored by this integer type.
- width
&Int16 -> IntReturn the fixed number of bits stored by this integer type.
- width
&Int32 -> IntReturn the fixed number of bits stored by this integer type.
- width
&Int64 -> IntReturn the fixed number of bits stored by this integer type.
- width
&Int8 -> IntReturn the fixed number of bits stored by this integer type.
- width
&Self -> IntReturn the fixed number of bits stored by this integer type.
- width
&UInt -> IntReturn the fixed number of bits stored by this integer type.
- width
&UInt128 -> IntReturn the fixed number of bits stored by this integer type.
- width
&UInt16 -> IntReturn the fixed number of bits stored by this integer type.
- width
&UInt32 -> IntReturn the fixed number of bits stored by this integer type.
- width
&UInt64 -> IntReturn the fixed number of bits stored by this integer type.
- width
&UInt8 -> IntReturn the fixed number of bits stored by this integer type.
- xor
&T -> &T -> T where T: BitsBoth values' bits, kept where exactly one is set.
- zero
&T -> T where T: BitsA value with no bits set, of the same type as the example given.
