/[MITgcm]/mitgcm.org/devel/buildweb/code-browser/F90Mapper/base36.c
ViewVC logotype

Contents of /mitgcm.org/devel/buildweb/code-browser/F90Mapper/base36.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Fri Sep 20 19:47:31 2002 UTC (22 years, 9 months ago) by adcroft
Branch: Import
CVS Tags: baseline
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
Importing web-site building process.

1 char *base36(n)
2 /* Returns a character string representing an integer in base 36 */
3 int n;
4 {
5 char *base = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
6 int i, l;
7 char buffer,num[500];
8 static char rev[500];
9 i = strlen(base);
10 l=0;
11 while ( n > i-1 ) {
12 num[l]=base[n-i*(n/i)];
13 ++l;
14 n = n/i;
15 }
16 num[l]=base[n];
17 rev[l+1]='\0';
18 for (i=0;l>=0;--l){
19 rev[i]=num[l];
20 ++i;
21 }
22 return(rev);
23 }
24

  ViewVC Help
Powered by ViewVC 1.1.22