我正在尝试打印原始指针指向的指针的内容,但是当我打印或 NSLog 时,我得到的指针值比指针指向的内存内容要多。如何打印指针指向的内存内容?下面是我的代码:
let buffer = unsafeBitCast(baseAddress, to: UnsafeMutablePointer<UInt32>.self)
for row in 0..<bufferHeight
{
var pixel = buffer + row * bytesPerRow
for _ in 0..<bufferWidth {
// NSLog("Pixel \(pixel)")
print(pixel)
pixel = pixel + kBytesPerPixel
}
}