<div dir="ltr">Use UnsafeMutableRawPointer.</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Sep 25, 2016 at 1:28 PM, Gerriet M. Denkmann via swift-users <span dir="ltr"><<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Got:<br>
var bitField : UnsafeMutablePointer<UInt32><br>
bitField = UnsafeMutablePointer< UInt32 >.allocate(capacity: 912)<br>
<br>
But now I want to read a certain range as bytes (not as UInt32);<br>
<br>
let staP = bitField + 23<br>
let endP = bitField + 99<br>
<br>
let staB = UnsafeMutablePointer<UInt8>(<wbr>staP) ← this does not work in Swift 3<br>
let endB = UnsafeMutablePointer<UInt8>(<wbr>endP)<br>
<br>
let result = someFunction( from: staB, until: endB ) // does something for bytes staB ..< endB<br>
<br>
Xcode hints about “withMemoryRebound”, but I cannot figure out the correct syntax.<br>
<br>
Gerriet<br>
<br>
______________________________<wbr>_________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-users</a><br>
</blockquote></div><br></div>