fmtlib.c
Go to the documentation of this file.
00001 /*      @(#)fmtlib.c    1.2     */
00002 #define MAXINTLENGTH 23
00003 
00004 #include "f2c.h"
00005 #ifdef __cplusplus
00006 extern "C" {
00007 #endif
00008 #ifndef Allow_TYQUAD
00009 #undef longint
00010 #define longint long
00011 #undef ulongint
00012 #define ulongint unsigned long
00013 #endif
00014 
00015 #ifdef KR_headers
00016 char *f__icvt(value,ndigit,sign, base) longint value; int *ndigit,*sign;
00017  register int base;
00018 #else
00019 char *f__icvt(longint value, int *ndigit, int *sign, int base)
00020 #endif
00021 {
00022         static char buf[MAXINTLENGTH+1];
00023         register int i;
00024         ulongint uvalue;
00025 
00026         if(value > 0) {
00027                 uvalue = value;
00028                 *sign = 0;
00029                 }
00030         else if (value < 0) {
00031                 uvalue = -value;
00032                 *sign = 1;
00033                 }
00034         else {
00035                 *sign = 0;
00036                 *ndigit = 1;
00037                 buf[MAXINTLENGTH-1] = '0';
00038                 return &buf[MAXINTLENGTH-1];
00039                 }
00040         i = MAXINTLENGTH;
00041         do {
00042                 buf[--i] = (uvalue%base) + '0';
00043                 uvalue /= base;
00044                 }
00045                 while(uvalue > 0);
00046         *ndigit = MAXINTLENGTH - i;
00047         return &buf[i];
00048         }
00049 #ifdef __cplusplus
00050 }
00051 #endif


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:50