tus: Int {
> didSet { doSomething() }
> }
>
> Geordie
>
>
>> Am 10.07.2017 um 17:34 schrieb Gerriet M. Denkmann via swift-users
>> :
>>
>> This works (Xcode Version 8.3.2 (8E2002)):
>>
>> class SomeClass
>> {
>> private var
This works (Xcode Version 8.3.2 (8E2002)):
class SomeClass
{
private var privateStatus: Int
var status: Int
{
get{ return privateStatus }
set(new)
{
if new == privateStatus {return}
> On 12 Oct 2016, at 23:05, Joe Groff via swift-users
> wrote:
>
>>
>> On Oct 12, 2016, at 2:25 AM, Gerriet M. Denkmann via swift-users
>> wrote:
>>
>> uint64_t nbrBytes = 4e8;
>> uint64_t count = 0;
>> for( uint64_t byteIndex = 0; byt
uint64_t nbrBytes = 4e8;
uint64_t count = 0;
for( uint64_t byteIndex = 0; byteIndex < nbrBytes; byteIndex++ )
{
count += byteIndex;
if ( ( byteIndex & 0x ) == 0 ) { count += 1.3; } (AAA)
};
Takes 260 msec.
Btw.: Without the (AAA) line the whole loop is done in 10 μsec. A
How to translate this to Swift:
__block atomic_uint_fast64_t counter = ATOMIC_VAR_INIT(0);
dispatch_apply( nbrInterations, queue, ^void(size_t idx)
{
uint64_t tCount = 0;
... do some counting ...
atomic_fetch_add_explicit( &counter,
With:
let nbrBytes = 400_000_000
let localArray = UnsafeMutablePointer.allocate(capacity: nbrBytes)
// touch every page before summing:
for i in 0 ..< nbrBytes / 4096 { localArray[ 4096 * i ] = 1 }
This rather innocent loop:
var count: UInt64 = 0
for index in 0 ..< loopLimit { count += UInt64
> On 3 Oct 2016, at 19:17, Jean-Denis Muys via swift-users
> wrote:
>
> You are right: I don’t know much about asian languages.
>
> How would you go about counting consonants, vowels (and tone-marks?) in the
> most general way?
Iterate over unicodeScalars (in the most general case) - Swift c
> On 3 Oct 2016, at 16:28, Jean-Denis Muys via swift-users
> wrote:
>
> ASCII? Probably not. Latin? perhaps, though not obvious. For example French
> accented letters would probably have to be handled somehow. Greek or
> Cyrillic? Perhaps. Other scripts? Unlikely, but what do I know.
Don’t b
> 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-use
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 QualityOfSer
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
> On 23 Sep 2016, at 19:41, Quinn The Eskimo! via swift-users
> wrote:
>
>
> On 23 Sep 2016, at 11:29, Gerriet M. Denkmann via swift-users
> wrote:
>
>> What about calloc then? Or use allocate and do a memset afterwards?
>
> For trivial data types (like
> On 23 Sep 2016, at 15:47, Gerriet M. Denkmann via swift-users
> wrote:
>
> This used to work in Swift 2.2:
>
> var bitfield: UnsafeMutablePointer?
> bitfield = UnsafeMutablePointer( malloc( 888 ) )
>
> How is this written in Swift 3.0?
To answer my own questio
ut calloc then? Or use allocate and do a memset afterwards?
Thanks a lot for your help!
Kind regards,
Gerriet.
>> 23. sep. 2016 kl. 10.47 skrev Gerriet M. Denkmann via swift-users
>> :
>>
>> This used to work in Swift 2.2:
>>
>> var bitfield: UnsafeMuta
This used to work in Swift 2.2:
var bitfield: UnsafeMutablePointer?
bitfield = UnsafeMutablePointer( malloc( 888 ) )
How is this written in Swift 3.0?
Gerriet.
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo
16, at 12:09, Marco S Hyman wrote:
> >
> > On Sep 22, 2016, at 9:51 PM, Gerriet M. Denkmann via swift-users
> > wrote:
> >>
> >> This line (Swift 3):
> >> if a.responds(to: Selector(“viewControllers") )
> >> creates this warning: Use
> On 23 Sep 2016, at 12:09, Marco S Hyman wrote:
>
> On Sep 22, 2016, at 9:51 PM, Gerriet M. Denkmann via swift-users
> wrote:
>>
>> This line (Swift 3):
>> if a.responds(to: Selector(“viewControllers") )
>> creates this warning: Use '#
This line (Swift 3):
if a.responds(to: Selector(“viewControllers") )
creates this warning: Use '#selector' instead of explicitly constructing a
'Selector'
Ok. Following this advice I change it to:
if a.responds(to: #selector(“viewControllers"))
and now get an error instead: Argume
> On 13 Sep 2016, at 14:49, Quinn The Eskimo! via swift-users
> wrote:
>
>
> On 13 Sep 2016, at 05:03, Gerriet M. Denkmann via swift-users
> wrote:
>
>> Or is the code fundamentally wrong …?
>
> This one.
>
> You’re accessing a mutable value (`b
This function works flawlessly in Release build:
func markAndTell( talk: Bool, number: Int)
{
let nbrOfThreads = 8
let step = 2
let itemsPerThread = number * step
let bitLimit = nbrOfThreads * itemsPerThread
var bitfield = [Bool](count: bitLimit, repeatedVal
20 matches
Mail list logo