caos-with-snake/lib/bribki.h

21 lines
362 B
C

#pragma once
#include <stdint.h>
/* Bribki are stored here */
typedef struct {
char chars[5];
} DebugBribka;
DebugBribka byte_to_string_bribka(uint8_t byte) {
DebugBribka res = {.chars = {' ', ' ', ' ', ' ', 0}};
int p = 3;
while (byte > 0) {
uint8_t d = byte % 10;
byte /= 10;
res.chars[p] = (char)(d) + '0';
p--;
}
return res;
}