iOS 15, Swift 5.5
Sorry, stupid easy question??
I am working on an image processing app, and I have this.
let pixels = UnsafeMutableBufferPointer<UInt32>(start: rawData, count: width * height)
Which I want to break into two pieces, so I tried this.
let fullSet = width * height
let halfSet = fullSet / 2
let pix1 = UnsafeMutableBufferPointer<UInt32>(start: rawData, count: halfSet)
let pix2 = UnsafeMutableBufferPointer<UInt32>(start: (rawData + halfSet), count: halfSet)
I suspect my problem is that the UInt32 is in fact a UInt24 + UInt8, as in red+green+blue and alpha channel.
I count the colours in my pixel Set and I got 120,433... but if I convert to an array I end up with 57,142.
Ok,
I found the answer, thanks everyone for your comments. And yes, it is stupid obvious, you just use a subset.
I was trying too hard I think.