Skip to content

Commit

Permalink
groot/rtree: use flattenArrayType in rleaf
Browse files Browse the repository at this point in the history
  • Loading branch information
sbinet committed Sep 24, 2020
1 parent 30b9ba3 commit 4d49a78
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions groot/rtree/rleaf.go
Expand Up @@ -44,7 +44,8 @@ func rleafFrom(leaf Leaf, rvar ReadVar, rctx rleafCtx) rleaf {
default:
rv := rv.Elem()
if rv.Kind() == reflect.Array {
switch rv.Type().Elem().Kind() {
rt, _ := flattenArrayType(rv.Type())
switch rt.Kind() {
case reflect.Int8:
return newRLeafI8(leaf, rvar, rctx)
case reflect.Uint8:
Expand All @@ -62,7 +63,8 @@ func rleafFrom(leaf Leaf, rvar ReadVar, rctx rleafCtx) rleaf {
default:
rv := rv.Elem()
if rv.Kind() == reflect.Array {
switch rv.Type().Elem().Kind() {
rt, _ := flattenArrayType(rv.Type())
switch rt.Kind() {
case reflect.Int16:
return newRLeafI16(leaf, rvar, rctx)
case reflect.Uint16:
Expand All @@ -80,7 +82,8 @@ func rleafFrom(leaf Leaf, rvar ReadVar, rctx rleafCtx) rleaf {
default:
rv := rv.Elem()
if rv.Kind() == reflect.Array {
switch rv.Type().Elem().Kind() {
rt, _ := flattenArrayType(rv.Type())
switch rt.Kind() {
case reflect.Int32:
return newRLeafI32(leaf, rvar, rctx)
case reflect.Uint32:
Expand All @@ -98,7 +101,8 @@ func rleafFrom(leaf Leaf, rvar ReadVar, rctx rleafCtx) rleaf {
default:
rv := rv.Elem()
if rv.Kind() == reflect.Array {
switch rv.Type().Elem().Kind() {
rt, _ := flattenArrayType(rv.Type())
switch rt.Kind() {
case reflect.Int64:
return newRLeafI64(leaf, rvar, rctx)
case reflect.Uint64:
Expand Down

0 comments on commit 4d49a78

Please sign in to comment.