Re: [swift-users] Swift 3 and bytes

2016-09-25 Thread Jens Persson via swift-users
Use UnsafeMutableRawPointer.

On Sun, Sep 25, 2016 at 1:28 PM, Gerriet M. Denkmann via swift-users <
swift-users@swift.org> wrote:

> Got:
> var bitField : UnsafeMutablePointer
> bitField = UnsafeMutablePointer< UInt32 >.allocate(capacity: 912)
>
> But now I want to read a certain range as bytes (not as UInt32);
>
> let staP = bitField + 23
> let endP = bitField + 99
>
> let staB = UnsafeMutablePointer(staP)← this does not work in
> Swift 3
> let endB = UnsafeMutablePointer(endP)
>
> let result = someFunction( from: staB, until: endB ) // does something for
> bytes staB ..< endB
>
> Xcode hints about “withMemoryRebound”, but I cannot figure out the correct
> syntax.
>
> Gerriet
>
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] QualityOfService for concurrentPerform in Swift 3

2016-09-25 Thread Gerriet M. Denkmann via swift-users

> On 25 Sep 2016, at 23:08, Saagar Jha  wrote:
> 
> You might be looking for the DispatchQoS.QoSClass enum.
> 
> Saagar Jha

Probably. But how to make concurrentPerform use any of these enums?

Gerriet.



> 
>> On Sep 25, 2016, at 05:19, Gerriet M. Denkmann via swift-users 
>>  wrote:
>> 
>> In ObjC:
>> 
>> dispatch_queue_t queue = dispatch_get_global_queue( 
>> DISPATCH_QUEUE_PRIORITY_HIGH, 0 );   
>> dispatch_apply( nbrThreads, queue, ^void(size_t idx) …
>> 
>> In Swift 3:
>> DispatchQueue.concurrentPerform( iterations: nbrThreads) …
>> 
>> How can one specify the DISPATCH_QUEUE_PRIORITY or QualityOfService to be 
>> used by concurrentPerform?
>> 
>> Gerriet.
>> 
>> ___
>> swift-users mailing list
>> swift-users@swift.org
>> https://lists.swift.org/mailman/listinfo/swift-users
> 

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] QualityOfService for concurrentPerform in Swift 3

2016-09-25 Thread Saagar Jha via swift-users
You might be looking for the DispatchQoS.QoSClass 
 enum.

Saagar Jha



> On Sep 25, 2016, at 05:19, Gerriet M. Denkmann via swift-users 
>  wrote:
> 
> In ObjC:
> 
> dispatch_queue_t queue = dispatch_get_global_queue( 
> DISPATCH_QUEUE_PRIORITY_HIGH, 0 );
> dispatch_apply( nbrThreads, queue, ^void(size_t idx) …
> 
> In Swift 3:
> DispatchQueue.concurrentPerform( iterations: nbrThreads) …
> 
> How can one specify the DISPATCH_QUEUE_PRIORITY or QualityOfService to be 
> used by concurrentPerform?
> 
> Gerriet.
> 
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


[swift-users] QualityOfService for concurrentPerform in Swift 3

2016-09-25 Thread Gerriet M. Denkmann via swift-users
In ObjC:

dispatch_queue_t queue = dispatch_get_global_queue( 
DISPATCH_QUEUE_PRIORITY_HIGH, 0 );  
dispatch_apply( nbrThreads, queue, ^void(size_t idx) …

In Swift 3:
DispatchQueue.concurrentPerform( iterations: nbrThreads) …

How can one specify the DISPATCH_QUEUE_PRIORITY or QualityOfService to be used 
by concurrentPerform?

Gerriet.

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users