From 0778e62fd0f945a679d403aa608911d655540c0d Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 1 Nov 2015 19:39:01 -0800 Subject: [PATCH] [Math] Make Matrix subscript setters mutable I think this avoids making unnecessary copies of the matrix when setting data values. --- Math/Math/Matrix.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Math/Math/Matrix.swift b/Math/Math/Matrix.swift index feb2684..d1efde3 100644 --- a/Math/Math/Matrix.swift +++ b/Math/Math/Matrix.swift @@ -85,7 +85,7 @@ public struct Matrix4: Matrix { get { return data[idx] } - set(value) { + mutating set(value) { data[idx] = value } } @@ -94,7 +94,7 @@ public struct Matrix4: Matrix { get { return data[indexFromCoordinates(row, col)] } - set(value) { + mutating set(value) { data[indexFromCoordinates(row, col)] = value } } @@ -135,7 +135,7 @@ public struct Matrix3: Matrix { get { return data[idx] } - set(value) { + mutating set(value) { data[idx] = value } } @@ -144,7 +144,7 @@ public struct Matrix3: Matrix { get { return data[indexFromCoordinates(row, col)] } - set(value) { + mutating set(value) { data[indexFromCoordinates(row, col)] = value } }