* gcc_release (build_sources): Use two new variables EXPORTTAG and
[official-gcc.git] / libf2c / libI77 / fmtlib.c
blob3d2a299d232e59bc3931dc8ed9b33d10dae85ece
1 /* @(#)fmtlib.c 1.2 */
2 #define MAXINTLENGTH 23
3 #include "config.h"
5 #include "f2c.h"
6 #ifndef Allow_TYQUAD
7 #undef longint
8 #define longint long
9 #undef ulongint
10 #define ulongint unsigned long
11 #endif
13 char *
14 f__icvt (longint value, int *ndigit, int *sign, int base)
16 static char buf[MAXINTLENGTH + 1];
17 register int i;
18 ulongint uvalue;
20 if (value > 0)
22 uvalue = value;
23 *sign = 0;
25 else if (value < 0)
27 uvalue = -value;
28 *sign = 1;
30 else
32 *sign = 0;
33 *ndigit = 1;
34 buf[MAXINTLENGTH - 1] = '0';
35 return &buf[MAXINTLENGTH - 1];
37 i = MAXINTLENGTH;
40 buf[--i] = (uvalue % base) + '0';
41 uvalue /= base;
43 while (uvalue > 0);
44 *ndigit = MAXINTLENGTH - i;
45 return &buf[i];