@@ -7,18 +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- target Entity // target entity if for a relation component
14- index uint32 // index of the column in the containing table
15- isRelation bool // whether this column is for a relation component
16- isTrivial bool // Whether the column's type is trivial , i.e. without pointers.
17- }
18-
19- type columnLayout struct {
20- pointer unsafe.Pointer // pointer to the first element
21- itemSize uintptr // memory size of items
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.
2218}
2319
2420// newColumn creates a new column for a given type and capacity.
@@ -28,10 +24,8 @@ func newColumn(index uint32, tp reflect.Type, itemSize uintptr, isRelation bool,
2824 pointer := data .Addr ().UnsafePointer ()
2925
3026 return column {
31- columnLayout : columnLayout {
32- pointer : pointer ,
33- itemSize : itemSize ,
34- },
27+ pointer : pointer ,
28+ itemSize : itemSize ,
3529 target : target ,
3630 index : index ,
3731 data : data ,
@@ -42,7 +36,7 @@ func newColumn(index uint32, tp reflect.Type, itemSize uintptr, isRelation bool,
4236}
4337
4438// Get returns a pointer to the component at the given index.
45- func (c * columnLayout ) Get (index uintptr ) unsafe.Pointer {
39+ func (c * column ) Get (index uintptr ) unsafe.Pointer {
4640 return unsafe .Add (c .pointer , index * c .itemSize )
4741}
4842
0 commit comments