From 541e7c38ef1e71c325f2567067c589f07ecaf2e3 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 1 Nov 2015 20:40:27 -0800 Subject: [PATCH] [Math] Move the multiplication to the * operator *= must be done with a temporary variable first to avoid stepping on the other elements. --- Math/Math/Matrix.swift | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Math/Math/Matrix.swift b/Math/Math/Matrix.swift index 7339cbd..d4c3ea6 100644 --- a/Math/Math/Matrix.swift +++ b/Math/Math/Matrix.swift @@ -270,19 +270,22 @@ public func -(lhs: T, rhs: T) -> T { // MARK: Matrix-Matrix multiplication public func *=(inout lhs: T, rhs: T) { - for i in 0..(lhs: T, rhs: T) -> T { - var out = lhs - out *= rhs + var out = T() + for i in 0..