Skip to content

Commit

Permalink
Repair minor errors found on GCC 13
Browse files Browse the repository at this point in the history
  • Loading branch information
ckormanyos committed Oct 25, 2023
1 parent 3b2e407 commit d0115f1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2019.
// Copyright Christopher Kormanyos 2019 - 2023.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//

// chapter09_02-002_enable_timer_interrupt.cpp

#include <cstdint>
#include <iomanip>
#include <iostream>

Expand Down
18 changes: 10 additions & 8 deletions code_snippets/chapter16/chapter16_08-001_random_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,21 @@ class random_engine
// Perform modulo-2 division, one byte at a time.
for(auto byte = static_cast<std::size_t>(UINT8_C(0)); byte < data.size(); ++byte)
{
constexpr auto left_shift_amount =
static_cast<unsigned>
(
std::numeric_limits<std::uint32_t>::digits - static_cast<int>(INT8_C(8))
);
{
constexpr auto left_shift_amount =
static_cast<unsigned>
(
std::numeric_limits<std::uint32_t>::digits - static_cast<int>(INT8_C(8))
);

// Bring the next byte into the result.
crc ^= static_cast<std::uint32_t>(static_cast<std::uint32_t>(data[byte]) << left_shift_amount);
// Bring the next byte into the result.
crc ^= static_cast<std::uint32_t>(static_cast<std::uint32_t>(data[byte]) << left_shift_amount);
}

// Perform a modulo-2 division, one bit at a time.
for(auto bit = static_cast<std::int_fast8_t>(INT8_C(8)); bit > static_cast<std::int_fast8_t>(INT8_C(0)); --bit)
{
constexpr auto left_shift_amount =
const auto left_shift_amount =
static_cast<unsigned>
(
std::numeric_limits<std::uint32_t>::digits - static_cast<int>(INT8_C(1))
Expand Down

0 comments on commit d0115f1

Please sign in to comment.