@@ -69,11 +69,11 @@ # define OF_PATH_DELIM '/' #else # define OF_PATH_DELIM '\\' #endif -#define OF_IVAR_OFFSET(ivar) ((char*)&ivar - (char*)self) +#define OF_IVAR_OFFSET(ivar) ((intptr_t)&ivar - (intptr_t)self) #define OF_GETTER(ivar, atomic) \ return objc_getProperty(self, _cmd, OF_IVAR_OFFSET(ivar), atomic); #define OF_SETTER(ivar, value, atomic, copy) \ objc_setProperty(self, _cmd, OF_IVAR_OFFSET(ivar), value, atomic, copy); @@ -180,12 +180,12 @@ "xchgl %%eax, %%edx" : "=A"(i) : "0"(i) ); #else - i = (uint64_t)of_bswap32_nonconst(i & 0xFFFFFFFF) << 32 | - of_bswap32_nonconst(i >> 32); + i = (uint64_t)of_bswap32_nonconst((uint32_t)(i & 0xFFFFFFFF)) << 32 | + of_bswap32_nonconst((uint32_t)(i >> 32)); #endif return i; } #ifdef __GNUC__ @@ -226,10 +226,18 @@ # define of_bswap32_if_le(i) of_bswap32(i) # define of_bswap64_if_le(i) of_bswap64(i) # define of_bswap32_vec_if_be(buf, len) #endif +/* + * We define it here and not in objfw-defs.h, as it would be theoretically + * possible to build a universal binary for Mac OS X and iOS. + */ +#if defined(__MACH__) && defined(__arm__) +# define OF_IOS +#endif + #define OF_ROL(val, bits) \ (((val) << ((bits) % (sizeof(val) * 8))) | \ (val) >> (sizeof(val) * 8 - ((bits) % (sizeof(val) * 8)))) #define OF_HASH_INIT(hash) hash = 0