mirror of
https://github.com/ii64/sonic.git
synced 2026-06-21 00:46:43 +08:00
chore: minor fixes
This commit is contained in:
parent
047c1c3d73
commit
66d6c789d4
3 changed files with 8 additions and 7 deletions
|
|
@ -27,7 +27,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
_MAP_THRESHHOLD = 5
|
||||
_MAP_THRESHOLD = 5
|
||||
_CAP_BITS = 32
|
||||
_LEN_MASK = 1<<_CAP_BITS - 1
|
||||
_APPEND_EXTRA_SIZE = 5
|
||||
|
|
@ -394,7 +394,7 @@ func (self *Node) mapped() bool {
|
|||
if self.m != nil && len(self.m) == self.Len() {
|
||||
return true
|
||||
}
|
||||
if self.Len() > _MAP_THRESHHOLD {
|
||||
if self.Len() > _MAP_THRESHOLD {
|
||||
self.appendMap()
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ const (
|
|||
const (
|
||||
_IM_null = 0x6c6c756e // 'null'
|
||||
_IM_true = 0x65757274 // 'true'
|
||||
_IM_alse = 0x65736c61 // 'fals' ('false' without the 'f')
|
||||
_IM_alse = 0x65736c61 // 'alse' ('false' without the 'f')
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -97,9 +97,10 @@ func (self *FieldMeta) optimize() {
|
|||
|
||||
/* last offset value */
|
||||
if v != 0 {
|
||||
self.Path[n].Type = nil
|
||||
self.Path[n].Size, v = v, 0
|
||||
self.Path[n].Kind, n = F_offset, n + 1
|
||||
self.Path[n].Size = v
|
||||
self.Path[n].Type = nil
|
||||
self.Path[n].Kind = F_offset
|
||||
n++
|
||||
}
|
||||
|
||||
/* must be at least 1 offset */
|
||||
|
|
@ -187,7 +188,7 @@ func ResolveStruct(vt reflect.Type) []FieldMeta {
|
|||
var ok bool
|
||||
var fm []FieldMeta
|
||||
|
||||
/* attemt to read from cache */
|
||||
/* attempt to read from cache */
|
||||
fieldLock.RLock()
|
||||
fm, ok = fieldCache[vt]
|
||||
fieldLock.RUnlock()
|
||||
|
|
|
|||
Loading…
Reference in a new issue