1 /* $NetBSD: l64a.c,v 1.14 2012/03/13 21:13:48 christos Exp $ */
4 * Written by J.T. Conklin <jtc@NetBSD.org>.
9 #if defined(LIBC_SCCS) && !defined(lint)
10 __RCSID("$NetBSD: l64a.c,v 1.14 2012/03/13 21:13:48 christos Exp $");
13 #include "namespace.h"
20 __weak_alias(l64a
,_l64a
)
21 __weak_alias(l64a_r
,_l64a_r
)
29 (void)l64a_r(value
, buf
, (int)sizeof (buf
));
34 l64a_r(long value
, char *buffer
, int buflen
)
38 unsigned long v
= value
;
40 _DIAGASSERT(buffer
!= NULL
);
45 for (; v
!= 0 && buflen
> 1; s
++, buflen
--) {
46 digit
= (int)(v
& 0x3f);
53 *s
= digit
+ 'A' - 12;
55 *s
= digit
+ 'a' - 38;
62 return (v
== 0UL ? 0 : -1);