@@ -1,7 +1,7 @@ /* - * Copyright (c) 2008-2021 Jonathan Schleifer + * Copyright (c) 2008-2022 Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -254,11 +254,10 @@ # define OF_WARN_UNUSED_RESULT #endif #if __has_attribute(__unavailable__) # define OF_UNAVAILABLE __attribute__((__unavailable__)) -# define OF_HAVE_UNAVAILABLE #else # define OF_UNAVAILABLE #endif #if __has_attribute(__objc_requires_super__) @@ -417,27 +416,33 @@ OF_PREPROCESSOR_CONCAT(destructor, __LINE__)(void) static OF_INLINE uint16_t OF_CONST_FUNC OFByteSwap16Const(uint16_t i) { - return (i & 0xFF00) >> 8 | (i & 0x00FF) << 8; + return (i & UINT16_C(0xFF00)) >> 8 | (i & UINT16_C(0x00FF)) << 8; } static OF_INLINE uint32_t OF_CONST_FUNC OFByteSwap32Const(uint32_t i) { - return (i & 0xFF000000) >> 24 | (i & 0x00FF0000) >> 8 | - (i & 0x0000FF00) << 8 | (i & 0x000000FF) << 24; + return (i & UINT32_C(0xFF000000)) >> 24 | + (i & UINT32_C(0x00FF0000)) >> 8 | + (i & UINT32_C(0x0000FF00)) << 8 | + (i & UINT32_C(0x000000FF)) << 24; } static OF_INLINE uint64_t OF_CONST_FUNC OFByteSwap64Const(uint64_t i) { - return (i & 0xFF00000000000000) >> 56 | (i & 0x00FF000000000000) >> 40 | - (i & 0x0000FF0000000000) >> 24 | (i & 0x000000FF00000000) >> 8 | - (i & 0x00000000FF000000) << 8 | (i & 0x0000000000FF0000) << 24 | - (i & 0x000000000000FF00) << 40 | (i & 0x00000000000000FF) << 56; + return (i & UINT64_C(0xFF00000000000000)) >> 56 | + (i & UINT64_C(0x00FF000000000000)) >> 40 | + (i & UINT64_C(0x0000FF0000000000)) >> 24 | + (i & UINT64_C(0x000000FF00000000)) >> 8 | + (i & UINT64_C(0x00000000FF000000)) << 8 | + (i & UINT64_C(0x0000000000FF0000)) << 24 | + (i & UINT64_C(0x000000000000FF00)) << 40 | + (i & UINT64_C(0x00000000000000FF)) << 56; } static OF_INLINE uint16_t OF_CONST_FUNC OFByteSwap16NonConst(uint16_t i) { @@ -518,11 +523,12 @@ "xchgl %%eax, %%edx" : "=A"(i) : "0"(i) ); #else - i = (uint64_t)OFByteSwap32NonConst((uint32_t)(i & 0xFFFFFFFF)) << 32 | + i = (uint64_t)OFByteSwap32NonConst( + (uint32_t)(i & UINT32_C(0xFFFFFFFF))) << 32 | OFByteSwap32NonConst((uint32_t)(i >> 32)); #endif return i; }