GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: lib/libc/stdlib/l64a.c Lines: 0 16 0.0 %
Date: 2017-11-13 Branches: 0 10 0.0 %

Line Branch Exec Source
1
/*	$OpenBSD: l64a.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */
2
/*
3
 * Written by J.T. Conklin <jtc@netbsd.org>.
4
 * Public domain.
5
 */
6
7
#include <errno.h>
8
#include <stdlib.h>
9
10
char *
11
l64a(long value)
12
{
13
	static char buf[8];
14
	char *s = buf;
15
	int digit;
16
	int i;
17
18
	if (value < 0) {
19
		errno = EINVAL;
20
		return(NULL);
21
	}
22
23
	for (i = 0; value != 0 && i < 6; i++) {
24
		digit = value & 0x3f;
25
26
		if (digit < 2)
27
			*s = digit + '.';
28
		else if (digit < 12)
29
			*s = digit + '0' - 2;
30
		else if (digit < 38)
31
			*s = digit + 'A' - 12;
32
		else
33
			*s = digit + 'a' - 38;
34
35
		value >>= 6;
36
		s++;
37
	}
38
39
	*s = '\0';
40
41
	return(buf);
42
}