Style changes

This commit is contained in:
Lior Halphon 2019-06-14 14:34:02 +03:00
parent 8389c6a450
commit 5a04054145

View File

@ -2,13 +2,15 @@
#include <inttypes.h>
#include <stdio.h>
void pair(size_t count, uint8_t byte) {
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 {
}
else {
assert(count <= 15);
uint8_t control = (count << 4) | unique_count;
putchar(control);
@ -19,7 +21,8 @@ void pair(size_t count, uint8_t byte) {
if (count != 0) {
putchar(byte);
} else {
}
else {
assert(control == 0);
}
@ -27,7 +30,8 @@ void pair(size_t count, uint8_t byte) {
}
}
int main(int argc, char *argv[]) {
int main(int argc, char *argv[])
{
size_t count = 1;
uint8_t byte = getchar();
int new;
@ -36,7 +40,8 @@ int main(int argc, char *argv[]) {
while ((new = getchar()) != EOF) {
if (byte == new) {
count++;
} else {
}
else {
pair(count, byte);
byte = new;
count = 1;