simplify AttrType.Size

This commit is contained in:
faiface 2016-12-02 22:55:58 +01:00
parent 3fe283ff71
commit 888e69899e
1 changed files with 2 additions and 3 deletions

View File

@ -47,7 +47,7 @@ const (
// Size returns the size of a type in bytes. // Size returns the size of a type in bytes.
func (at AttrType) Size() int { func (at AttrType) Size() int {
sizeOf := map[AttrType]int{ return map[AttrType]int{
Int: 4, Int: 4,
Float: 4, Float: 4,
Vec2: 2 * 4, Vec2: 2 * 4,
@ -62,6 +62,5 @@ func (at AttrType) Size() int {
Mat4: 4 * 4 * 4, Mat4: 4 * 4 * 4,
Mat42: 4 * 2 * 4, Mat42: 4 * 2 * 4,
Mat43: 4 * 3 * 4, Mat43: 4 * 3 * 4,
} }[at]
return sizeOf[at]
} }