Repository: goplus/gop
Pull request #1155 (2022-04-22 16:19:31)

README: Large number: uint128, int128


Patch:
diff --git a/README.md b/README.md
index 5e86e7b1..0b705db1 100644
--- a/README.md
+++ b/README.md
@@ -194,33 +194,42 @@ var y *big.Rat = 4/5r
 println x, y
 ```
 
+### Large number: uint128, int128
+
+```go
+var x uint128 = 1 << 65
+var y = x + 1
+println x // output: 36893488147419103232
+println y // output: 36893488147419103233
+```
+
 ### Convert bool to number types
 
 ```go
-println int(true)
-println float64(true)
-println complex64(true)
+println int(true)       // output: 1
+println float64(true)   // output: 1
+println complex64(true) // output: (1+0i)
 ```
 
 ### Map literal
 
 ```go
-x := {"Hello": 1, "xsw": 3.4} // map[string]float64
+x := {"Hello": 1, "xsw": 3.4}   // map[string]float64
 y := {"Hello": 1, "xsw": "Go+"} // map[string]interface{}
-z := {"Hello": 1, "xsw": 3} // map[string]int
-empty := {} // map[string]interface{}
+z := {"Hello": 1, "xsw": 3}     // map[string]int
+empty := {}                     // map[string]interface{}
 ```
 
 ### Slice literal
 
 ```go
-x := [1, 3.4] // []float64
-y := [1] // []int
-z := [1+2i, "xsw"] // []interface{}
+x := [1, 3.4]       // []float64
+y := [1]            // []int
+z := [1+2i, "xsw"]  // []interface{}
 a := [1, 3.4, 3+4i] // []complex128
-b := [5+6i] // []complex128
-c := ["xsw", 3] // []interface{}
-empty := [] // []interface{}
+b := [5+6i]         // []complex128
+c := ["xsw", 3]     // []interface{}
+empty := []         // []interface{}
 ```
 
 ### Lambda expression
diff --git a/builtin/ng/uint128.go b/builtin/ng/uint128.go
index b42be796..ca442562 100644
--- a/builtin/ng/uint128.go
+++ b/builtin/ng/uint128.go
@@ -39,8 +39,8 @@ func Uint128_Init__0(v int) (out Uint128) {
 	return Uint128{lo: uint64(v)}
 }
 
-// Uint128_Init: func bigint.init(x *big.Int) bigint
-func Uint128_Init__1(v *big.Int) (out Uint128) {
+// Uint128_Init: func bigint.init(v untyped_bigint) bigint
+func Uint128_Init__1(v UntypedBigint) (out Uint128) {
 	out, inRange := Uint128_Cast__9(v)
 	if !inRange {
 		log.Panicf("value %v was not in valid uint128 range\n", v)
diff --git a/go.mod b/go.mod
index e1fa44ca..1ad6dbba 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module github.com/goplus/gop
 go 1.16
 
 require (
-	github.com/goplus/gox v1.10.5
+	github.com/goplus/gox v1.10.6
 	github.com/qiniu/x v1.11.5
 	golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3
 	golang.org/x/tools v0.1.10
diff --git a/go.sum b/go.sum
index cd22fe97..271feb5e 100644
--- a/go.sum
+++ b/go.sum
@@ -1,5 +1,5 @@
-github.com/goplus/gox v1.10.5 h1:Ztgx1nyJ1R52VeeNmddX/JCmHHy+j4Ql7rmcbXXMD7A=
-github.com/goplus/gox v1.10.5/go.mod h1:gu7fuQF8RmWPZUjd+tEJGuV3m/vOEv0bHrct0x/KatM=
+github.com/goplus/gox v1.10.6 h1:nv3goIZ85GbcBIyI2GdzUmwzSVWg+RGP+Wyuep4eO5I=
+github.com/goplus/gox v1.10.6/go.mod h1:gu7fuQF8RmWPZUjd+tEJGuV3m/vOEv0bHrct0x/KatM=
 github.com/qiniu/x v1.11.5 h1:TYr5cl4g2yoHAZeDK4MTjKF6CMoG+IHlCDvvM5qym6U=
 github.com/qiniu/x v1.11.5/go.mod h1:03Ni9tj+N2h2aKnAz+6N0Xfl8FwMEDRC2PAlxekASDs=
 github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=


Test patch:
diff --git a/cl/run_test.go b/cl/run_test.go
index a11958ed..2672f522 100644
--- a/cl/run_test.go
+++ b/cl/run_test.go
@@ -117,11 +117,14 @@ println x
 `)
 }
 
-func _TestInt128_init(t *testing.T) {
+func TestInt128_init(t *testing.T) {
 	testRun(t, `
 var x uint128 = 1 << 65
+var y = x + 1
 println x
-`, `1
+println y
+`, `36893488147419103232
+36893488147419103233
 `)
 }