mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Move the * and + Bytes methods onto Bytes itself.
This commit is contained in:
18
lib/bytes.cc
18
lib/bytes.cc
@@ -215,6 +215,24 @@ Bytes Bytes::reverseBits() const
|
||||
return output;
|
||||
}
|
||||
|
||||
Bytes Bytes::operator + (const Bytes& other)
|
||||
{
|
||||
Bytes output;
|
||||
ByteWriter bw(output);
|
||||
bw += *this;
|
||||
bw += other;
|
||||
return output;
|
||||
}
|
||||
|
||||
Bytes Bytes::operator * (size_t count)
|
||||
{
|
||||
Bytes output;
|
||||
ByteWriter bw(output);
|
||||
while (count--)
|
||||
bw += *this;
|
||||
return output;
|
||||
}
|
||||
|
||||
uint8_t toByte(
|
||||
std::vector<bool>::const_iterator start,
|
||||
std::vector<bool>::const_iterator end)
|
||||
|
||||
@@ -64,6 +64,9 @@ public:
|
||||
std::vector<bool> toBits() const;
|
||||
Bytes reverseBits() const;
|
||||
|
||||
Bytes operator + (const Bytes& other);
|
||||
Bytes operator * (size_t count);
|
||||
|
||||
ByteReader reader() const;
|
||||
ByteWriter writer();
|
||||
|
||||
|
||||
@@ -5,24 +5,6 @@
|
||||
#include "fluxmap.h"
|
||||
#include "lib/usb/greaseweazle.h"
|
||||
|
||||
static Bytes operator + (const Bytes& left, const Bytes& right)
|
||||
{
|
||||
Bytes output;
|
||||
ByteWriter bw(output);
|
||||
bw += left;
|
||||
bw += right;
|
||||
return output;
|
||||
}
|
||||
|
||||
static Bytes operator * (const Bytes& left, size_t count)
|
||||
{
|
||||
Bytes output;
|
||||
ByteWriter bw(output);
|
||||
while (count--)
|
||||
bw += left;
|
||||
return output;
|
||||
}
|
||||
|
||||
#define E28(val) \
|
||||
(1 | ((val)<<1) & 0xff), \
|
||||
(1 | ((val)>>6) & 0xff), \
|
||||
|
||||
@@ -5,24 +5,6 @@
|
||||
#include "fluxmap.h"
|
||||
#include "fluxsource/kryoflux.h"
|
||||
|
||||
static Bytes operator + (const Bytes& left, const Bytes& right)
|
||||
{
|
||||
Bytes output;
|
||||
ByteWriter bw(output);
|
||||
bw += left;
|
||||
bw += right;
|
||||
return output;
|
||||
}
|
||||
|
||||
static Bytes operator * (const Bytes& left, size_t count)
|
||||
{
|
||||
Bytes output;
|
||||
ByteWriter bw(output);
|
||||
while (count--)
|
||||
bw += left;
|
||||
return output;
|
||||
}
|
||||
|
||||
static void test_convert(const Bytes& kryofluxbytes, const Bytes& fluxmapbytes)
|
||||
{
|
||||
std::unique_ptr<Fluxmap> fluxmap = readStream(kryofluxbytes);
|
||||
|
||||
Reference in New Issue
Block a user