Initial import of libucore
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "ucore_string.h"
|
||||
|
||||
|
||||
char*
|
||||
uc_sprintb(char *result, unsigned int value)
|
||||
{
|
||||
char *s = result;
|
||||
unsigned mask = ~((unsigned) (~0) >> 1);
|
||||
|
||||
if (s) {
|
||||
while (mask) {
|
||||
*s++ = (mask & value) ? '1' : '0';
|
||||
mask >>= 1;
|
||||
}
|
||||
*s = '\0';
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user