aboutsummaryrefslogtreecommitdiff
path: root/src/libmach/hexify.c
blob: 5f3ed50e10689e14807f9372874b3712fe8f3d76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#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;
}