mirror of
https://github.com/TomHarte/CLK.git
synced 2026-04-21 17:16:44 +00:00
Rename SizedCounter.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "ClockReceiver/ClockReceiver.hpp"
|
||||
#include "Numeric/SizedCounter.hpp"
|
||||
#include "Numeric/SizedInt.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
@@ -23,12 +23,12 @@
|
||||
|
||||
namespace Motorola::CRTC {
|
||||
|
||||
using RefreshAddress = Numeric::SizedCounter<14>;
|
||||
using LineAddress = Numeric::SizedCounter<5>;
|
||||
using RefreshAddress = Numeric::SizedInt<14>;
|
||||
using LineAddress = Numeric::SizedInt<5>;
|
||||
|
||||
using SyncCounter = Numeric::SizedCounter<4>;
|
||||
using CharacterAddress = Numeric::SizedCounter<8>;
|
||||
using RowAddress = Numeric::SizedCounter<7>;
|
||||
using SyncCounter = Numeric::SizedInt<4>;
|
||||
using CharacterAddress = Numeric::SizedInt<8>;
|
||||
using RowAddress = Numeric::SizedInt<7>;
|
||||
|
||||
struct BusState {
|
||||
bool display_enable = false;
|
||||
@@ -40,7 +40,7 @@ struct BusState {
|
||||
|
||||
// Not strictly part of the bus state; provided because the partition between 6845 and bus handler
|
||||
// doesn't quite hold up in some emulated systems where the two are integrated and share more state.
|
||||
Numeric::SizedCounter<5> field_count = 0; // field_counter
|
||||
Numeric::SizedInt<5> field_count = 0; // field_counter
|
||||
};
|
||||
|
||||
class BusHandler {
|
||||
@@ -521,7 +521,7 @@ private:
|
||||
int selected_register_ = 0;
|
||||
|
||||
CharacterAddress character_counter_; // h_counter
|
||||
Numeric::SizedCounter<3> character_reset_history_; // sol
|
||||
Numeric::SizedInt<3> character_reset_history_; // sol
|
||||
RowAddress row_counter_; // row_counter
|
||||
RowAddress next_row_counter_; // row_counter_next
|
||||
LineAddress line_; // line_counter
|
||||
@@ -556,7 +556,7 @@ private:
|
||||
|
||||
bool reset_ = false;
|
||||
|
||||
Numeric::SizedCounter<3> cursor_history_; // cursor0, cursor1, cursor2 [TODO]
|
||||
Numeric::SizedInt<3> cursor_history_; // cursor0, cursor1, cursor2 [TODO]
|
||||
bool line_is_interlaced_ = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ void SAA5050Serialiser::set_reveal(const bool reveal) {
|
||||
reveal_ = reveal;
|
||||
}
|
||||
|
||||
void SAA5050Serialiser::add(const Numeric::SizedCounter<7> c) {
|
||||
void SAA5050Serialiser::add(const Numeric::SizedInt<7> c) {
|
||||
has_output_ = true;
|
||||
if(c.get() < 32) {
|
||||
output_.pixels = hold_graphics_ ? pixels(last_graphic_) : 0;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include "Numeric/SizedCounter.hpp"
|
||||
#include "Numeric/SizedInt.hpp"
|
||||
|
||||
namespace Mullard {
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
void begin_frame(bool is_odd);
|
||||
void begin_line();
|
||||
|
||||
void add(Numeric::SizedCounter<7>);
|
||||
void add(Numeric::SizedInt<7>);
|
||||
|
||||
struct Output {
|
||||
// The low twelve bits of this word provide 1bpp pixels.
|
||||
|
||||
@@ -17,59 +17,59 @@ namespace Numeric {
|
||||
to act like a standard C++ numeric type.
|
||||
*/
|
||||
template <int bits>
|
||||
struct SizedCounter {
|
||||
struct SizedInt {
|
||||
using IntT = MinIntForValue<1 << bits>::type;
|
||||
inline static constexpr IntT Mask = (1 << bits) - 1;
|
||||
|
||||
constexpr SizedCounter(const IntT start_value) noexcept : counter_(start_value & Mask) {}
|
||||
SizedCounter() = default;
|
||||
constexpr SizedInt(const IntT start_value) noexcept : counter_(start_value & Mask) {}
|
||||
SizedInt() = default;
|
||||
|
||||
IntT get() const {
|
||||
return counter_;
|
||||
}
|
||||
|
||||
SizedCounter operator +(const SizedCounter offset) const { return SizedCounter<bits>(counter_ + offset.counter_); }
|
||||
SizedCounter operator -(const SizedCounter offset) const { return SizedCounter<bits>(counter_ - offset.counter_); }
|
||||
SizedCounter operator &(const SizedCounter offset) const { return SizedCounter<bits>(counter_ & offset.counter_); }
|
||||
SizedCounter operator |(const SizedCounter offset) const { return SizedCounter<bits>(counter_ | offset.counter_); }
|
||||
SizedCounter operator ^(const SizedCounter offset) const { return SizedCounter<bits>(counter_ ^ offset.counter_); }
|
||||
SizedCounter operator >>(const int shift) const { return SizedCounter<bits>(counter_ >> shift); }
|
||||
SizedCounter operator <<(const int shift) const { return SizedCounter<bits>(counter_ << shift); }
|
||||
SizedInt operator +(const SizedInt offset) const { return SizedInt<bits>(counter_ + offset.counter_); }
|
||||
SizedInt operator -(const SizedInt offset) const { return SizedInt<bits>(counter_ - offset.counter_); }
|
||||
SizedInt operator &(const SizedInt offset) const { return SizedInt<bits>(counter_ & offset.counter_); }
|
||||
SizedInt operator |(const SizedInt offset) const { return SizedInt<bits>(counter_ | offset.counter_); }
|
||||
SizedInt operator ^(const SizedInt offset) const { return SizedInt<bits>(counter_ ^ offset.counter_); }
|
||||
SizedInt operator >>(const int shift) const { return SizedInt<bits>(counter_ >> shift); }
|
||||
SizedInt operator <<(const int shift) const { return SizedInt<bits>(counter_ << shift); }
|
||||
|
||||
SizedCounter &operator &=(const SizedCounter offset) {
|
||||
SizedInt &operator &=(const SizedInt offset) {
|
||||
counter_ &= offset.counter_;
|
||||
return *this;
|
||||
}
|
||||
SizedCounter &operator |=(const SizedCounter offset) {
|
||||
SizedInt &operator |=(const SizedInt offset) {
|
||||
counter_ |= offset.counter_;
|
||||
return *this;
|
||||
}
|
||||
SizedCounter &operator ^=(const SizedCounter offset) {
|
||||
SizedInt &operator ^=(const SizedInt offset) {
|
||||
counter_ ^= offset.counter_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SizedCounter &operator <<=(const int shift) {
|
||||
SizedInt &operator <<=(const int shift) {
|
||||
counter_ = (counter_ << shift) & Mask;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SizedCounter &operator >>=(const int shift) {
|
||||
SizedInt &operator >>=(const int shift) {
|
||||
counter_ >>= shift;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SizedCounter &operator ++(int) {
|
||||
SizedInt &operator ++(int) {
|
||||
++(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SizedCounter &operator ++() {
|
||||
SizedInt &operator ++() {
|
||||
counter_ = (counter_ + 1) & Mask;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SizedCounter &operator +=(const IntT rhs) {
|
||||
SizedInt &operator +=(const IntT rhs) {
|
||||
counter_ = (counter_ + rhs) & Mask;
|
||||
return *this;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ struct SizedCounter {
|
||||
return !counter_;
|
||||
}
|
||||
|
||||
auto operator <=>(const SizedCounter &) const = default;
|
||||
auto operator <=>(const SizedInt &) const = default;
|
||||
|
||||
/// Replaces the bits in the range [begin, end) with those in the low-order bits of @c vlaue.
|
||||
template <int begin, int end>
|
||||
@@ -1797,7 +1797,7 @@
|
||||
4B8805FA1DCFF807003085B1 /* Oric.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Oric.hpp; path = Parsers/Oric.hpp; sourceTree = "<group>"; };
|
||||
4B882F582C2F9C6900D84031 /* CPCShakerTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CPCShakerTests.mm; sourceTree = "<group>"; };
|
||||
4B882F5A2C2F9C7700D84031 /* Shaker */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Shaker; sourceTree = "<group>"; };
|
||||
4B88559C2E8185BF00E251DD /* SizedCounter.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = SizedCounter.hpp; sourceTree = "<group>"; };
|
||||
4B88559C2E8185BF00E251DD /* SizedInt.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = SizedInt.hpp; sourceTree = "<group>"; };
|
||||
4B8855A22E84D51B00E251DD /* SAA5050.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = SAA5050.hpp; sourceTree = "<group>"; };
|
||||
4B8855A32E84D51B00E251DD /* SAA5050.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SAA5050.cpp; sourceTree = "<group>"; };
|
||||
4B89449220194A47007DE474 /* CSStaticAnalyser+TargetVector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "CSStaticAnalyser+TargetVector.h"; path = "StaticAnalyser/CSStaticAnalyser+TargetVector.h"; sourceTree = "<group>"; };
|
||||
@@ -3753,7 +3753,7 @@
|
||||
4B7BA03F23D55E7900B98D9E /* LFSR.hpp */,
|
||||
4B66E1A8297719270057ED0F /* NumericCoder.hpp */,
|
||||
4BB5B995281B1D3E00522DA9 /* RegisterSizes.hpp */,
|
||||
4B88559C2E8185BF00E251DD /* SizedCounter.hpp */,
|
||||
4B88559C2E8185BF00E251DD /* SizedInt.hpp */,
|
||||
4BFEA2F12682A90200EBF94C /* Sizes.hpp */,
|
||||
4BD9713A2BFD7E7100C907AA /* StringSimilarity.hpp */,
|
||||
4B0329202D0A78DC00C51EB5 /* UpperBound.hpp */,
|
||||
|
||||
Reference in New Issue
Block a user