非常教程

Go参考手册

math/bits

math/bits

  • import "math/bits"
  • 概述
  • 索引

概述

打包字节为预先声明的无符号整数类型实现位计数和操作函数。

索引

  • 常量
  • 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 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

打包文件

bits.go bits_tables.go

常量

UintSize 是以位为单位的 uint 的大小。

const UintSize = uintSize

func LeadingZeros(显示源文件)

func LeadingZeros(x uint) int

LeadingZeros 返回 x 中前导零位的数量; 结果是 x == 0 的 UintSize 。

func LeadingZeros16(显示源文件)

func LeadingZeros16(x uint16) int

LeadingZeros16 返回 x 中前导零位的数量; 对于 x == 0 ,结果为 16 。

func LeadingZeros32(显示源文件)

func LeadingZeros32(x uint32) int

LeadingZeros32 返回 x 中前导零位的数量; x == 0的结果为32。

func LeadingZeros64(显示源文件)

func LeadingZeros64(x uint64) int

LeadingZeros64 返回 x 中前导零位的数量;对于 x == 0 ,结果为64。

func LeadingZeros8(显示源文件)

func LeadingZeros8(x uint8) int

LeadingZeros8 返回 x 中前导零位的数量; x == 0 的结果为8。

func Len(显示源文件)

func Len(x uint) int

Len 返回表示 x 所需的最小位数;对于 x == 0 ,结果为0。

func Len16(显示源文件)

func Len16(x uint16) (n int)

Len16 返回表示 x 所需的最小位数; 对于 x == 0 ,结果为0。

func Len32(显示源文件)

func Len32(x uint32) (n int)

Len32 返回表示 x 所需的最小位数; 对于 x == 0 ,结果为0。

func Len64(显示源文件)

func Len64(x uint64) (n int)

Len64 返回表示 x 所需的最小位数; 对于 x == 0 ,结果为0。

func Len8(显示源文件)

func Len8(x uint8) int

Len8 返回表示 x 所需的最小位数; 对于 x == 0,结果为0。

func OnesCount(显示源文件)

func OnesCount(x uint) int

OnesCount 返回 x 中的一位数(“总数”)。

func OnesCount16(显示源文件)

func OnesCount16(x uint16) int

OnesCount16 返回 x 中的一位数(“总数”)。

func OnesCount32(显示源文件)

func OnesCount32(x uint32) int

OnesCount32 返回 x 中的一位数(“总数”)。

func OnesCount64(显示源文件)

func OnesCount64(x uint64) int

OnesCount64 返回 x 中的一位数(“总数”)。

func OnesCount8(显示源文件)

func OnesCount8(x uint8) int

OnesCount8 返回 x 中的一位数(“总数”)。

func Reverse(显示源文件)

func Reverse(x uint) uint

Reverse以相反的顺序返回 x 的值。

func Reverse16(显示源文件)

func Reverse16(x uint16) uint16

Reverse16 以相反的顺序返回 x 的值。

func Reverse32(显示源文件)

func Reverse32(x uint32) uint32

Reverse32 以相反的顺序返回 x 的值。

func Reverse64(显示源文件)

func Reverse64(x uint64) uint64

Reverse64 以相反的顺序返回 x 的值。

func Reverse8(显示源文件)

func Reverse8(x uint8) uint8

Reverse8 以相反的顺序返回 x 的值。

func ReverseBytes(显示源文件)

func ReverseBytes(x uint) uint

ReverseBytes 以相反的顺序返回 x 的值。

func ReverseBytes16(显示源文件)

func ReverseBytes16(x uint16) uint16

ReverseBytes16 以相反的顺序返回 x 的值。

func ReverseBytes32(显示源文件)

func ReverseBytes32(x uint32) uint32

ReverseBytes32 以相反的顺序返回字节 x 的值。

func ReverseBytes64(显示源文件)

func ReverseBytes64(x uint64) uint64

ReverseBytes64 以相反的顺序返回字节 x 的值。

func RotateLeft(显示源文件)

func RotateLeft(x uint, k int) uint

RotateLeft 返回由 (k mod UintSize) 位向左旋转的x的值。要将 x 向右旋转 k 位,请调用 RotateLeft(x, -k)。

func RotateLeft16(显示源文件)

func RotateLeft16(x uint16, k int) uint16

RotateLeft16 返回 (k mod 16) 位向左旋转的 x 的值。要将 x 向右旋转 k 位,请调用 RotateLeft16(x, -k)。

func RotateLeft32(显示源文件)

func RotateLeft32(x uint32, k int) uint32

RotateLeft32 返回 (k mod 32) 位向左旋转的 x 的值。要将 x 向右旋转 k 位,请调用 RotateLeft32(x, -k)。

func RotateLeft64(显示源文件)

func RotateLeft64(x uint64, k int) uint64

RotateLeft64返回由 (k mod 64)位向左旋转的 x 的值。要将 x 向右旋转 k 位,请调用RotateLeft64(x, -k)。

func RotateLeft8(显示源文件)

func RotateLeft8(x uint8, k int) uint8

RotateLeft8 返回 (k mod 8) 位向左旋转的 x 的值。要将 x 向右旋转 k 位,请调用 RotateLeft8(x, -k)。

func TrailingZeros(显示源文件)

func TrailingZeros(x uint) int

TrailingZeros 返回 x 中的尾随零位数; 结果是 x == 0 的 UintSize。

func TrailingZeros16(显示源文件)

func TrailingZeros16(x uint16) (n int)

TrailingZeros16 返回 x 中的尾随零位数; 对于 x == 0 ,结果为 16。

func TrailingZeros32(显示源文件)

func TrailingZeros32(x uint32) int

TrailingZeros32 返回 x 中的尾随零位数; x == 0 的结果为32。

func TrailingZeros64(显示源文件)

func TrailingZeros64(x uint64) int

TrailingZeros64 返回 x 中的尾随零位数;对于 x == 0,结果为64。

func TrailingZeros8(显示源文件)

func TrailingZeros8(x uint8) int

TrailingZeros8 返回 x 中的尾随零位数; x == 0 的结果为8。

math/bits
math/bits 详细
Go

Go 是一种编译型语言,它结合了解释型语言的游刃有余,动态类型语言的开发效率,以及静态类型的安全性。它也打算成为现代的,支持网络与多核计算的语言。要满足这些目标,需要解决一些语言上的问题:一个富有表达能力但轻量级的类型系统,并发与垃圾回收机制,严格的依赖规范等等。这些无法通过库或工具解决好,因此Go也就应运而生了。

主页 https://golang.org/
源码 https://go.googlesource.com/go
发布版本 1.9.2

Go目录

1.档案 | archive
2.缓冲区 | bufio
3.内置 | builtin
4.字节 | bytes
5.压缩 | compress
6.容器 | container
7.上下文 | context
8.加密 | crypto
9.数据库 | database
10.调试 | debug
11.编码 | encoding
12.错误 | errors
13. expvar
14.flag
15. fmt
16. go
17.散列 | hash
18.html
19.图像 | image
20.索引 | index
21.io
22.日志 | log
23.数学 | math
24. math/big
25.math/bits
26.math/cmplx
27.math/rand
28.拟态 | mime
29.net
30.net/http
31. net/mail
32. net/rpc
33.net/smtp
34. net/textproto
35. net/url
36.os
37.路径 | path
38.插件 | plugin
39.反射 | reflect
40.正则表达式 | regexp
41.运行时 | runtime
42.排序算法 | sort
43.转换 | strconv
44.字符串 | strings
45.同步 | sync
46.系统调用 | syscall
47.测试 | testing
48.文本 | text
49.时间戳 | time
50.unicode
51.不安全性 | unsafe
52.Go 语言数据类型
53.Go 语言基础语法
54.Go 语言结构
55.Go 语言 select 语句
56.Go 语言 switch 语句
57.Go 语言 if 语句嵌套
58.Go 语言 if…else 语句
59.Go 语言 if 语句
60.Go 语言运算符
61.Go 语言常量
62.Go 语言函数闭包
63.Go 语言函数作为实参
64.Go 语言函数引用传递值
65.Go 语言函数值传递值
66.Go 语言函数
67.Go 语言 goto 语句
68.Go 语言 continue 语句
69.Go 语言 break 语句
70.Go 语言循环嵌套
71.Go 语言 for 循环
72.Go 语言结构体
73.Go 语言指针作为函数参数
74.Go 语言指向指针的指针
75.Go 语言指针数组
76.Go 语言指针
77.Go 语言向函数传递数组
78.Go 语言多维数组
79.Go 语言变量作用域
80.Go 语言函数方法
81.Go 错误处理
82.Go 语言接口
83.Go 语言类型转换
84.Go 语言递归函数
85.Go 语言Map(集合)
86.Go 语言范围(Range)
87.Go 语言切片(Slice)
88.Go 并发
89.Go fmt.Sprintf 格式化字符串