Memset to UnsafeMutablePointer<UInt8> in swift
问题 I have a challenge with a variable with type UnsafeMutablePointer<UInt8> . I have this working code to alloc and set to zero all an UInt8 array in Swift. var bits = UnsafeMutablePointer<UInt8>(calloc(width * height, 8)) The problem is I'd like to do it without use the calloc method. I have this code to alloc the array var bits = UnsafeMutablePointer<UInt8>.alloc(width * height) but I can't find a method to set to zero all the memory. I know I can do this, but I don't think is the best way.