experimental branch to build BaS with a GNU toolchain.

branched from Rev 38 of trunk
This commit is contained in:
Markus Fröschle
2012-10-11 09:50:51 +00:00
parent d5a1713089
commit 522d92cc5f
607 changed files with 187372 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
/*
* File: ltoa.c
* Purpose: Function normally found in a standard C lib.
*
* Notes: This supports ASCII only!!!
*/
void ltoa(char *buf, long n, unsigned long base)
{
unsigned long un;
char *tmp, ch;
un = n;
if((base == 10) && (n < 0))
{
*buf++ = '-';
un = -n;
}
tmp = buf;
do
{
ch = un % base;
un = un / base;
if(ch <= 9)
ch += '0';
else
ch += 'a' - 10;
*tmp++ = ch;
}
while(un);
*tmp = '\0';
while(tmp > buf)
{
ch = *buf;
*buf++ = *--tmp;
*tmp = ch;
}
}