mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-15 11:20:03 +00:00
21 lines
274 B
C
21 lines
274 B
C
|
#include <u.h>
|
||
|
#include <libc.h>
|
||
|
#include <bio.h>
|
||
|
#include <mach.h>
|
||
|
|
||
|
char *
|
||
|
_hexify(char *buf, ulong p, int zeros)
|
||
|
{
|
||
|
ulong d;
|
||
|
|
||
|
d = p/16;
|
||
|
if(d)
|
||
|
buf = _hexify(buf, d, zeros-1);
|
||
|
else
|
||
|
while(zeros--)
|
||
|
*buf++ = '0';
|
||
|
*buf++ = "0123456789abcdef"[p&0x0f];
|
||
|
return buf;
|
||
|
}
|
||
|
|