[Math] Make Matrix subscript setters mutable

I think this avoids making unnecessary copies of the matrix when setting data values.
This commit is contained in:
Eryn Wells 2015-11-01 19:39:01 -08:00
parent acd879465c
commit 0778e62fd0

View file

@ -85,7 +85,7 @@ public struct Matrix4: Matrix {
get { get {
return data[idx] return data[idx]
} }
set(value) { mutating set(value) {
data[idx] = value data[idx] = value
} }
} }
@ -94,7 +94,7 @@ public struct Matrix4: Matrix {
get { get {
return data[indexFromCoordinates(row, col)] return data[indexFromCoordinates(row, col)]
} }
set(value) { mutating set(value) {
data[indexFromCoordinates(row, col)] = value data[indexFromCoordinates(row, col)] = value
} }
} }
@ -135,7 +135,7 @@ public struct Matrix3: Matrix {
get { get {
return data[idx] return data[idx]
} }
set(value) { mutating set(value) {
data[idx] = value data[idx] = value
} }
} }
@ -144,7 +144,7 @@ public struct Matrix3: Matrix {
get { get {
return data[indexFromCoordinates(row, col)] return data[indexFromCoordinates(row, col)]
} }
set(value) { mutating set(value) {
data[indexFromCoordinates(row, col)] = value data[indexFromCoordinates(row, col)] = value
} }
} }