mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-15 03:12:35 +03:00
1402c59305
git-svn-id: svn://kolibrios.org@1408 a494cfbc-eb01-0410-851d-a64ba20cac60
22 lines
391 B
C
22 lines
391 B
C
/*
|
|
* icompute.c - compute an integer
|
|
*/
|
|
/* $Header$ */
|
|
|
|
#include "loc_incl.h"
|
|
|
|
/* This routine is used in doprnt.c as well as in tmpfile.c and tmpnam.c. */
|
|
|
|
char *
|
|
_i_compute(unsigned long val, int base, char *s, int nrdigits)
|
|
{
|
|
int c;
|
|
|
|
c= val % base ;
|
|
val /= base ;
|
|
if (val || nrdigits > 1)
|
|
s = _i_compute(val, base, s, nrdigits - 1);
|
|
*s++ = (c>9 ? c-10+'a' : c+'0');
|
|
return s;
|
|
}
|