Apparently CGFloat
is double
on arm64:
#if defined(__LP64__) && __LP64__
# define CGFLOAT_TYPE double
# define CGFLOAT_IS_DOUBLE 1
# define CGFLOAT_MIN DBL_MIN
# define CGFLOAT_MAX DBL_MAX
#else
# define CGFLOAT_TYPE float
# define CGFLOAT_IS_DOUBLE 0
# define CGFLOAT_MIN FLT_MIN
# define CGFLOAT_MAX FLT_MAX
#endif
So the code
NSScanner *scanner = [NSScanner scannerWithString:string];
CGFloat c[components];
[scanner scanFloat:&c[i]]
which was working fine for 32-bit apps, is broken for 64-bit. It can be replaced with
NSScanner *scanner = [NSScanner scannerWithString:string];
CGFloat c[components];
#if CGFLOAT_IS_DOUBLE
[scanner scanDouble:&c[i]];
#else
[scanner scanFloat:&c[i]];
#endif
But is there a better alternative?