Files
fluxengine/lib/encoder.cc
David Given db14642504 Beat the Kryoflux stream reader into enough shape that it will handle the weird
Kryoflux index markers; refactor it to use Bytes rather than raw streams
(because streams in C++ are terrible).
2019-04-14 14:35:52 +02:00

23 lines
393 B
C++

#include "globals.h"
#include "fluxmap.h"
#include "protocol.h"
Fluxmap& Fluxmap::appendBits(const std::vector<bool>& bits, nanoseconds_t clock)
{
nanoseconds_t now = duration();
for (unsigned i=0; i<bits.size(); i++)
{
now += clock;
if (bits[i])
{
unsigned delta = (now - duration()) / NS_PER_TICK;
appendInterval(delta);
appendPulse();
}
}
return *this;
}