[swift-users] appending packed bytes to [UInt8]

Kelvin Ma kelvin13ma at gmail.com
Wed Jan 10 15:03:08 CST 2018


I want to create a buffer with the layout

0           4           8           12      13      14      15      16
[   x:Float   |   y:Float   |   z:Float   | r:UInt8 | g:UInt8 | b:UInt8 |
_:UInt8 ]

Normally, I’d use UnsafeRawBufferPointer for this, but I need the buffer to
be a vector (i.e. with append(_:)), and for it to return a Swift-managed
Array<UInt8>. How should I do this? The project does not use Foundation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20180110/5d2d5517/attachment.html>


More information about the swift-users mailing list