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: Marco S Hyman <email@hidden>
- Date: Wed, 23 Jul 2014 20:02:09 -0700
This works fine:
> var encoding : UInt
> if Int(littleEndian: 42) == 42
> {
> // is little endian
> encoding = NSUTF32LittleEndianStringEncoding;
> }
> else
> {
> encoding = NSUTF32BigEndianStringEncoding;
> }
>
> But it creates a warning: "Will never be executed" for the big-endian case.
> I'm sure there will be a Swift endian build configuration switch "real soon now". So I will just live with this warning for now.
Invert your test (test for big endian) to get rid of the warning.
_______________________________________________
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