Remove ucore_ prefix from headers and source files

This commit is contained in:
Nils O. Selåsdal
2013-03-06 22:22:04 +01:00
parent ee8d9ae19d
commit 8badeaf857
85 changed files with 168 additions and 168 deletions
+53
View File
@@ -0,0 +1,53 @@
#include <ctype.h>
#include <stdint.h>
#include <stddef.h>
#include "ucore/string.h"
size_t
uc_ascii2bcd(const char *ascii, unsigned char *bcdout, unsigned char filler)
{
unsigned char *bcdp = bcdout;
int shift = 0;
*bcdp = 0;
for (; *ascii; ascii++) {
if (*ascii < '0' || *ascii > '9') {
continue;
}
if (shift) {
*bcdp |= (*ascii - '0') << 4;
bcdp++;
} else {
*bcdp = (*ascii - '0');
}
shift = !shift;
}
if (shift) {
*bcdp |= (filler & 0xf) << 4;
bcdp++;
}
return bcdp - bcdout;
}
static const char hex[] = "0123456789ABCDEF";
size_t
uc_bcd2ascii(const unsigned char *bcd, size_t bcdlen, char *asciiout)
{
size_t i;
size_t idx = 0;
for (i = 0; i < bcdlen; i++) {
asciiout[idx++] = hex[bcd[i] & 0xf];
asciiout[idx++] = hex[(bcd[i] & 0xf0) >> 4];
}
asciiout[idx] = 0;
return idx;
}