Documentation ¶
Overview ¶
Package bits implements bit counting and manipulation functions for the predeclared unsigned integer types.
Index ¶
- Constants
- func LeadingZeros(x uint) int
- func LeadingZeros16(x uint16) int
- func LeadingZeros32(x uint32) int
- func LeadingZeros64(x uint64) int
- func LeadingZeros8(x uint8) int
- func Len(x uint) int
- func Len16(x uint16) (n int)
- func Len32(x uint32) (n int)
- func Len64(x uint64) (n int)
- func Len8(x uint8) int
- func OnesCount(x uint) int
- func OnesCount16(x uint16) int
- func OnesCount32(x uint32) int
- func OnesCount64(x uint64) int
- func OnesCount8(x uint8) int
- func Reverse(x uint) uint
- func Reverse16(x uint16) uint16
- func Reverse32(x uint32) uint32
- func Reverse64(x uint64) uint64
- func Reverse8(x uint8) uint8
- func ReverseBytes(x uint) uint
- func ReverseBytes16(x uint16) uint16
- func ReverseBytes32(x uint32) uint32
- func ReverseBytes64(x uint64) uint64
- func RotateLeft(x uint, k int) uint
- func RotateLeft16(x uint16, k int) uint16
- func RotateLeft32(x uint32, k int) uint32
- func RotateLeft64(x uint64, k int) uint64
- func RotateLeft8(x uint8, k int) uint8
- func RotateRight(x uint, k int) uint
- func RotateRight16(x uint16, k int) uint16
- func RotateRight32(x uint32, k int) uint32
- func RotateRight64(x uint64, k int) uint64
- func RotateRight8(x uint8, k int) uint8
- func TrailingZeros(x uint) int
- func TrailingZeros16(x uint16) (n int)
- func TrailingZeros32(x uint32) int
- func TrailingZeros64(x uint64) int
- func TrailingZeros8(x uint8) int
Constants ¶
const UintSize = uintSize
UintSize is the size of a uint in bits.
Variables ¶
This section is empty.
Functions ¶
func LeadingZeros ¶
LeadingZeros returns the number of leading zero bits in x; the result is UintSize for x == 0.
func LeadingZeros16 ¶
LeadingZeros16 returns the number of leading zero bits in x; the result is 16 for x == 0.
func LeadingZeros32 ¶
LeadingZeros32 returns the number of leading zero bits in x; the result is 32 for x == 0.
func LeadingZeros64 ¶
LeadingZeros64 returns the number of leading zero bits in x; the result is 64 for x == 0.
func LeadingZeros8 ¶
LeadingZeros8 returns the number of leading zero bits in x; the result is 8 for x == 0.
func Len ¶
Len returns the minimum number of bits required to represent x; the result is 0 for x == 0.
func Len16 ¶
Len16 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
func Len32 ¶
Len32 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
func Len64 ¶
Len64 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
func Len8 ¶
Len8 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
func OnesCount16 ¶
OnesCount16 returns the number of one bits ("population count") in x.
func OnesCount32 ¶
OnesCount32 returns the number of one bits ("population count") in x.
func OnesCount64 ¶
OnesCount64 returns the number of one bits ("population count") in x.
func OnesCount8 ¶
OnesCount8 returns the number of one bits ("population count") in x.
func ReverseBytes ¶
ReverseBytes returns the value of x with its bytes in reversed order.
func ReverseBytes16 ¶
ReverseBytes16 returns the value of x with its bytes in reversed order.
func ReverseBytes32 ¶
ReverseBytes32 returns the value of x with its bytes in reversed order.
func ReverseBytes64 ¶
ReverseBytes64 returns the value of x with its bytes in reversed order.
func RotateLeft ¶
RotateLeft returns the value of x rotated left by k bits; k must not be negative.
func RotateLeft16 ¶
RotateLeft16 returns the value of x rotated left by k bits; k must not be negative.
func RotateLeft32 ¶
RotateLeft32 returns the value of x rotated left by k bits; k must not be negative.
func RotateLeft64 ¶
RotateLeft64 returns the value of x rotated left by k bits; k must not be negative.
func RotateLeft8 ¶
RotateLeft8 returns the value of x rotated left by k bits; k must not be negative.
func RotateRight ¶
RotateRight returns the value of x rotated left by k bits; k must not be negative.
func RotateRight16 ¶
RotateRight16 returns the value of x rotated left by k bits; k must not be negative.
func RotateRight32 ¶
RotateRight32 returns the value of x rotated left by k bits; k must not be negative.
func RotateRight64 ¶
RotateRight64 returns the value of x rotated left by k bits; k must not be negative.
func RotateRight8 ¶
RotateRight8 returns the value of x rotated left by k bits; k must not be negative.
func TrailingZeros ¶
TrailingZeros returns the number of trailing zero bits in x; the result is UintSize for x == 0.
func TrailingZeros16 ¶
TrailingZeros16 returns the number of trailing zero bits in x; the result is 16 for x == 0.
func TrailingZeros32 ¶
TrailingZeros32 returns the number of trailing zero bits in x; the result is 32 for x == 0.
func TrailingZeros64 ¶
TrailingZeros64 returns the number of trailing zero bits in x; the result is 64 for x == 0.
func TrailingZeros8 ¶
TrailingZeros8 returns the number of trailing zero bits in x; the result is 8 for x == 0.
Types ¶
This section is empty.