Avatar
上の方に貼ったのから殆ど変わってないですが func test() { var rgb = [Double](repeating: 1, count: 4) let scalar: Double = 0.99 rgb.withUnsafeMutableBufferPointer { var p = $0.baseAddress! for _ in 0..<$0.count { p.pointee *= scalar p += 1 } } }