@@ -7,19 +7,14 @@ import (
77
88// column storage for components in an table.
99type column struct {
10- columnLayout
11- data reflect.Value // data buffer
12- elemType reflect.Type // element type of the column
13- index uint32 // index of the column in the containing table
14- isRelation bool // whether this column is for a relation component
15- isTrivial bool // Whether the column's type is trivial , i.e. without pointers.
16- }
17-
18- // columnLayout contains the minimal necessary information for column.Get.
19- type columnLayout struct {
20- pointer unsafe.Pointer // pointer to the first element
21- itemSize uintptr // memory size of items
22- target Entity // target entity if for a relation component
10+ data reflect.Value // data buffer
11+ pointer unsafe.Pointer // pointer to the first element
12+ itemSize uintptr // memory size of items
13+ elemType reflect.Type // element type of the column
14+ target Entity // target entity if for a relation component
15+ index uint32 // index of the column in the containing table
16+ isRelation bool // whether this column is for a relation component
17+ isTrivial bool // Whether the column's type is trivial , i.e. without pointers.
2318}
2419
2520// newColumn creates a new column for a given type and capacity.
@@ -29,11 +24,9 @@ func newColumn(index uint32, tp reflect.Type, itemSize uintptr, isRelation bool,
2924 pointer := data .Addr ().UnsafePointer ()
3025
3126 return column {
32- columnLayout : columnLayout {
33- pointer : pointer ,
34- itemSize : itemSize ,
35- target : target ,
36- },
27+ pointer : pointer ,
28+ itemSize : itemSize ,
29+ target : target ,
3730 index : index ,
3831 data : data ,
3932 isRelation : isRelation ,
@@ -43,7 +36,7 @@ func newColumn(index uint32, tp reflect.Type, itemSize uintptr, isRelation bool,
4336}
4437
4538// Get returns a pointer to the component at the given index.
46- func (c * columnLayout ) Get (index uintptr ) unsafe.Pointer {
39+ func (c * column ) Get (index uintptr ) unsafe.Pointer {
4740 return unsafe .Add (c .pointer , index * c .itemSize )
4841}
4942
@@ -137,11 +130,6 @@ func (c *entityColumn) Get(index uintptr) unsafe.Pointer {
137130 return unsafe .Add (c .pointer , index * entitySize )
138131}
139132
140- // GetEntity returns the entity at the given index.
141- func (c * entityColumn ) GetEntity (index uintptr ) Entity {
142- return * (* Entity )(unsafe .Add (c .pointer , index * entitySize ))
143- }
144-
145133// CopyToEnd copies from the given column to the end of this column.
146134// Column length must be increased before.
147135func (c * entityColumn ) CopyToEnd (from * entityColumn , ownLen uint32 , count uint32 ) {
0 commit comments