Re: How to detect endian-ness in Swift?
Re: How to detect endian-ness in Swift?
- Subject: Re: How to detect endian-ness in Swift?
- From: Jean-Daniel Dupas <email@hidden>
- Date: Wed, 23 Jul 2014 15:29:21 +0200
I guess if we need it a some point in the futur, Apple will introduce the required "preprocessor" directive, just like they provide os() and arch().
Le 23 juil. 2014 à 15:13, Gerriet M. Denkmann <email@hidden> a écrit :
>
>
> On 23 Jul 2014, at 20:09, Jean-Daniel Dupas <email@hidden> wrote:
>
>> Doesn't swift support only little endian platform anyway ?
>
> Probably. All current Mac hardware seems to be little-endian (not sure about iOS).
> But in the past (and maybe the future?) this was not the case.
> Objective-C understands __LITTLE_ENDIAN__; so why not Swift?
>
>>
>> Le 23 juil. 2014 à 11:59, Gerriet M. Denkmann <email@hidden> a écrit :
>>
>>> This compiles without warnings:
>>>
>>> #if __LITTLE_ENDIAN__
>>> let encoding = NSUTF32LittleEndianStringEncoding;
>>> println("LittleEndian")
>>> #else
>>> let encoding = NSUTF32BigEndianStringEncoding;
>>> println("BigEndian")
>>> #endif
>>>
>>> But it prints "BigEndian", which probably is NOT quite right.
>>> How to correctly set my encoding?
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden