Change long long int to fixed width integer type int64_t

This commit is contained in:
2025-05-22 16:12:56 +02:00
parent 97b61836d8
commit 0b70db7670
35 changed files with 93 additions and 96 deletions

View File

@@ -20,7 +20,7 @@
#include <aoc/framework/Solver-types.hpp>
class BridgeRepair
: public Solver<long long, long long>
: public Solver<int64_t, int64_t>
{
public:
virtual const std::string getPuzzleName() const override;
@@ -28,6 +28,6 @@ class BridgeRepair
virtual void processDataLine(const std::string& line) override;
virtual void finish() override;
private:
bool testCalibration(const long long int testValue, const std::vector<std::pair<int, int>>& calibrationNumbers,
const size_t currentIndex, const bool allowConcatenation, const long long int accumulatedTestValue);
bool testCalibration(const int64_t testValue, const std::vector<std::pair<int, int>>& calibrationNumbers,
const size_t currentIndex, const bool allowConcatenation, const int64_t accumulatedTestValue);
};

View File

@@ -20,7 +20,7 @@
#include <aoc/framework/LinesSolver-types.hpp>
class CeresSearch
: public LinesSolver<long long, long long>
: public LinesSolver<int64_t, int64_t>
{
public:
virtual const std::string getPuzzleName() const override;

View File

@@ -24,7 +24,7 @@
#include <aoc/framework/Solver-types.hpp>
class ChronospatialComputer
: public Solver<std::string, long long>
: public Solver<std::string, int64_t>
{
public:
ChronospatialComputer();
@@ -37,5 +37,5 @@ class ChronospatialComputer
std::array<std::unique_ptr<ChronospatialComputerInstruction>, 8> instructions_;
std::vector<int> program_;
ChronospatialComputerState state_;
long long findQuineState();
int64_t findQuineState();
};

View File

@@ -19,7 +19,7 @@
#include <aoc/framework/Solver-types.hpp>
class ClawContraption
: public Solver<long long, long long>
: public Solver<int64_t, int64_t>
{
public:
virtual const std::string getPuzzleName() const override;
@@ -32,7 +32,7 @@ class ClawContraption
static constexpr int getNMaxButtonPushes();
static constexpr int getButtonACost();
static constexpr int getButtonBCost();
static constexpr long long int getConversionCorrection();
long long int calcTokenCost(const Point2& buttonA, const Point2& buttonB, const Point2& prize,
const long long int offset);
static constexpr int64_t getConversionCorrection();
int64_t calcTokenCost(const Point2& buttonA, const Point2& buttonB, const Point2& prize,
const int64_t offset);
};

View File

@@ -22,7 +22,7 @@
#include <aoc/framework/Solver-types.hpp>
class DiskFragmenter
: public Solver<long long, long long>
: public Solver<int64_t, int64_t>
{
public:
virtual const std::string getPuzzleName() const override;
@@ -41,5 +41,5 @@ class DiskFragmenter
void keepBackFile(const std::string& line, size_t& back, size_t& backIdNumber, const int nBackBlocks,
size_t& position);
unsigned int getDigit(const std::string& line, const size_t index) const;
long long int calcChecksumPart(const size_t idNumber, const int nBlocks, size_t& position) const;
int64_t calcChecksumPart(const size_t idNumber, const int nBlocks, size_t& position) const;
};

View File

@@ -22,7 +22,7 @@
#include <aoc/framework/LinesSolver.hpp>
class GardenGroups
: public LinesSolver<long long, long long>
: public LinesSolver<int64_t, int64_t>
{
public:
GardenGroups(const int inputFileNameSuffix = 0);

View File

@@ -23,7 +23,7 @@
#include <aoc/framework/LinesSolver.hpp>
class GuardGallivant
: public LinesSolver<long long, long long>
: public LinesSolver<int64_t, int64_t>
{
public:
virtual const std::string getPuzzleName() const override;

View File

@@ -20,7 +20,7 @@
#include <aoc/framework/Solver-types.hpp>
class HistorianHysteria
: public Solver<long long, long long>
: public Solver<int64_t, int64_t>
{
public:
virtual const std::string getPuzzleName() const override;

View File

@@ -21,7 +21,7 @@
#include <aoc/framework/LinesSolver.hpp>
class HoofIt
: public LinesSolver<long long, long long>
: public LinesSolver<int64_t, int64_t>
{
public:
virtual const std::string getPuzzleName() const override;

View File

@@ -19,7 +19,7 @@
#include <aoc/framework/Solver-types.hpp>
class LanParty
: public Solver<long long, std::string>
: public Solver<int64_t, std::string>
{
public:
virtual const std::string getPuzzleName() const override;

View File

@@ -20,7 +20,7 @@
#include <aoc/framework/Solver-types.hpp>
class MullItOver
: public Solver<long long, long long>
: public Solver<int64_t, int64_t>
{
public:
MullItOver();

View File

@@ -21,7 +21,7 @@
#include <aoc/framework/Solver-types.hpp>
class PlutonianPebbles
: public Solver<long long, long long>
: public Solver<int64_t, int64_t>
{
public:
virtual const std::string getPuzzleName() const override;
@@ -31,9 +31,8 @@ class PlutonianPebbles
private:
static constexpr int getNBlinksPart1();
static constexpr int getNBlinksPart2();
std::map<long long int, std::vector<long long int>> blinkMap_{};
void addPebble(std::map<long long int, long long int>& pebbles, const long long int pebbleNumber,
long long int cardinality);
void addNextBlinkNumbers(const long long int pebbleNumber, std::vector<long long int>& nextBlinkNumbers);
int getNNextBlinkNumbers(const long long int pebbleNumber) const;
std::map<int64_t, std::vector<int64_t>> blinkMap_{};
void addPebble(std::map<int64_t, int64_t>& pebbles, const int64_t pebbleNumber, int64_t cardinality);
void addNextBlinkNumbers(const int64_t pebbleNumber, std::vector<int64_t>& nextBlinkNumbers);
int getNNextBlinkNumbers(const int64_t pebbleNumber) const;
};

View File

@@ -21,7 +21,7 @@
#include <aoc/framework/Solver-types.hpp>
class PrintQueue
: public Solver<long long, long long>
: public Solver<int64_t, int64_t>
{
public:
PrintQueue();

View File

@@ -20,7 +20,7 @@
#include <aoc/framework/Solver-types.hpp>
class RedNosedReports
: public Solver<long long, long long>
: public Solver<int64_t, int64_t>
{
public:
virtual const std::string getPuzzleName() const override;

View File

@@ -26,7 +26,7 @@
#include <aoc/framework/LinesSolver.hpp>
class ReindeerMaze
: public LinesSolver<long long, long long>
: public LinesSolver<int64_t, int64_t>
{
public:
ReindeerMaze(const int inputFileNameSuffix = 0);

View File

@@ -23,7 +23,7 @@
#include <aoc/framework/LinesSolver.hpp>
class ResonantCollinearity
: public LinesSolver<long long, long long>
: public LinesSolver<int64_t, int64_t>
{
public:
virtual const std::string getPuzzleName() const override;
@@ -35,5 +35,5 @@ class ResonantCollinearity
void addNewAntenna(Grid<bool>& antinodeGrid1, Grid<bool>& antinodeGrid2, Point2&& newPosition);
void findNewAntinodes(Grid<bool>& antinodeGrid1, Grid<bool>& antinodeGrid2, Point2&& start,
const Point2& increment);
void addNewAntinode(Grid<bool>& antinodeGrid, Point2& newPosition, long long int& part);
void addNewAntinode(Grid<bool>& antinodeGrid, Point2& newPosition, int64_t& part);
};

View File

@@ -22,7 +22,7 @@
#include <aoc/framework/Solver-types.hpp>
class RestroomRedoubt
: public Solver<long long, long long>
: public Solver<int64_t, int64_t>
{
public:
RestroomRedoubt(const int width = 101, const int height = 103, const bool runPart2 = true);

View File

@@ -21,7 +21,7 @@
#include <aoc/framework/LinesSolver-types.hpp>
class WarehouseWoes
: public LinesSolver<long long, long long>
: public LinesSolver<int64_t, int64_t>
{
public:
WarehouseWoes(const int inputFileNameSuffix = 0);
@@ -43,6 +43,6 @@ class WarehouseWoes
static constexpr char getEmptyChar();
void checkStartingPosition(const std::string& line);
void addWarehouseMap2Line(const std::string& line);
long long int calcAllGpsCoordinates(Lines& warehouseMap, const char boxChar);
long long int calcGpsCoordinate(const size_t x, const size_t y);
int64_t calcAllGpsCoordinates(Lines& warehouseMap, const char boxChar);
int64_t calcGpsCoordinate(const size_t x, const size_t y);
};

View File

@@ -30,7 +30,7 @@ class ChronospatialComputerInstruction
protected:
virtual void runValue(ChronospatialComputerState& state, const int operandValue) const = 0;
private:
std::function<int(const std::array<long long, 3>&, const int)> operandFunctor_;
std::function<int(const std::array<int64_t, 3>&, const int)> operandFunctor_;
};
#pragma region ChronospatialComputerDivisionInstruction

View File

@@ -22,6 +22,6 @@ class ChronospatialComputerState
{
public:
size_t instructionPointer{ 0 };
std::array<long long, 3> registers{};
std::array<int64_t, 3> registers{};
std::ostringstream output{};
};

View File

@@ -15,6 +15,8 @@
#pragma once
#include <cstdint>
class MullData
{
public:
@@ -24,12 +26,12 @@ class MullData
int getFactor(const int index) const;
void setFactor(const int index, const int value);
void updateResult();
long long int getResultPart1() const;
long long int getResultPart2() const;
int64_t getResultPart1() const;
int64_t getResultPart2() const;
private:
bool isEnabled_;
int factor1_;
int factor2_;
long long int part1_;
long long int part2_;
int64_t part1_;
int64_t part2_;
};

View File

@@ -15,4 +15,4 @@
#include <aoc/framework/LinesSolver-impl.hpp>
template class LinesSolver<long long, long long>;
template class LinesSolver<int64_t, int64_t>;

View File

@@ -17,6 +17,6 @@
#include <string>
template class Solver<long long, long long>;
template class Solver<long long, std::string>;
template class Solver<int64_t, int64_t>;
template class Solver<int64_t, std::string>;
template class Solver<std::string, std::string>;