Index: src/OFDNSResolver.m ================================================================== --- src/OFDNSResolver.m +++ src/OFDNSResolver.m @@ -744,11 +744,11 @@ tmp = OF_BSWAP16_IF_LE(ID.uInt16Value); [queryData addItems: &tmp count: 2]; /* RD */ - tmp = OF_BSWAP16_IF_LE(1 << 8); + tmp = OF_BSWAP16_IF_LE(1u << 8); [queryData addItems: &tmp count: 2]; /* QDCOUNT */ tmp = OF_BSWAP16_IF_LE(1); Index: src/OFKernelEventObserver.m ================================================================== --- src/OFKernelEventObserver.m +++ src/OFKernelEventObserver.m @@ -428,11 +428,11 @@ OF_ENSURE(write(_cancelFD[1], "", 1) > 0); #elif defined(OF_AMIGAOS) Forbid(); if (_waitingTask != NULL) { - Signal(_waitingTask, (1 << _cancelSignal)); + Signal(_waitingTask, (1ul << _cancelSignal)); _waitingTask = NULL; } Permit(); #elif defined(OF_WII) Index: src/OFLHADecompressingStream.m ================================================================== --- src/OFLHADecompressingStream.m +++ src/OFLHADecompressingStream.m @@ -105,11 +105,11 @@ _bitIndex = 8; _distanceBits = distanceBits; _dictionaryBits = dictionaryBits; - _slidingWindowMask = (1 << dictionaryBits) - 1; + _slidingWindowMask = (1u << dictionaryBits) - 1; _slidingWindow = [self allocMemoryWithSize: _slidingWindowMask + 1]; memset(_slidingWindow, ' ', _slidingWindowMask + 1); } @catch (id e) { [self release]; @@ -454,11 +454,11 @@ goto start; case STATE_BLOCK_DIST_LENGTH_EXTRA: if OF_UNLIKELY (!tryReadBits(self, &bits, _distance - 1)) return bytesWritten; - _distance = bits + (1 << (_distance - 1)); + _distance = bits + (1u << (_distance - 1)); _state = STATE_BLOCK_LEN_DIST_PAIR; goto start; case STATE_BLOCK_LEN_DIST_PAIR: for (uint_fast16_t i = 0; i < _length; i++) { Index: src/OFSelectKernelEventObserver.m ================================================================== --- src/OFSelectKernelEventObserver.m +++ src/OFSelectKernelEventObserver.m @@ -185,21 +185,21 @@ #ifdef OF_AMIGAOS if ((cancelSignal = AllocSignal(-1)) == (ULONG)-1) @throw [OFObserveFailedException exceptionWithObserver: self errNo: EAGAIN]; - execSignalMask = _execSignalMask | (1 << cancelSignal); + execSignalMask = _execSignalMask | (1ul << cancelSignal); Forbid(); _waitingTask = FindTask(NULL); _cancelSignal = cancelSignal; events = WaitSelect(_maxFD + 1, &readFDs, &writeFDs, NULL, (void *)(timeInterval != -1 ? &timeout : NULL), &execSignalMask); - execSignalMask &= ~(1 << cancelSignal); + execSignalMask &= ~(1ul << cancelSignal); _waitingTask = NULL; FreeSignal(_cancelSignal); Permit(); Index: src/OFSystemInfo.m ================================================================== --- src/OFSystemInfo.m +++ src/OFSystemInfo.m @@ -582,51 +582,51 @@ } #if defined(OF_X86_64) || defined(OF_X86) + (bool)supportsMMX { - return (x86_cpuid(1, 0).edx & (1 << 23)); + return (x86_cpuid(1, 0).edx & (1u << 23)); } + (bool)supportsSSE { - return (x86_cpuid(1, 0).edx & (1 << 25)); + return (x86_cpuid(1, 0).edx & (1u << 25)); } + (bool)supportsSSE2 { - return (x86_cpuid(1, 0).edx & (1 << 26)); + return (x86_cpuid(1, 0).edx & (1u << 26)); } + (bool)supportsSSE3 { - return (x86_cpuid(1, 0).ecx & (1 << 0)); + return (x86_cpuid(1, 0).ecx & (1u << 0)); } + (bool)supportsSSSE3 { - return (x86_cpuid(1, 0).ecx & (1 << 9)); + return (x86_cpuid(1, 0).ecx & (1u << 9)); } + (bool)supportsSSE41 { - return (x86_cpuid(1, 0).ecx & (1 << 19)); + return (x86_cpuid(1, 0).ecx & (1u << 19)); } + (bool)supportsSSE42 { - return (x86_cpuid(1, 0).ecx & (1 << 20)); + return (x86_cpuid(1, 0).ecx & (1u << 20)); } + (bool)supportsAVX { - return (x86_cpuid(1, 0).ecx & (1 << 28)); + return (x86_cpuid(1, 0).ecx & (1u << 28)); } + (bool)supportsAVX2 { - return x86_cpuid(0, 0).eax >= 7 && (x86_cpuid(7, 0).ebx & (1 << 5)); + return x86_cpuid(0, 0).eax >= 7 && (x86_cpuid(7, 0).ebx & (1u << 5)); } #endif #if defined(OF_POWERPC) || defined(OF_POWERPC64) + (bool)supportsAltiVec Index: src/OFZIPArchive.m ================================================================== --- src/OFZIPArchive.m +++ src/OFZIPArchive.m @@ -516,11 +516,11 @@ entry.versionMadeBy = (entry.versionMadeBy & 0xFF00) | 45; entry.minVersionNeeded = (entry.minVersionNeeded & 0xFF00) | 45; entry.compressedSize = 0; entry.uncompressedSize = 0; entry.CRC32 = 0; - entry.generalPurposeBitFlag |= (1 << 3) | (1 << 11); + entry.generalPurposeBitFlag |= (1u << 3) | (1u << 11); entry.of_localFileHeaderOffset = _offset; [_stream writeLittleEndianInt32: 0x04034B50]; [_stream writeLittleEndianInt16: entry.minVersionNeeded]; [_stream writeLittleEndianInt16: entry.generalPurposeBitFlag]; @@ -654,11 +654,11 @@ _CRC32 = [stream readLittleEndianInt32]; _compressedSize = [stream readLittleEndianInt32]; _uncompressedSize = [stream readLittleEndianInt32]; fileNameLength = [stream readLittleEndianInt16]; extraFieldLength = [stream readLittleEndianInt16]; - encoding = (_generalPurposeBitFlag & (1 << 11) + encoding = (_generalPurposeBitFlag & (1u << 11) ? OF_STRING_ENCODING_UTF_8 : OF_STRING_ENCODING_CODEPAGE_437); _fileName = [[stream readStringWithLength: fileNameLength encoding: encoding] copy]; @@ -715,11 +715,11 @@ if (_compressionMethod != entry.compressionMethod || _lastModifiedFileTime != entry.of_lastModifiedFileTime || _lastModifiedFileDate != entry.of_lastModifiedFileDate) return false; - if (!(_generalPurposeBitFlag & (1 << 3))) + if (!(_generalPurposeBitFlag & (1u << 3))) if (_CRC32 != entry.CRC32 || _compressedSize != entry.compressedSize || _uncompressedSize != entry.uncompressedSize) return false; Index: src/OFZIPArchiveEntry.m ================================================================== --- src/OFZIPArchiveEntry.m +++ src/OFZIPArchiveEntry.m @@ -237,11 +237,11 @@ _startDiskNumber = [stream readLittleEndianInt16]; _internalAttributes = [stream readLittleEndianInt16]; _versionSpecificAttributes = [stream readLittleEndianInt32]; _localFileHeaderOffset = [stream readLittleEndianInt32]; - encoding = (_generalPurposeBitFlag & (1 << 11) + encoding = (_generalPurposeBitFlag & (1u << 11) ? OF_STRING_ENCODING_UTF_8 : OF_STRING_ENCODING_CODEPAGE_437); _fileName = [[stream readStringWithLength: fileNameLength encoding: encoding] copy]; Index: src/condition_amiga.m ================================================================== --- src/condition_amiga.m +++ src/condition_amiga.m @@ -38,11 +38,11 @@ @try { if (condition->waitingTasks == NULL) return true; Signal(condition->waitingTasks->task, - 1 << condition->waitingTasks->sigBit); + (1ul << condition->waitingTasks->sigBit)); condition->waitingTasks = condition->waitingTasks->next; } @finally { Permit(); } @@ -58,11 +58,11 @@ if (condition->waitingTasks == NULL) return true; while (condition->waitingTasks != NULL) { Signal(condition->waitingTasks->task, - 1 << condition->waitingTasks->sigBit); + (1ul << condition->waitingTasks->sigBit)); condition->waitingTasks = condition->waitingTasks->next; } } @finally { Permit(); Index: src/huffman_tree.m ================================================================== --- src/huffman_tree.m +++ src/huffman_tree.m @@ -46,11 +46,11 @@ { while (length > 0) { uint8_t bit; length--; - bit = (code & (1 << length)) >> length; + bit = (code & (1u << length)) >> length; if (tree->leaves[bit] == NULL) tree->leaves[bit] = newTree(); tree = tree->leaves[bit]; Index: src/macros.h ================================================================== --- src/macros.h +++ src/macros.h @@ -779,23 +779,23 @@ } static OF_INLINE bool of_bitset_isset(unsigned char *_Nonnull storage, size_t idx) { - return storage[idx / 8] & (1 << (idx % 8)); + return storage[idx / 8] & (1u << (idx % 8)); } static OF_INLINE void of_bitset_set(unsigned char *_Nonnull storage, size_t idx) { - storage[idx / 8] |= (1 << (idx % 8)); + storage[idx / 8] |= (1u << (idx % 8)); } static OF_INLINE void of_bitset_clear(unsigned char *_Nonnull storage, size_t idx) { - storage[idx / 8] &= ~(1 << (idx % 8)); + storage[idx / 8] &= ~(1u << (idx % 8)); } static OF_INLINE char *_Nullable of_strdup(const char *_Nonnull string) { Index: src/runtime/exception.m ================================================================== --- src/runtime/exception.m +++ src/runtime/exception.m @@ -276,12 +276,12 @@ int64_t value; value = readULEB128(ptr); bits = (*ptr - oldPtr) * 7; - if (bits < 64 && value & (1 << (bits - 1))) - value |= -(1 << bits); + if (bits < 64 && value & (INT64_C(1) << (bits - 1))) + value |= -(INT64_C(1) << bits); return value; } static uintptr_t Index: src/thread_amiga.m ================================================================== --- src/thread_amiga.m +++ src/thread_amiga.m @@ -51,11 +51,11 @@ of_tlskey_thread_exited(); if (thread->detached) detached = true; else if (thread->joinTask != NULL) - Signal(thread->joinTask, 1 << thread->joinSigBit); + Signal(thread->joinTask, (1ul << thread->joinSigBit)); } @finally { ReleaseSemaphore(&thread->semaphore); } if (detached)