@@ -95,11 +95,11 @@ now(void) { struct timeval tv; OFTimeInterval seconds; - OF_ENSURE(gettimeofday(&tv, NULL) == 0); + OFEnsure(gettimeofday(&tv, NULL) == 0); seconds = tv.tv_sec; seconds += (OFTimeInterval)tv.tv_usec / 1000000; return seconds; @@ -299,11 +299,11 @@ OFOnce(&once, initZeroDate); return (id)zeroDate; } #if defined(OF_OBJFW_RUNTIME) && UINTPTR_MAX == UINT64_MAX - value = OF_BSWAP64_IF_LE(OF_DOUBLE_TO_INT_RAW(OF_BSWAP_DOUBLE_IF_LE( + value = OFFromBigEndian64(OFDoubleToRawUInt64(OFToBigEndianDouble( seconds))); /* Almost all dates fall into this range. */ if (value & (UINT64_C(4) << 60)) { id ret = objc_createTaggedPointer(dateTag, @@ -327,11 +327,11 @@ { uint64_t value = (uint64_t)object_getTaggedPointerValue(self); value |= UINT64_C(4) << 60; - return OF_BSWAP_DOUBLE_IF_LE(OF_INT_TO_DOUBLE_RAW(OF_BSWAP64_IF_LE( + return OFFromBigEndianDouble(OFRawUInt64ToDouble(OFToBigEndian64( value))); } @end #endif @@ -511,12 +511,12 @@ value = [element unsignedLongLongValueWithBase: 16]; if (value > UINT64_MAX) @throw [OFOutOfRangeException exception]; - seconds = OF_BSWAP_DOUBLE_IF_LE(OF_INT_TO_DOUBLE_RAW( - OF_BSWAP64_IF_LE(value))); + seconds = OFFromBigEndianDouble(OFRawUInt64ToDouble( + OFToBigEndian64(value))); objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; @@ -543,21 +543,21 @@ return true; } - (unsigned long)hash { - uint32_t hash; + unsigned long hash; double tmp; - OF_HASH_INIT(hash); + OFHashInit(&hash); - tmp = OF_BSWAP_DOUBLE_IF_BE(self.timeIntervalSince1970); + tmp = OFToLittleEndianDouble(self.timeIntervalSince1970); for (size_t i = 0; i < sizeof(double); i++) - OF_HASH_ADD(hash, ((char *)&tmp)[i]); + OFHashAdd(&hash, ((char *)&tmp)[i]); - OF_HASH_FINALIZE(hash); + OFHashFinalize(&hash); return hash; } - (id)copy @@ -590,11 +590,11 @@ element = [OFXMLElement elementWithName: @"OFDate" namespace: OF_SERIALIZATION_NS]; element.stringValue = [OFString stringWithFormat: @"%016" PRIx64, - OF_BSWAP64_IF_LE(OF_DOUBLE_TO_INT_RAW(OF_BSWAP_DOUBLE_IF_LE( + OFFromBigEndian64(OFDoubleToRawUInt64(OFToBigEndianDouble( self.timeIntervalSince1970)))]; [element retain]; objc_autoreleasePoolPop(pool); @@ -614,11 +614,11 @@ if (seconds >= 0 && seconds < 0x400000000) { if (seconds <= UINT32_MAX && nanoseconds == 0) { uint32_t seconds32 = (uint32_t)seconds; OFData *data; - seconds32 = OF_BSWAP32_IF_LE(seconds32); + seconds32 = OFToBigEndian32(seconds32); data = [OFData dataWithItems: &seconds32 count: sizeof(seconds32)]; ret = [[OFMessagePackExtension extensionWithType: -1 @@ -626,11 +626,11 @@ } else { uint64_t combined = ((uint64_t)nanoseconds << 34) | (uint64_t)seconds; OFData *data; - combined = OF_BSWAP64_IF_LE(combined); + combined = OFToBigEndian64(combined); data = [OFData dataWithItems: &combined count: sizeof(combined)]; ret = [[OFMessagePackExtension extensionWithType: -1 @@ -637,13 +637,13 @@ data: data] messagePackRepresentation]; } } else { OFMutableData *data = [OFMutableData dataWithCapacity: 12]; - nanoseconds = OF_BSWAP32_IF_LE(nanoseconds); + nanoseconds = OFToBigEndian32(nanoseconds); [data addItems: &nanoseconds count: sizeof(nanoseconds)]; - seconds = OF_BSWAP64_IF_LE(seconds); + seconds = OFToBigEndian64(seconds); [data addItems: &seconds count: sizeof(seconds)]; ret = [[OFMessagePackExtension extensionWithType: -1 data: data] messagePackRepresentation]; @@ -893,11 +893,11 @@ - (OFTimeInterval)timeIntervalSinceNow { struct timeval t; OFTimeInterval seconds; - OF_ENSURE(gettimeofday(&t, NULL) == 0); + OFEnsure(gettimeofday(&t, NULL) == 0); seconds = t.tv_sec; seconds += (OFTimeInterval)t.tv_usec / 1000000; return self.timeIntervalSince1970 - seconds;