Skip to content

Commit

Permalink
fix castSlice
Browse files Browse the repository at this point in the history
  • Loading branch information
qmuntal committed Aug 30, 2024
1 parent 2344d28 commit 9eb9117
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions binary/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func reslice[T any](v []byte, length, rem int) []T {
if rem > 0 {
return append(s, make([]T, rem)...)
}
return s[:length]
return s
}

func castSlice(c gltf.ComponentType, t gltf.AccessorType, count int, v []byte) any {
Expand All @@ -27,7 +27,6 @@ func castSlice(c gltf.ComponentType, t gltf.AccessorType, count int, v []byte) a
if count < l {
l = count
} else if count > l {
l = count
rem = count - l
}

Expand Down
8 changes: 4 additions & 4 deletions modeler/read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ func TestReadAccessorAllocs(t *testing.T) {
})
t.Run("2", func(t *testing.T) {
buf := make([]byte, 24)
testFunc(t, buf, 1)
testFunc(t, buf, 1)
testFunc(t, buf, 1)
testFunc(t, buf, 1)
testFunc(t, buf, 3)
testFunc(t, buf, 3)
testFunc(t, buf, 3)
testFunc(t, buf, 3)
})
t.Run("4", func(t *testing.T) {
buf := make([]byte, 48)
Expand Down

0 comments on commit 9eb9117

Please sign in to comment.