OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uC-libc/] [misc/] [ltoa.c] - Blame information for rev 199

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/* Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
2
 * This file is part of the Linux-8086 C library and is distributed
3
 * under the GNU Library General Public License.
4
 */
5
 
6
static char buf[12];
7
 
8
extern char * ultoa();
9
 
10
char * ltoa(val)
11
long val;
12
{
13
   char *p;
14
   int flg = 0;
15
   if( val < 0 ) { flg++; val= -val; }
16
   p = ultoa(val);
17
   if(flg) *--p = '-';
18
   return p;
19
}
20
 
21
char * ultoa(val)
22
unsigned long val;
23
{
24
   char *p;
25
 
26
   p = buf+sizeof(buf);
27
   *--p = '\0';
28
 
29
   do
30
   {
31
      *--p = '0' + val%10;
32
      val/=10;
33
   }
34
   while(val);
35
   return p;
36
}
37
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.