| Last change
 on this file since 2638 was             1392, checked in by bird, 22 years ago | 
        
          | 
This commit was generated by cvs2svn to compensate for changes in r1391,which included commits to RCS files with non-trunk default branches.
 
 | 
        
          | 
              
Property                 cvs2svn:cvs-rev
 set to                 1.1.1.2
Property                 svn:eol-style
 set to                 native
Property                 svn:executable
 set to                 * | 
        
          | File size:
            779 bytes | 
      
      
| Line |  | 
|---|
| 1 | /*      @(#)fmtlib.c    1.2     */ | 
|---|
| 2 | #define MAXINTLENGTH 23 | 
|---|
| 3 | #include "config.h" | 
|---|
| 4 |  | 
|---|
| 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 | 
|---|
| 12 |  | 
|---|
| 13 | char * | 
|---|
| 14 | f__icvt (longint value, int *ndigit, int *sign, int base) | 
|---|
| 15 | { | 
|---|
| 16 | static char buf[MAXINTLENGTH + 1]; | 
|---|
| 17 | register int i; | 
|---|
| 18 | ulongint uvalue; | 
|---|
| 19 |  | 
|---|
| 20 | if (value > 0) | 
|---|
| 21 | { | 
|---|
| 22 | uvalue = value; | 
|---|
| 23 | *sign = 0; | 
|---|
| 24 | } | 
|---|
| 25 | else if (value < 0) | 
|---|
| 26 | { | 
|---|
| 27 | uvalue = -value; | 
|---|
| 28 | *sign = 1; | 
|---|
| 29 | } | 
|---|
| 30 | else | 
|---|
| 31 | { | 
|---|
| 32 | *sign = 0; | 
|---|
| 33 | *ndigit = 1; | 
|---|
| 34 | buf[MAXINTLENGTH - 1] = '0'; | 
|---|
| 35 | return &buf[MAXINTLENGTH - 1]; | 
|---|
| 36 | } | 
|---|
| 37 | i = MAXINTLENGTH; | 
|---|
| 38 | do | 
|---|
| 39 | { | 
|---|
| 40 | buf[--i] = (uvalue % base) + '0'; | 
|---|
| 41 | uvalue /= base; | 
|---|
| 42 | } | 
|---|
| 43 | while (uvalue > 0); | 
|---|
| 44 | *ndigit = MAXINTLENGTH - i; | 
|---|
| 45 | return &buf[i]; | 
|---|
| 46 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.