Skip to content

Commit

Permalink
位操作及文档开发完毕
Browse files Browse the repository at this point in the history
  • Loading branch information
qiulaidongfeng committed Apr 16, 2022
1 parent 2751e02 commit 99b1710
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 6 deletions.
17 changes: 17 additions & 0 deletions bits/bits.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//本包提供了位操作的函数,没有使用泛型
package bits

//获取从右起第index位的值,index>=0
func Getbit(x, index uint) uint {
return (x >> index) & 1
}

//设置从右起第index位的值位1,index>=0
func Setbit1(x, index uint) uint {
return x | (1 << index)
}

//设置从右起第index位的值位0,index>=0
func Setbit0(x, index uint) uint {
return x & (^(1 << index))
}
2 changes: 1 addition & 1 deletion cextend/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//本包提供C语言功能的go语言API。
//
//本包使用了cgo,编译需要cgo,在使用时请考虑这对交叉编译的影响!
// 本包使用了cgo,编译需要cgo,在使用时请考虑这对交叉编译的影响!
package cextend
4 changes: 2 additions & 2 deletions cextend/so_unix.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build linux
// +build linux
//go:build !windows
// +build !windows

package cextend

Expand Down
2 changes: 1 addition & 1 deletion go118/bits/doc.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
//本包提供了位操作的函数
//本包提供了位操作的函数,有使用泛型
package bits
2 changes: 2 additions & 0 deletions go118/bits/ndoc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// 由于使用了泛型的缘故,本包必须使用在go1.18及以上版本
package bits
2 changes: 0 additions & 2 deletions gunsafe/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
//本包提供unsafe包的拓展功能
//
//注意,本包提供的一切因为绕开了go语言安全机制,导入不安全的软件包可能是不可移植的,并且不受Go 1兼容性指南的保护。
package gunsafe
1 change: 1 addition & 0 deletions gunsafe/gunsafe.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// 注意,本包因为绕开了go语言安全机制,导入不安全的软件包可能是不可移植的,并且不受Go 1兼容性指南的保护。
package gunsafe

import "unsafe"
Expand Down

0 comments on commit 99b1710

Please sign in to comment.