22 lines
314 B
C
22 lines
314 B
C
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include "ucore_string.h"
|
|
|
|
char*
|
|
uc_sprintbc(char *result, unsigned char value)
|
|
{
|
|
char *s = result;
|
|
unsigned char mask = ~((unsigned char) (~0) >> 1);
|
|
|
|
if (s) {
|
|
while (mask) {
|
|
*s++ = (mask & value) ? '1' : '0';
|
|
mask >>= 1;
|
|
}
|
|
*s = '\0';
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|