add big.Int Lsh and Rsh and test it
This commit is contained in:
@@ -40,7 +40,7 @@ func neg() {
|
||||
fmt.Println("value: ", big.NewInt(0).Neg(big.NewInt(0)))
|
||||
}
|
||||
|
||||
func main() {
|
||||
func calc() {
|
||||
a := big.NewInt(64)
|
||||
b := big.NewInt(-52)
|
||||
c := big.NewInt(54)
|
||||
@@ -50,3 +50,14 @@ func main() {
|
||||
e := big.NewInt(4)
|
||||
fmt.Println("value:", d.Mul(d, e))
|
||||
}
|
||||
|
||||
func bitop() {
|
||||
a := big.NewInt(4)
|
||||
fmt.Println("value:", a.Lsh(a, 1))
|
||||
b := big.NewInt(16)
|
||||
fmt.Println("value:", b.Rsh(b, 2))
|
||||
}
|
||||
|
||||
func main() {
|
||||
bitop()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user