Documentation ¶
Index ¶
- func BinaryBytesToByte(bs []byte) byte
- func BinaryStringToByte(bs string) byte
- func BinaryStringToBytes(s string) (bs []byte)
- func ByteToBinaryBytes(b byte, bs []byte)
- func ByteToBinaryString(b byte) string
- func BytesToBinaryString(bs []byte) string
- func CountBits(x int) int
- func Div2(x int) int
- func IsEven(x int) bool
- func IsOdd(x int) bool
- func IsPowerOfTwo(x int) bool
- func Negative(x int) int
- func ReadBinaryString(s string, v interface{}) (err error)
- func Swap(a, b int) (int, int)
- func ToBinaryString(v interface{}) string
- func Uint16ToBinaryString(v uint16) string
- func Uint32ToBinaryString(v uint32) string
- func Uint64ToBinaryString(v uint64) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinaryBytesToByte ¶
BinaryBytesToByte change bs to byte, len(bs) <= 8 bs = []byte{'0', '0', '0', '0', '0', '1', '0', '1'}, b = 5 bs = []byte{'1', '0', '1'}, b = 5
func BinaryStringToByte ¶
BinaryStringToByte change bs to byte, len(bs) <= 8 bs = "00000101", b = 5 bs = "101", b = 5
func BinaryStringToBytes ¶
BinaryStringToBytes convert binary string to bytes s = "[00000001 00000010]", bs = []byte{1, 2},
func ByteToBinaryBytes ¶
ByteToBinaryBytes change b to binary format, store in bs b = 5, bs = []byte{'0', '0', '0', '0', '0', '1', '0', '1'}
func ByteToBinaryString ¶
ByteToBinaryString change b to binary format b = 5, result = "00000101"
func BytesToBinaryString ¶
BytesToBinaryString change bs to binary format bs = []byte{1, 2}, result = "[00000001 00000010]"
func ReadBinaryString ¶
ReadBinaryString change binary string s to v
func ToBinaryString ¶
func ToBinaryString(v interface{}) string
ToBinaryString change v to binary format
func Uint16ToBinaryString ¶
Uint16ToBinaryString change uint16 to bianry format
func Uint32ToBinaryString ¶
Uint32ToBinaryString change uint32 to bianry format
func Uint64ToBinaryString ¶
Uint64ToBinaryString change uint64 to bianry format
Types ¶
This section is empty.