[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:
		
							parent
							
								
									acd879465c
								
							
						
					
					
						commit
						0778e62fd0
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue