Consistently use literal suffix in upper-case

This commit is contained in:
Hielke Morsink 2022-10-17 13:58:22 +02:00
parent 9b4cdb903c
commit 97a7fcc110
No known key found for this signature in database
GPG Key ID: FE0B343DF883E7F2
23 changed files with 65 additions and 65 deletions

View File

@ -804,7 +804,7 @@ void OpenGLDrawingContext::DrawSpriteSolid(rct_drawpixelinfo* dpi, const ImageId
{
CalculcateClipping(dpi);
assert((colour & 0xFF) > 0u);
assert((colour & 0xFF) > 0U);
auto g1Element = gfx_get_g1_element(image);
if (g1Element == nullptr)

View File

@ -116,7 +116,7 @@ enum : uint32_t
GAME_COMMAND_FLAG_NO_SPEND = (1 << 5), // Game command is not networked
GAME_COMMAND_FLAG_GHOST = (1 << 6), // Game command is not networked
GAME_COMMAND_FLAG_TRACK_DESIGN = (1 << 7),
GAME_COMMAND_FLAG_NETWORKED = (1u << 31) // Game command is coming from network
GAME_COMMAND_FLAG_NETWORKED = (1U << 31) // Game command is coming from network
};
enum

View File

@ -27,7 +27,7 @@ namespace OpenRCT2
template<size_t TNumBits> static constexpr size_t ByteAlignBits()
{
const auto reminder = TNumBits % BitsPerByte;
if constexpr (reminder == 0u)
if constexpr (reminder == 0U)
{
return TNumBits;
}
@ -57,10 +57,10 @@ namespace OpenRCT2
else
{
const auto numBytes = numBits / BitsPerByte;
auto mask = 1u;
auto mask = 1U;
while (mask < numBytes)
{
mask <<= 1u;
mask <<= 1U;
}
return mask;
}
@ -93,11 +93,11 @@ namespace OpenRCT2
{
size_t res = 0;
auto x = static_cast<std::make_unsigned_t<T>>(val);
while (x > 0u)
while (x > 0U)
{
if (x & 1u)
if (x & 1U)
res++;
x >>= 1u;
x >>= 1U;
}
return res;
}
@ -142,8 +142,8 @@ namespace OpenRCT2
static constexpr size_t BlockCount = Detail::BitSet::ComputeBlockCount<ByteAlignedBitSize, BlockByteSize>();
static constexpr size_t CapacityBits = BlockCount * BlockBitSize;
static constexpr StorageBlockType BlockValueZero = StorageBlockType{ 0u };
static constexpr StorageBlockType BlockValueOne = StorageBlockType{ 1u };
static constexpr StorageBlockType BlockValueZero = StorageBlockType{ 0U };
static constexpr StorageBlockType BlockValueOne = StorageBlockType{ 1U };
static constexpr StorageBlockType BlockValueMask = static_cast<StorageBlockType>(~BlockValueZero);
static constexpr bool RequiresTrim = TBitSize != CapacityBits;

View File

@ -37,7 +37,7 @@ enum : uint32_t
TEXT_DRAW_FLAG_NO_FORMATTING = 1 << 28,
TEXT_DRAW_FLAG_Y_OFFSET_EFFECT = 1 << 29,
TEXT_DRAW_FLAG_TTF = 1 << 30,
TEXT_DRAW_FLAG_NO_DRAW = 1u << 31
TEXT_DRAW_FLAG_NO_DRAW = 1U << 31
};
static int32_t ttf_get_string_width(std::string_view text, FontStyle fontStyle, bool noFormatting);

View File

@ -159,7 +159,7 @@ enum : uint32_t
IMAGE_TYPE_DEFAULT = 0,
IMAGE_TYPE_REMAP = (1 << 29),
IMAGE_TYPE_TRANSPARENT = (1 << 30),
IMAGE_TYPE_REMAP_2_PLUS = (1u << 31)
IMAGE_TYPE_REMAP_2_PLUS = (1U << 31)
// REMAP_2_PLUS + REMAP = REMAP 2
// REMAP_2_PLUS = REMAP 3
};

View File

@ -2839,7 +2839,7 @@ static void peep_update_ride_nausea_growth(Guest* peep, Ride* ride)
uint32_t nauseaGrowthRateChange = (ride->nausea * nauseaMultiplier) / 512;
nauseaGrowthRateChange *= std::max(static_cast<uint8_t>(128), peep->Hunger) / 64;
nauseaGrowthRateChange >>= (EnumValue(peep->NauseaTolerance) & 3);
peep->NauseaTarget = static_cast<uint8_t>(std::min(peep->NauseaTarget + nauseaGrowthRateChange, 255u));
peep->NauseaTarget = static_cast<uint8_t>(std::min(peep->NauseaTarget + nauseaGrowthRateChange, 255U));
}
static bool peep_should_go_on_ride_again(Guest* peep, Ride* ride)

View File

@ -228,7 +228,7 @@ enum PeepFlags : uint32_t
PEEP_FLAGS_INTAMIN_DEPRECATED = (1 << 27), // Used to make the peep think "I'm so excited - It's an Intamin ride!" while
// riding on a Intamin ride.
PEEP_FLAGS_HERE_WE_ARE = (1 << 28), // Makes the peep think "...and here we are on X!" while riding a ride
PEEP_FLAGS_TWITCH_DEPRECATED = (1u << 31), // Formerly used for twitch integration
PEEP_FLAGS_TWITCH_DEPRECATED = (1U << 31), // Formerly used for twitch integration
};
enum PeepNextFlags

View File

@ -154,7 +154,7 @@ bool Staff::CanIgnoreWideFlag(const CoordsXYZ& staffPos, TileElement* path) cons
total++;
/* Check if path has an edge in adjac_dir */
if (!(path->AsPath()->GetEdges() & (1u << adjac_dir)))
if (!(path->AsPath()->GetEdges() & (1U << adjac_dir)))
{
continue;
}

View File

@ -41,7 +41,7 @@ enum class WindowWidgetType : uint8_t
};
constexpr const auto WIDGETS_END = rct_widget{ WindowWidgetType::Last, 0, 0, 0, 0, 0, 0, 0 };
#define BAR_BLINK (1u << 31)
#define BAR_BLINK (1U << 31)
enum
{

View File

@ -33,7 +33,7 @@ namespace OpenRCT2
uint32_t _capacity;
TTraits _traits;
static constexpr uint32_t FlagLocalStorage = (1u << 31);
static constexpr uint32_t FlagLocalStorage = (1U << 31);
public:
explicit FormatBufferBase()

View File

@ -630,7 +630,7 @@ void award_update_all()
if (award_is_deserved(awardType, activeAwardTypes))
{
// Add award
_currentAwards.push_back(Award{ 5u, awardType });
_currentAwards.push_back(Award{ 5U, awardType });
if (gConfigNotifications.ParkAward)
{
News::AddItemToQueue(News::ItemType::Award, AwardNewsStrings[EnumValue(awardType)], 0, {});

View File

@ -48,7 +48,7 @@ void WallObject::ReadLegacy(IReadObjectContext* context, OpenRCT2::IStream* stre
if (identifier == "XXWLBR03")
{
_legacyType.flags2 &= ~WALL_SCENERY_2_DOOR_SOUND_MASK;
_legacyType.flags2 |= (1u << WALL_SCENERY_2_DOOR_SOUND_SHIFT) & WALL_SCENERY_2_DOOR_SOUND_MASK;
_legacyType.flags2 |= (1U << WALL_SCENERY_2_DOOR_SOUND_SHIFT) & WALL_SCENERY_2_DOOR_SOUND_MASK;
}
}

View File

@ -73,8 +73,8 @@ enum
namespace PaintSessionFlags
{
constexpr uint8_t PassedSurface = 1u << 0;
constexpr uint8_t IsTrackPiecePreview = 1u << 1;
constexpr uint8_t PassedSurface = 1U << 0;
constexpr uint8_t IsTrackPiecePreview = 1U << 1;
} // namespace PaintSessionFlags
extern const int32_t SEGMENTS_ALL;

View File

@ -2277,7 +2277,7 @@ enum : uint32_t
{
S6_SAVE_FLAG_EXPORT = 1 << 0,
S6_SAVE_FLAG_SCENARIO = 1 << 1,
S6_SAVE_FLAG_AUTOMATIC = 1u << 31,
S6_SAVE_FLAG_AUTOMATIC = 1U << 31,
};
int32_t scenario_save(u8string_view path, int32_t flags)

View File

@ -136,7 +136,7 @@ size_t RideManager::size() const
RideManager::Iterator RideManager::begin()
{
const auto endIndex = static_cast<RideId::UnderlyingType>(_rides.size());
return RideManager::Iterator(*this, 0u, endIndex);
return RideManager::Iterator(*this, 0U, endIndex);
}
RideManager::Iterator RideManager::end()

View File

@ -169,13 +169,13 @@ enum : uint32_t
TRACK_FLAGS_CONTAINS_WATER_SPLASH = (1 << 27),
TRACK_FLAGS_CONTAINS_BARREL_ROLL = (1 << 29),
TRACK_FLAGS_CONTAINS_POWERED_LIFT = (1 << 30),
TRACK_FLAGS_CONTAINS_LARGE_HALF_LOOP = (1u << 31),
TRACK_FLAGS_CONTAINS_LARGE_HALF_LOOP = (1U << 31),
};
enum : uint32_t
{
TRACK_FLAGS2_CONTAINS_LOG_FLUME_REVERSER = (1 << 1),
TRACK_FLAGS2_SIX_FLAGS_RIDE_DEPRECATED = (1u << 31) // Not used anymore.
TRACK_FLAGS2_SIX_FLAGS_RIDE_DEPRECATED = (1U << 31) // Not used anymore.
};
enum

View File

@ -2959,7 +2959,7 @@ static void test_finish(Ride& ride)
totalTime += rideStations[i].SegmentTime;
}
totalTime = std::max(totalTime, 1u);
totalTime = std::max(totalTime, 1U);
ride.average_speed = ride.average_speed / totalTime;
window_invalidate_by_number(WindowClass::Ride, ride.id.ToUnderlying());
}
@ -6800,7 +6800,7 @@ void Vehicle::UpdateAdditionalAnimation()
UpdateAnimationAnimalFlying();
// makes animation play faster with vehicle speed
targetFrame = abs(_vehicleVelocityF64E08) >> 24;
animationState = std::max(animationState - targetFrame, 0u);
animationState = std::max(animationState - targetFrame, 0U);
break;
}
}

View File

@ -70,7 +70,7 @@ enum : uint32_t
CAR_ENTRY_FLAG_CHAIRLIFT = 1 << 28,
CAR_ENTRY_FLAG_WATER_RIDE = 1 << 29, // Set on rides where water would provide continuous propulsion.
CAR_ENTRY_FLAG_GO_KART = 1 << 30,
CAR_ENTRY_FLAG_DODGEM_CAR_PLACEMENT = 1u << 31,
CAR_ENTRY_FLAG_DODGEM_CAR_PLACEMENT = 1U << 31,
};
enum : uint32_t

View File

@ -66,7 +66,7 @@ int32_t bitscanforward(int32_t source)
// any intrinsic.
// cf. https://github.com/OpenRCT2/OpenRCT2/pull/2093
for (int32_t i = 0; i < 32; i++)
if (source & (1u << i))
if (source & (1U << i))
return i;
return -1;
@ -88,7 +88,7 @@ int32_t bitscanforward(int64_t source)
// any intrinsic.
// cf. https://github.com/OpenRCT2/OpenRCT2/pull/2093
for (int32_t i = 0; i < 64; i++)
if (source & (1ull << i))
if (source & (1ULL << i))
return i;
return -1;

View File

@ -403,7 +403,7 @@ int32_t Park::CalculateParkRating() const
result -= 500;
if (gNumGuestsInPark > 0)
{
result += 2 * std::min(250u, (happyGuestCount * 300) / gNumGuestsInPark);
result += 2 * std::min(250U, (happyGuestCount * 300) / gNumGuestsInPark);
}
// Up to 25 guests can be lost without affecting the park rating.

View File

@ -40,7 +40,7 @@ enum : uint32_t
PARK_FLAGS_NO_MONEY_SCENARIO = (1 << 17), // Deprecated, originally used in scenario editor
PARK_FLAGS_SPRITES_INITIALISED = (1 << 18), // After a scenario is loaded this prevents edits in the scenario editor
PARK_FLAGS_SIX_FLAGS_DEPRECATED = (1 << 19), // Not used anymore
PARK_FLAGS_UNLOCK_ALL_PRICES = (1u << 31), // OpenRCT2 only!
PARK_FLAGS_UNLOCK_ALL_PRICES = (1U << 31), // OpenRCT2 only!
};
struct Guest;

View File

@ -14,14 +14,14 @@ using namespace OpenRCT2;
TEST(BitTest, test_index_construction)
{
BitSet<64u> bits({ 0u, 2u, 4u, 6u, 8u, 10u });
BitSet<64U> bits({ 0U, 2U, 4U, 6U, 8U, 10U });
#if defined(_M_X64) || defined(_M_ARM64)
static_assert(std::is_same_v<decltype(bits)::BlockType, uint64_t>);
#else
static_assert(std::is_same_v<decltype(bits)::BlockType, uint32_t>);
#endif
constexpr auto size = sizeof(bits);
static_assert(size == 8u);
static_assert(size == 8U);
ASSERT_EQ(bits.data()[0], 0b10101010101U);
ASSERT_EQ(bits.to_string(), std::string("0000000000000000000000000000000000000000000000000000010101010101"));
@ -29,7 +29,7 @@ TEST(BitTest, test_index_construction)
TEST(BitTest, test_basic)
{
BitSet<8u> bits;
BitSet<8U> bits;
static_assert(std::is_same_v<decltype(bits)::BlockType, uint8_t>);
constexpr auto size = sizeof(bits);
static_assert(size == sizeof(uint8_t));
@ -42,26 +42,26 @@ TEST(BitTest, test_basic)
ASSERT_EQ(bits[0], false);
bits[0] = bits[6];
ASSERT_EQ(bits[0], true);
ASSERT_EQ(bits.data()[0u], 0b01000001U);
ASSERT_EQ(bits.data()[0U], 0b01000001U);
ASSERT_EQ(bits.to_string(), std::string("01000001"));
}
TEST(BitTest, test_flip)
{
BitSet<8u> bits;
BitSet<8U> bits;
static_assert(std::is_same_v<decltype(bits)::BlockType, uint8_t>);
constexpr auto size = sizeof(bits);
static_assert(size == sizeof(uint8_t));
bits.flip();
ASSERT_EQ(bits.data()[0u], 0xFFu);
ASSERT_EQ(bits.data()[0U], 0xFFu);
bits.flip();
ASSERT_EQ(bits.data()[0u], 0x00u);
ASSERT_EQ(bits.data()[0U], 0x00u);
}
TEST(BitTest, test_trim8)
{
BitSet<5u> bits;
BitSet<5U> bits;
static_assert(std::is_same_v<decltype(bits)::BlockType, uint8_t>);
constexpr auto size = sizeof(bits);
static_assert(size == sizeof(uint8_t));
@ -70,12 +70,12 @@ TEST(BitTest, test_trim8)
ASSERT_EQ(bits[5], false);
ASSERT_EQ(bits[6], false);
ASSERT_EQ(bits[7], false);
ASSERT_EQ(bits.data()[0u], 0b00011111u);
ASSERT_EQ(bits.data()[0U], 0b00011111u);
}
TEST(BitTest, test_trim16)
{
BitSet<14u> bits;
BitSet<14U> bits;
static_assert(std::is_same_v<decltype(bits)::BlockType, uint16_t>);
constexpr auto size = sizeof(bits);
static_assert(size == sizeof(uint16_t));
@ -83,15 +83,15 @@ TEST(BitTest, test_trim16)
bits.flip();
ASSERT_EQ(bits[14], false);
ASSERT_EQ(bits[15], false);
ASSERT_EQ(bits.data()[0u], 0b0011111111111111u);
ASSERT_EQ(bits.data()[0U], 0b0011111111111111u);
ASSERT_EQ(bits.to_string(), std::string("11111111111111"));
}
TEST(BitTest, test_big)
{
BitSet<256u> bits;
BitSet<256U> bits;
constexpr auto size = sizeof(bits);
static_assert(size == 32u);
static_assert(size == 32U);
bits.flip();
#if defined(_M_X64) || defined(_M_ARM64)
@ -117,8 +117,8 @@ TEST(BitTest, test_big)
TEST(BitTest, test_xor5)
{
BitSet<5u> bits1({ 0u, 2u, 4u });
BitSet<5u> bits2({ 0u, 1u, 3u });
BitSet<5U> bits1({ 0U, 2U, 4U });
BitSet<5U> bits2({ 0U, 1U, 3U });
auto res = bits1 ^ bits2;
ASSERT_EQ(res.data()[0], 0b11110u);
@ -127,8 +127,8 @@ TEST(BitTest, test_xor5)
TEST(BitTest, test_xor15)
{
BitSet<15u> bits1({ 0u, 2u, 4u });
BitSet<15u> bits2({ 0u, 1u, 3u, 14u });
BitSet<15U> bits1({ 0U, 2U, 4U });
BitSet<15U> bits2({ 0U, 1U, 3U, 14U });
auto res = bits1 ^ bits2;
ASSERT_EQ(res.data()[0], 0b0100000000011110u);
@ -137,8 +137,8 @@ TEST(BitTest, test_xor15)
TEST(BitTest, test_or5)
{
BitSet<5u> bits1({ 0u, 2u, 4u });
BitSet<5u> bits2({ 0u, 1u, 3u });
BitSet<5U> bits1({ 0U, 2U, 4U });
BitSet<5U> bits2({ 0U, 1U, 3U });
auto res = bits1 | bits2;
ASSERT_EQ(res.data()[0], 0b11111);
@ -147,8 +147,8 @@ TEST(BitTest, test_or5)
TEST(BitTest, test_or15)
{
BitSet<15u> bits1({ 0u, 2u, 4u });
BitSet<15u> bits2({ 0u, 1u, 3u, 14u });
BitSet<15U> bits1({ 0U, 2U, 4U });
BitSet<15U> bits2({ 0U, 1U, 3U, 14U });
auto res = bits1 | bits2;
ASSERT_EQ(res.data()[0], 0b0100000000011111u);
@ -157,8 +157,8 @@ TEST(BitTest, test_or15)
TEST(BitTest, test_and5)
{
BitSet<5u> bits1({ 0u, 2u, 4u });
BitSet<5u> bits2({ 0u, 1u, 3u });
BitSet<5U> bits1({ 0U, 2U, 4U });
BitSet<5U> bits2({ 0U, 1U, 3U });
auto res = bits1 & bits2;
ASSERT_EQ(res.data()[0], 0b1);
@ -167,8 +167,8 @@ TEST(BitTest, test_and5)
TEST(BitTest, test_and15)
{
BitSet<15u> bits1({ 0u, 2u, 4u });
BitSet<15u> bits2({ 0u, 1u, 3u, 14u });
BitSet<15U> bits1({ 0U, 2U, 4U });
BitSet<15U> bits2({ 0U, 1U, 3U, 14U });
auto res = bits1 & bits2;
ASSERT_EQ(res.data()[0], 0b1);
@ -177,7 +177,7 @@ TEST(BitTest, test_and15)
TEST(BitTest, test_neg5)
{
BitSet<5u> bits1({ 0u, 2u, 4u });
BitSet<5U> bits1({ 0U, 2U, 4U });
auto res = ~bits1;
ASSERT_EQ(res.data()[0], 0b01010u);
@ -186,7 +186,7 @@ TEST(BitTest, test_neg5)
TEST(BitTest, test_neg15)
{
BitSet<15u> bits1({ 0u, 2u, 4u });
BitSet<15U> bits1({ 0U, 2U, 4U });
auto res = ~bits1;
ASSERT_EQ(res.data()[0], 0b111111111101010u);
@ -195,13 +195,13 @@ TEST(BitTest, test_neg15)
TEST(BitTest, test_count)
{
BitSet<31u> bits1({ 0u, 2u, 4u, 7u, 9u, 12u, 16u, 19u, 22u, 29u });
ASSERT_EQ(bits1.count(), 10u);
BitSet<31U> bits1({ 0U, 2U, 4U, 7U, 9U, 12U, 16U, 19U, 22U, 29U });
ASSERT_EQ(bits1.count(), 10U);
}
TEST(BitTest, test_iterator)
{
BitSet<31u> bits1({ 0u, 2u, 4u, 7u, 9u, 12u, 16u, 19u, 22u, 29u });
BitSet<31U> bits1({ 0U, 2U, 4U, 7U, 9U, 12U, 16U, 19U, 22U, 29U });
int totalBits = 0;
for (auto v : bits1)
@ -214,7 +214,7 @@ TEST(BitTest, test_iterator)
TEST(BitTest, test_iterator_const)
{
BitSet<31u> bits1({ 0u, 2u, 4u, 7u, 9u, 12u, 16u, 19u, 22u, 29u });
BitSet<31U> bits1({ 0U, 2U, 4U, 7U, 9U, 12U, 16U, 19U, 22U, 29U });
int totalBits = 0;
auto test = [&](const auto& b) {

View File

@ -136,7 +136,7 @@ protected:
static ::testing::AssertionResult AssertIsStartPosition(const char*, const TileCoordsXYZ& location)
{
const uint32_t expectedSurfaceStyle = 11u;
const uint32_t expectedSurfaceStyle = 11U;
const uint32_t style = MapGetSurfaceElementAt(location.ToCoordsXYZ())->GetSurfaceStyle();
if (style != expectedSurfaceStyle)
@ -150,7 +150,7 @@ protected:
static ::testing::AssertionResult AssertIsNotForbiddenPosition(const char*, const TileCoordsXYZ& location)
{
const uint32_t forbiddenSurfaceStyle = 8u;
const uint32_t forbiddenSurfaceStyle = 8U;
const uint32_t style = MapGetSurfaceElementAt(location.ToCoordsXYZ())->GetSurfaceStyle();