don't need logo-compress.c anymore

This commit is contained in:
Damian Yerrick 2019-07-16 17:04:23 -04:00
parent 4504de828a
commit 26cf970713

View File

@ -1,62 +0,0 @@
#include <assert.h>
#include <inttypes.h>
#include <stdio.h>
#ifdef _WIN32
#include <io.h>
#include <fcntl.h>
#endif
void pair(size_t count, uint8_t byte)
{
static size_t unique_count = 0;
static uint8_t unique_data[15];
if (count == 1) {
unique_data[unique_count++] = byte;
assert(unique_count <= 15);
}
else {
assert(count <= 15);
uint8_t control = (count << 4) | unique_count;
putchar(control);
for (size_t i = 0; i < unique_count; i++) {
putchar(unique_data[i]);
}
if (count != 0) {
putchar(byte);
}
else {
assert(control == 0);
}
unique_count = 0;
}
}
int main(int argc, char *argv[])
{
size_t count = 1;
uint8_t byte = getchar();
int new;
size_t position = 0;
#ifdef _WIN32
_setmode(0,_O_BINARY);
_setmode(1,_O_BINARY);
#endif
while ((new = getchar()) != EOF) {
if (byte == new) {
count++;
}
else {
pair(count, byte);
byte = new;
count = 1;
}
}
pair(count, byte);
pair(0, 0);
}