-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
76 lines (65 loc) · 1.4 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
1.获取不同分支的包:go get -u -v github.com/rif/cache2go@muesli
*/
package main
import (
"fmt"
"math"
)
type Type int
const (
// Null is a null json value
Null Type = iota
// False is a json false boolean
False
// Number is json number
Number
// String is a json string
String
// True is a json true boolean
True
// JSON is a raw block of JSON
JSON
)
func main() {
//for i := 0; i < 10; i++ {
// fmt.Println("times: ", i)
// timeutils.PrintSpendTime(0, func() {
// BitOpr1()
// })
// timeutils.PrintSpendTime(0, func() {
// BitOpr2()
// })
// timeutils.PrintSpendTime(0, func() {
// BitOpr3()
// })
// fmt.Println()
//}
// https://mp.weixin.qq.com/s/dgVv6p8HQtc-krPGEdU2cQ
// https://mp.weixin.qq.com/s/ysOlv8xsc7wF7cPcV5pu7g
// https://mp.weixin.qq.com/s/qFAtgpbAsHSPVLuo3PYIhg
//filePath := "log/log"
//src, err := os.OpenFile(filePath, os.O_RDWR|os.O_CREATE, 0755)
//if err != nil {
// // TODO:创建失败了怎么办??
// fmt.Println(err)
//}
//fmt.Println(src)
// 判断系统内存排序是大端序还是小端序
// go:generate fmt.Println("asdlfkj")
//binaryutils.SystemEndian()
//fmt.Println()
//binaryutils.TestBigEndian()
a := []int{1, 2, 3}
fmt.Printf("%v, %p\n", a, a)
fmt.Printf("%v, %p, %v", a[:0], a[:0], cap(a[:0]))
}
func BitOpr1() {
_ = -1 ^ (-1 << 5)
}
func BitOpr2() {
_ = 1<<5 - 1
}
func BitOpr3() {
_ = math.Pow(2.0, 5.0) - 1
}