-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2751e02
commit 99b1710
Showing
7 changed files
with
24 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//本包提供C语言功能的go语言API。 | ||
// | ||
//本包使用了cgo,编译需要cgo,在使用时请考虑这对交叉编译的影响! | ||
// 本包使用了cgo,编译需要cgo,在使用时请考虑这对交叉编译的影响! | ||
package cextend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
//本包提供了位操作的函数 | ||
//本包提供了位操作的函数,有使用泛型 | ||
package bits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// 由于使用了泛型的缘故,本包必须使用在go1.18及以上版本 | ||
package bits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
//本包提供unsafe包的拓展功能 | ||
// | ||
//注意,本包提供的一切因为绕开了go语言安全机制,导入不安全的软件包可能是不可移植的,并且不受Go 1兼容性指南的保护。 | ||
package gunsafe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// 注意,本包因为绕开了go语言安全机制,导入不安全的软件包可能是不可移植的,并且不受Go 1兼容性指南的保护。 | ||
package gunsafe | ||
|
||
import "unsafe" | ||
|