Skip to content

Commit

Permalink
asd
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastien Binet <[email protected]>
  • Loading branch information
sbinet committed Feb 11, 2024
1 parent 3aec323 commit 6293fa5
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 150 deletions.
16 changes: 6 additions & 10 deletions groot/gen.rtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -812,20 +812,16 @@ func (leaf *rleaf{{.Kind}}{{.Name}}) ivalue() int { return int(*leaf.v) }
func unsafeDecayArray{{.Name}}(ptr interface{}) interface{} {
rv := reflect.ValueOf(ptr).Elem()
sz := rv.Type().Size() / {{.Size}}
arr := (*[0]{{.Type}})(unsafe.Pointer(rv.UnsafeAddr()))
sli := (*arr)[:]
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&sli))
hdr.Len = int(sz)
hdr.Cap = int(sz)
sli := unsafe.Slice((*{{.Type}})(unsafe.Pointer(rv.UnsafeAddr())), sz)
return &sli
}
func unsafeDecaySliceArray{{.Name}}(ptr *[]{{.Type}}, size int) interface{} {
var sli []{{.Type}}
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&sli))
hdr.Len = int(size)
hdr.Cap = int(size)
hdr.Data = (*reflect.SliceHeader)(unsafe.Pointer(ptr)).Data
if *ptr == nil {
var sli []{{.Type}}
return &sli
}
sli := unsafe.Slice(unsafe.SliceData(*ptr), size)
return &sli
}
{{- end}}
Expand Down
Loading

0 comments on commit 6293fa5

Please sign in to comment.