Merge branch 'develop' of https://github.com/gogf/gf into develop

This commit is contained in:
John Guo 2021-09-22 19:12:44 +08:00
commit c843661dfd
8 changed files with 13 additions and 19 deletions

View File

@ -75,7 +75,7 @@ The `Web` component performance of `GoFrame`, please refer to third-party projec
# Contributors
This project exists thanks to all the people who contribute. [[Contributors](https://github.com/gogf/gf/graphs/contributors)].
<a href="https://github.com/gogf/gf/graphs/contributors"><img src="https://opencollective.com/goframe/contributors.svg?width=890&button=false" /></a>
<a href="https://github.com/gogf/gf/graphs/contributors"><img src="https://contributors-img.web.app/image?repo=gogf/gf" /></a>
# Donators

View File

@ -91,7 +91,7 @@ golang版本 >= 1.11
# 贡献
感谢所有参与`GoFrame`开发的贡献者。 [[贡献者列表](https://github.com/gogf/gf/graphs/contributors)].
<a href="https://github.com/gogf/gf/graphs/contributors"><img src="https://opencollective.com/goframe/contributors.svg?width=890&button=false" /></a>
<a href="https://github.com/gogf/gf/graphs/contributors"><img src="https://contributors-img.web.app/image?repo=gogf/gf" /></a>
# 捐赠

View File

@ -4,14 +4,11 @@
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
// Package gtype provides kinds of high performance and concurrent-safe basic variable types.
// Package gtype provides high performance and concurrent-safe basic variable types.
package gtype
// Type is alias of Interface.
type Type = Interface
// New is alias of NewInterface.
// See NewInterface.
func New(value ...interface{}) *Type {
func New(value ...interface{}) *Interface {
return NewInterface(value...)
}

View File

@ -51,7 +51,7 @@ func (v *Bool) Set(value bool) (old bool) {
return
}
// Val atomically loads and returns t.valueue.
// Val atomically loads and returns t.value.
func (v *Bool) Val() bool {
return atomic.LoadInt32(&v.value) > 0
}

View File

@ -11,7 +11,6 @@ import (
"math"
"strconv"
"sync/atomic"
"unsafe"
)
// Float32 is a struct for concurrent-safe operation for type float32.
@ -51,7 +50,7 @@ func (v *Float32) Add(delta float32) (new float32) {
old := math.Float32frombits(v.value)
new = old + delta
if atomic.CompareAndSwapUint32(
(*uint32)(unsafe.Pointer(&v.value)),
&v.value,
math.Float32bits(old),
math.Float32bits(new),
) {

View File

@ -11,7 +11,6 @@ import (
"math"
"strconv"
"sync/atomic"
"unsafe"
)
// Float64 is a struct for concurrent-safe operation for type float64.
@ -51,7 +50,7 @@ func (v *Float64) Add(delta float64) (new float64) {
old := math.Float64frombits(v.value)
new = old + delta
if atomic.CompareAndSwapUint64(
(*uint64)(unsafe.Pointer(&v.value)),
&v.value,
math.Float64bits(old),
math.Float64bits(new),
) {

View File

@ -22,7 +22,7 @@ func Test_Bytes(t *testing.T) {
t.AssertEQ(iClone.Set([]byte("123")), []byte("abc"))
t.AssertEQ(iClone.Val(), []byte("123"))
//空参测试
// 空参测试
i1 := gtype.NewBytes()
t.AssertEQ(i1.Val(), nil)
})

View File

@ -10,7 +10,6 @@ package grand
import (
"encoding/binary"
"time"
"unsafe"
)
var (
@ -20,7 +19,7 @@ var (
characters = letters + digits + symbols // 94
)
// Intn returns a int number which is between 0 and max: [0, max).
// Intn returns an int number which is between 0 and max: [0, max).
//
// Note that:
// 1. The `max` can only be greater than 0, or else it returns `max` directly;
@ -95,7 +94,7 @@ func S(n int, symbols ...bool) string {
b[i] = characters[numberBytes[i]%62]
}
}
return *(*string)(unsafe.Pointer(&b))
return string(b)
}
// D returns a random time.Duration between min and max: [min, max].
@ -147,7 +146,7 @@ func Digits(n int) string {
for i := range b {
b[i] = digits[numberBytes[i]%10]
}
return *(*string)(unsafe.Pointer(&b))
return string(b)
}
// Letters returns a random string which contains only letters, and its length is `n`.
@ -162,7 +161,7 @@ func Letters(n int) string {
for i := range b {
b[i] = letters[numberBytes[i]%52]
}
return *(*string)(unsafe.Pointer(&b))
return string(b)
}
// Symbols returns a random string which contains only symbols, and its length is `n`.
@ -177,7 +176,7 @@ func Symbols(n int) string {
for i := range b {
b[i] = symbols[numberBytes[i]%32]
}
return *(*string)(unsafe.Pointer(&b))
return string(b)
}
// Perm returns, as a slice of n int numbers, a pseudo-random permutation of the integers [0,n).