Loading...
Searching...
No Matches
gf_tabutil.cc
Go to the documentation of this file.
/* emacs edit mode for this file is -*- C++ -*- */
#include "config.h"
#include "cf_assert.h"
#include "cf_defs.h"
#include "gf_tabutil.h"
int gf_tab_numdigits62 ( int q )
{
if ( q < 62 )
return 1;
else if ( q < 62*62 )
return 2;
else
return 3;
}
char conv62 ( int i )
{
if ( i < 10 )
return '0' + char(i);
else if ( i < 36 )
return 'A' + char(i-10);
else
return 'a' + char(i-36);
}
void convert62 ( int i, int n, char * p )
{
for ( int j = n-1; j >= 0; j-- ) {
p[j] = conv62( i % 62 );
i /= 62;
}
}
int convback62 ( char c )
{
if ( c >= '0' && c <= '9' )
return int(c) - int('0');
else if ( c >= 'A' && c <= 'Z' )
return int(c) - int('A') + 10;
else
return int(c) - int('a') + 36;
}
int convertback62 ( char * p, int n )
{
int r = 0;
for ( int j = 0; j < n; j++ )
r = r * 62 + convback62( p[j] );
return r;
}
i
int i
Definition cfEzgcd.cc:132
p
int p
Definition cfModGcd.cc:4086
cf_assert.h
assertions for Factory
cf_defs.h
factory switches.
j
int j
Definition facHensel.cc:110
convback62
int convback62(char c)
Definition gf_tabutil.cc:40
convertback62
int convertback62(char *p, int n)
Definition gf_tabutil.cc:50
convert62
void convert62(int i, int n, char *p)
Definition gf_tabutil.cc:32
gf_tab_numdigits62
int gf_tab_numdigits62(int q)
Definition gf_tabutil.cc:12
conv62
char conv62(int i)
Definition gf_tabutil.cc:22
gf_tabutil.h
utility functions to access GF Tables