RISC-V/V203/hello/linux/print.cpp
2024-08-18 21:29:44 +02:00

24 lines
569 B
C++

#include <cstdio>
#include <mutex>
#include "utils.h"
void print_morse_table (const TABLE<unsigned char, 64> & tab) {
int n = 0;
printf("static const unsigned char compressed_table [] = {");
for (auto & e: tab) {
if ((n % 16) == 0) printf("\n ");
printf("0x%02x,", e);
n++;
}
printf("\n};\n");
}
void print_sinus_table (const TABLE<unsigned short, 256> & tab) {
int n = 0;
printf("static const uint16_t sin_tab [] = {");
for (auto & e: tab) {
if ((n % 16) == 0) printf("\n");
printf("%5du,", e);
n++;
}
printf("\n};\n");
}