1
0
mirror of https://github.com/mist-devel/mist-firmware.git synced 2026-02-03 23:03:01 +00:00
Files
mist-devel.mist-firmware/utils.c
Gyorgy Szombathelyi 0769486ad4 Fix user_io_ext_idx
2021-05-16 00:24:45 +02:00

28 lines
495 B
C

#include <stddef.h>
#include <ctype.h>
#include "utils.h"
#include "attrs.h"
unsigned char bin2bcd(unsigned char in) {
return 16*(in/10) + (in % 10);
}
unsigned char bcd2bin(unsigned char in) {
return 10*(in >> 4) + (in & 0x0f);
}
FAST int _strnicmp(const char *s1, const char *s2, size_t n)
{
char c1, c2;
int v;
do
{
c1 = *s1++;
c2 = *s2++;
v = (unsigned int)tolower(c1) - (unsigned int)tolower(c2);
}
while (v == 0 && c1 != '\0' && --n > 0);
return v;
}