source: trunk/minix/lib/stdio/icompute.c@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 470 bytes
Line 
1/*
2 * icompute.c - compute an integer
3 */
4/* $Header: /cvsup/minix/src/lib/stdio/icompute.c,v 1.1.1.1 2005/04/21 14:56:35 beng Exp $ */
5
6#include "loc_incl.h"
7
8/* This routine is used in doprnt.c as well as in tmpfile.c and tmpnam.c. */
9
10char *
11_i_compute(unsigned long val, int base, char *s, int nrdigits)
12{
13 int c;
14
15 c= val % base ;
16 val /= base ;
17 if (val || nrdigits > 1)
18 s = _i_compute(val, base, s, nrdigits - 1);
19 *s++ = (c>9 ? c-10+'a' : c+'0');
20 return s;
21}
Note: See TracBrowser for help on using the repository browser.